mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 22:35:15 +00:00
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>
This commit is contained in:
@@ -240,13 +240,15 @@ class TestArena(xmlrpc.XMLRPC):
|
||||
util.interface_up(bridge)
|
||||
(ip_addr, mask) = util.interface_get_ip(iface)
|
||||
util.interface_assign_ip(bridge, ip_addr, mask)
|
||||
util.interface_up(bridge)
|
||||
util.move_routes(iface, bridge)
|
||||
util.interface_assign_ip(iface, "0.0.0.0", "255.255.255.255")
|
||||
util.interface_remove_ip(iface, ip_addr, mask)
|
||||
ret = vswitch.ovs_vsctl_add_port_to_bridge(bridge, iface)
|
||||
if ret == 0:
|
||||
self.ports.add(iface)
|
||||
else:
|
||||
util.interface_assign_ip(iface, ip_addr, mask)
|
||||
util.interface_up(iface)
|
||||
util.move_routes(bridge, iface)
|
||||
vswitch.ovs_vsctl_del_bridge(bridge)
|
||||
|
||||
@@ -327,6 +329,12 @@ class TestArena(xmlrpc.XMLRPC):
|
||||
"""
|
||||
return util.interface_assign_ip(iface, ip_address, mask)
|
||||
|
||||
def xmlrpc_interface_remove_ip(self, iface, ip_address, mask):
|
||||
"""
|
||||
This function allows to assing ip address to the given interface.
|
||||
"""
|
||||
return util.interface_remove_ip(iface, ip_address, mask)
|
||||
|
||||
def xmlrpc_get_interface(self, address):
|
||||
"""
|
||||
Finds first interface that has given address
|
||||
|
Reference in New Issue
Block a user