diff options
author | Ben Pfaff <blp@ovn.org> | 2017-06-01 07:21:41 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2017-06-01 07:21:41 -0700 |
commit | 0b2c7e690a0ad1efda5487f828690db64133980e (patch) | |
tree | 6ab42ce058d52a668e1bd83e52765af06908c039 /xenserver | |
parent | e2d12c07df97fc19c01f076be0a2bbb388e84c52 (diff) | |
download | openvswitch-0b2c7e690a0ad1efda5487f828690db64133980e.tar.gz |
Replace most uses of and references to "ifconfig" by "ip".
It's becoming more common that OSes include "ip" but not "ifconfig", so
it's best to avoid using the latter. This commit removes most references
to "ifconfig" and replaces them by "ip". It also adds a build-time check
to make it harder to introduce new uses of "ifconfig".
There are important differences between "ifconfig" and "ip":
- An "ifconfig" command that sets an IP address also brings the interface
up, but a similar "ip addr add" command does not, so it is often necessary
(or at least precautionary) to add an "ip link set <dev> up" command.
- "ifconfig" can infer a netmask from an IP adddress, but "ip" always
assumes /32 if none is given.
- "ifconfig" with address 0.0.0.0 removes any configured IP address, but
"ip addr add" does not, so "ifconfig <dev> 0.0.0.0" must be replaced by
"ip addr del" or "ip addr flush".
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'xenserver')
-rw-r--r-- | xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py | 6 | ||||
-rwxr-xr-x | xenserver/opt_xensource_libexec_interface-reconfigure | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py index c65fb3da4..53468b706 100644 --- a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py +++ b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py @@ -1,5 +1,5 @@ # Copyright (c) 2008,2009,2011 Citrix Systems, Inc. -# Copyright (c) 2009,2010,2011,2012,2013 Nicira, Inc. +# Copyright (c) 2009,2010,2011,2012,2013,2017 Nicira, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published @@ -25,7 +25,7 @@ def netdev_down(netdev): if not netdev_exists(netdev): log("netdev: down: device %s does not exist, ignoring" % netdev) return - run_command(["/sbin/ifconfig", netdev, 'down']) + run_command(["/sbin/ip", "link", "set", netdev, 'down']) def netdev_up(netdev, mtu=None): """Bring up a bare network device""" @@ -37,7 +37,7 @@ def netdev_up(netdev, mtu=None): else: mtu = [] - run_command(["/sbin/ifconfig", netdev, 'up'] + mtu) + run_command(["/sbin/ip", "link", "set", netdev, 'up'] + mtu) # This is a list of drivers that do support VLAN tx or rx acceleration, but # to which the VLAN bug workaround should not be applied. This could be diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure index ea4a7421f..a82043fb5 100755 --- a/xenserver/opt_xensource_libexec_interface-reconfigure +++ b/xenserver/opt_xensource_libexec_interface-reconfigure @@ -147,7 +147,7 @@ def netdev_remap_name(pif, already_renamed=[]): def rename_netdev(old_name, new_name): raise Error("Trying to rename %s to %s - This functionality has been removed" % (old_name, new_name)) # log("Changing the name of %s to %s" % (old_name, new_name)) - # run_command(['/sbin/ifconfig', old_name, 'down']) + # run_command(['/sbin/ip', 'link', 'set', old_name, 'down']) # if not run_command(['/sbin/ip', 'link', 'set', old_name, 'name', new_name]): # raise Error("Could not rename %s to %s" % (old_name, new_name)) @@ -191,7 +191,7 @@ def ifdown(netdev): return if not os.path.exists("%s/etc/sysconfig/network-scripts/ifcfg-%s" % (root_prefix(), netdev)): log("ifdown: device %s exists but ifcfg-%s does not" % (netdev,netdev)) - run_command(["/sbin/ifconfig", netdev, 'down']) + run_command(["/sbin/ip", "link", "set", netdev, 'down']) return run_command(["/sbin/ifdown", netdev]) |