[ovs-dev] [PATCH v3] Replace most uses of and references to "ifconfig" by "ip".

Ben Pfaff blp at ovn.org
Fri May 26 15:46:22 UTC 2017


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".

Signed-off-by: Ben Pfaff <blp at ovn.org>
---
I tested this via "make check", only.
v1->v2: Remove unrelated change (thanks Joe!).
v2->v3: Fix errors pointed out by Russell Bryant.

 Documentation/faq/configuration.rst                |  2 +-
 Documentation/faq/issues.rst                       | 19 +++++++-------
 Documentation/faq/vlan.rst                         |  6 ++---
 Documentation/howto/dpdk.rst                       | 12 +++++----
 Documentation/howto/kvm.rst                        |  5 ++--
 Documentation/ref/ovs-vlan-test.8.rst              |  3 ++-
 Documentation/tutorials/ovs-advanced.rst           | 11 ++++----
 Makefile.am                                        | 14 +++++++++++
 python/ovstest/util.py                             | 24 +++++++++---------
 tests/interface-reconfigure.at                     | 29 +++++++++++-----------
 utilities/bugtool/ovs-bugtool.in                   |  6 ++---
 utilities/ovs-ofctl.8.in                           |  4 +--
 utilities/ovs-vsctl.8.in                           |  2 +-
 ...ensource_libexec_InterfaceReconfigureVswitch.py |  6 ++---
 .../opt_xensource_libexec_interface-reconfigure    |  4 +--
 15 files changed, 81 insertions(+), 66 deletions(-)

diff --git a/Documentation/faq/configuration.rst b/Documentation/faq/configuration.rst
index 8bd0e1104d51..1c93a55cc720 100644
--- a/Documentation/faq/configuration.rst
+++ b/Documentation/faq/configuration.rst
@@ -83,7 +83,7 @@ Q: Does Open vSwitch support configuring a port in promiscuous mode?
       destined to a host are delivered to the host's NIC.
 
       This form of promiscuous mode is configured in the guest OS of the VMs on
-      your bridge, e.g. with "ifconfig".
+      your bridge, e.g. with "ip link set <device> promisc".
 
     - The VMware vSwitch uses a different definition of "promiscuous mode".
       When you configure promiscuous mode on a VMware vNIC, the vSwitch sends a
diff --git a/Documentation/faq/issues.rst b/Documentation/faq/issues.rst
index c60336a10569..82d0605da125 100644
--- a/Documentation/faq/issues.rst
+++ b/Documentation/faq/issues.rst
@@ -43,8 +43,8 @@ eth0.  Help!
     itself.  For example, assuming that eth0's IP address is 192.168.128.5, you
     could run the commands below to fix up the situation::
 
-        $ ifconfig eth0 0.0.0.0
-        $ ifconfig br0 192.168.128.5
+        $ ip addr flush dev eth0
+        $ ip addr add 192.168.128.5 dev br0
 
     (If your only connection to the machine running OVS is through the IP
     address in question, then you would want to run all of these commands on a
@@ -56,7 +56,7 @@ eth0.  Help!
     client that was listening on the physical Ethernet interface (e.g. eth0)
     and start one listening on the internal interface (e.g. br0).  You might
     still need to manually clear the IP address from the physical interface
-    (e.g. with "ifconfig eth0 0.0.0.0").
+    (e.g. with "ip addr flush dev eth0").
 
     There is no compelling reason why Open vSwitch must work this way.
     However, this is the way that the Linux kernel bridge module has always
@@ -285,7 +285,7 @@ Q: I created a tap device tap0, configured an IP address on it, and added it to
 a bridge, like this::
 
     $ tunctl -t tap0
-    $ ifconfig tap0 192.168.0.123
+    $ ip addr add 192.168.0.123 dev tap0
     $ ovs-vsctl add-br br0
     $ ovs-vsctl add-port br0 tap0
 
@@ -299,13 +299,13 @@ network, but it doesn't work.  Why not?
 
         $ ovs-vsctl add-br br0
         $ ovs-vsctl add-port br0 int0 -- set Interface int0 type=internal
-        $ ifconfig int0 192.168.0.123
+	$ ip addr add 192.168.0.123 dev int0
 
     Even more simply, you can take advantage of the internal port that every
     bridge has under the name of the bridge::
 
         $ ovs-vsctl add-br br0
-        $ ifconfig br0 192.168.0.123
+	$ ip addr add 192.168.0.123 dev br0
 
     In more detail, a "tap" device is an interface between the Linux (or BSD)
     network stack and a user program that opens it as a socket.  When the "tap"
@@ -380,9 +380,8 @@ keep changing internal ports MTU?
     A: By default Open vSwitch overrides the internal interfaces (e.g. br0)
     MTU.  If you have just an internal interface (e.g. br0) and a physical
     interface (e.g. eth0), then every change in MTU to eth0 will be reflected
-    to br0.  Any manual MTU configuration using `ip` or `ifconfig` on internal
-    interfaces is going to be overridden by Open vSwitch to match the current
-    bridge minimum.
+    to br0.  Any manual MTU configuration using `ip` on internal interfaces is
+    going to be overridden by Open vSwitch to match the current bridge minimum.
 
     Sometimes this behavior is not desirable, for example with tunnels.  The
     MTU of an internal interface can be explicitly set using the following
@@ -392,7 +391,7 @@ keep changing internal ports MTU?
 
     After this, Open vSwitch will configure br0 MTU to 1450.  Since this
     setting is in the database it will be persistent (compared to what happens
-    with `ip` or `ifconfig`).
+    with `ip`).
 
     The MTU configuration can be removed to restore the default behavior
     with::
diff --git a/Documentation/faq/vlan.rst b/Documentation/faq/vlan.rst
index 3b09d89b9438..2e8ae86de7ef 100644
--- a/Documentation/faq/vlan.rst
+++ b/Documentation/faq/vlan.rst
@@ -190,7 +190,7 @@ Q: Can I configure an IP address on a VLAN?
         $ ovs-vsctl add-port br0 eth0
         $ ovs-vsctl add-port br0 vlan9 tag=9 \
             -- set interface vlan9 type=internal
-        $ ifconfig vlan9 192.168.0.7
+	$ ip addr add 192.168.0.7 dev vlan9
 
     See also the following question.
 
@@ -198,9 +198,9 @@ Q: I configured one IP address on VLAN 0 and another on VLAN 9, like this::
 
     $ ovs-vsctl add-br br0
     $ ovs-vsctl add-port br0 eth0
-    $ ifconfig br0 192.168.0.5
+    $ ip addr add 192.168.0.5 dev br0
     $ ovs-vsctl add-port br0 vlan9 tag=9 -- set interface vlan9 type=internal
-    $ ifconfig vlan9 192.168.0.9
+    $ ip addr add 192.168.0.9 dev vlan9
 
 but other hosts that are only on VLAN 0 can reach the IP address configured on
 VLAN 9.  What's going on?
diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index 3bd9e0760cdb..b4b1ef5d2e22 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -262,7 +262,7 @@ vHost ports:
    and CRC lengths (i.e. 18B) from the max supported frame size.  So, to set
    the MTU for a 9018B Jumbo Frame::
 
-       $ ifconfig eth1 mtu 9000
+       $ ip link set eth1 mtu 9000
 
 When Jumbo Frames are enabled, the size of a DPDK port's mbuf segments are
 increased, such that a full Jumbo Frame of a specific size may be accommodated
@@ -565,8 +565,8 @@ testcase and packet forwarding using DPDK testpmd application in the Guest VM.
 For users wishing to do packet forwarding using kernel stack below, you need to
 run the below commands on the guest::
 
-    $ ifconfig eth1 1.1.1.2/24
-    $ ifconfig eth2 1.1.2.2/24
+    $ ip addr add 1.1.1.2/24 dev eth1
+    $ ip addr add 1.1.2.2/24 dev eth2
     $ systemctl stop firewalld.service
     $ systemctl stop iptables.service
     $ sysctl -w net.ipv4.ip_forward=1
@@ -656,8 +656,10 @@ devices to bridge ``br0``. Once complete, follow the below steps:
 
    Configure IP and enable interfaces::
 
-       $ ifconfig eth0 5.5.5.1/24 up
-       $ ifconfig eth1 90.90.90.1/24 up
+       $ ip addr add 5.5.5.1/24 dev eth0
+       $ ip link set eth0 up
+       $ ip addr add 90.90.90.1/24 dev eth1
+       $ ip link set eth1 up
 
    Configure IP forwarding and add route entries::
 
diff --git a/Documentation/howto/kvm.rst b/Documentation/howto/kvm.rst
index 29732a9b37ed..1ad2d979c309 100644
--- a/Documentation/howto/kvm.rst
+++ b/Documentation/howto/kvm.rst
@@ -50,7 +50,7 @@ Create the following two files and store them in known locations. For example::
     #!/bin/sh
 
     switch='br0'
-    /sbin/ifconfig $1 0.0.0.0 up
+    ip link set $1 up
     ovs-vsctl add-port ${switch} $1
     EOF
 
@@ -60,7 +60,8 @@ Create the following two files and store them in known locations. For example::
     #!/bin/sh
 
     switch='br0'
-    /sbin/ifconfig $1 0.0.0.0 down
+    ip addr flush dev $1
+    ip link set $1 down
     ovs-vsctl del-port ${switch} $1
     EOF
 
diff --git a/Documentation/ref/ovs-vlan-test.8.rst b/Documentation/ref/ovs-vlan-test.8.rst
index 59993817562e..8b0b6617fa89 100644
--- a/Documentation/ref/ovs-vlan-test.8.rst
+++ b/Documentation/ref/ovs-vlan-test.8.rst
@@ -93,7 +93,8 @@ with VLAN tag 10::
       -- add-port vlan-br eth1 \
       -- add-port vlan-br vlan-br-tag tag=10 \
       -- set Interface vlan-br-tag type=internal
-    ifconfig vlan-br-tag up 1.2.3.4
+    ip link set vlan-br-tag up
+    ip addr add 1.2.3.4 dev vlan-br-tag
 
 Run an :program:`ovs-vlan-test` server listening for client control traffic on
 `172.16.0.142` port `8080` and VLAN traffic on the default port of `1.2.3.3`::
diff --git a/Documentation/tutorials/ovs-advanced.rst b/Documentation/tutorials/ovs-advanced.rst
index 15785cf5b300..676137f3cd28 100644
--- a/Documentation/tutorials/ovs-advanced.rst
+++ b/Documentation/tutorials/ovs-advanced.rst
@@ -103,10 +103,9 @@ From Open vSwitch's perspective, the bridge that you create this way is as real
 as any other.  You can, for example, connect it to an OpenFlow controller or
 use ``ovs-ofctl`` to examine and modify it and its OpenFlow flow table.  On the
 other hand, the bridge is not visible to the operating system's network stack,
-so ``ifconfig`` or ``ip`` cannot see it or affect it, which means that
-utilities like ``ping`` and ``tcpdump`` will not work either.  (That has its
-good side, too: you can't screw up your computer's network stack by
-manipulating a sandboxed OVS.)
+so ``ip`` cannot see it or affect it, which means that utilities like ``ping``
+and ``tcpdump`` will not work either.  (That has its good side, too: you can't
+screw up your computer's network stack by manipulating a sandboxed OVS.)
 
 When you're done using OVS from the sandbox, exit the nested shell (by entering
 the "exit" shell command or pressing Control+D).  This will kill the daemons
@@ -267,9 +266,9 @@ In addition to adding a port, the ``ovs-vsctl`` command above sets its
   we can talk about OpenFlow port 1 and know that it corresponds to ``p1``.
 
 The ``ovs-ofctl`` command above brings up the simulated interfaces, which are
-down initially, using an OpenFlow request.  The effect is similar to ``ifconfig
+down initially, using an OpenFlow request.  The effect is similar to ``ip link
 up``, but the sandbox's interfaces are not visible to the operating system and
-therefore ``ifconfig`` would not affect them.
+therefore ``ip`` would not affect them.
 
 We have not configured anything related to VLANs or MAC learning.  That's
 because we're going to implement those features in the flow table.
diff --git a/Makefile.am b/Makefile.am
index 4a6b5e5747fa..d810a5e72c72 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -311,6 +311,20 @@ thread-safety-check:
 EXTRA_DIST += build-aux/thread-safety-blacklist
 .PHONY: thread-safety-check
 
+# Check that "ip" is used in preference to "ifconfig", because
+# "ifconfig" is not installed ubiquitously anymore.
+ALL_LOCAL += check-ifconfig
+check-ifconfig:
+	@if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
+	  (cd $(srcdir) && git --no-pager grep -l -E -e 'ifconfig' | \
+           $(EGREP) -v 'Makefile.am|ovs-vsctl-bashcomp|openvswitch-custom\.te'); \
+	then \
+	  echo "See above for list of files that use or reference"; \
+          echo "'ifconfig'.  Please use 'ip' instead."; \
+	  exit 1; \
+	fi
+.PHONY: check-ifconfig
+
 if HAVE_GROFF
 ALL_LOCAL += manpage-check
 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
diff --git a/python/ovstest/util.py b/python/ovstest/util.py
index 839c9e7dac61..b7259d5b6a5b 100644
--- a/python/ovstest/util.py
+++ b/python/ovstest/util.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, 2012 Nicira, Inc.
+# Copyright (c) 2011, 2012, 2017 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -107,22 +107,23 @@ def interface_up(iface):
     """
     This function brings given iface up.
     """
-    ret, _out, _err = start_process(["ifconfig", iface, "up"])
+    ret, _out, _err = start_process(["ip", "link", "set", iface, "up"])
     return ret
 
 
 def interface_assign_ip(iface, ip_addr, mask):
     """
     This function allows to assign IP address to an interface. If mask is an
-    empty string then ifconfig will decide what kind of mask to use. The
+    empty string then "ip" will decide what kind of mask to use. The
     caller can also specify the mask by using CIDR notation in ip argument by
     leaving the mask argument as an empty string. In case of success this
     function returns 0.
     """
-    args = ["ifconfig", iface, ip_addr]
-    if mask is not None:
-        args.append("netmask")
-        args.append(mask)
+    if mask is None:
+        arg = ip_addr
+    else:
+        arg = "%s/%s" % (ip_addr, mask)
+    args = ["ip", "addr", "add", arg, "dev", iface]
     ret, _out, _err = start_process(args)
     return ret
 
@@ -132,14 +133,13 @@ def interface_get_ip(iface):
     This function returns tuple - ip and mask that was assigned to the
     interface.
     """
-    args = ["ifconfig", iface]
+    args = ["ip", "addr", "show", iface]
     ret, out, _err = start_process(args)
 
     if ret == 0:
-        ip = re.search(r'inet addr:(\S+)', out)
-        mask = re.search(r'Mask:(\S+)', out)
-        if ip is not None and mask is not None:
-            return (ip.group(1), mask.group(1))
+        ip = re.search(r'inet (\S+)/(\S+)', out)
+        if ip is not None:
+            return (ip.group(1), ip.group(2))
     else:
         return ret
 
diff --git a/tests/interface-reconfigure.at b/tests/interface-reconfigure.at
index b4e455d94228..a4c0dca07569 100644
--- a/tests/interface-reconfigure.at
+++ b/tests/interface-reconfigure.at
@@ -34,7 +34,6 @@ EOF
 
         for utility in \
             sbin/ethtool \
-            sbin/ifconfig \
             sbin/ifdown \
             sbin/ifup \
             sbin/ip \
@@ -715,7 +714,7 @@ configure_datapath: extra bonds - []
 Applying changes to /etc/sysconfig/network-scripts/route-xenbr2 configuration
 Applying changes to /etc/sysconfig/network configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xenbr2 configuration
-/sbin/ifconfig eth2 up mtu 1500
+/sbin/ip link set eth2 up mtu 1500
 /sbin/ethtool -K eth2 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth2 on
 /usr/bin/ovs-vsctl --timeout=20
@@ -763,7 +762,7 @@ action_down: xenbr2
 deconfigure ipdev xenbr2 on xenbr2
 deconfigure_bridge: bridge           - xenbr2
 action_down: bring down physical devices - ['eth2']
-/sbin/ifconfig eth2 down
+/sbin/ip link set eth2 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xenbr2
     --if-exists del-br xenbr2
@@ -790,7 +789,7 @@ configure_datapath: extra ports - []
 configure_datapath: extra bonds - []
 Applying changes to /etc/sysconfig/network-scripts/route-xapi3 configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi3 configuration
-/sbin/ifconfig eth3 up mtu 1500
+/sbin/ip link set eth3 up mtu 1500
 /sbin/ethtool -K eth3 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth3 on
 /usr/bin/ovs-vsctl --timeout=20
@@ -837,7 +836,7 @@ deconfigure_bridge: bridge           - xapi3
 action_down: no more masters, bring down slave xenbr3
 deconfigure_bridge: bridge           - xenbr3
 action_down: bring down physical devices - ['eth3']
-/sbin/ifconfig eth3 down
+/sbin/ip link set eth3 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi3
     --if-exists del-br xapi3
@@ -876,10 +875,10 @@ netdev: down: device xenbr0 does not exist, ignoring
 netdev: down: device xenbr1 does not exist, ignoring
 Applying changes to /etc/sysconfig/network-scripts/route-xapi1 configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
-/sbin/ifconfig eth0 up mtu 1500
+/sbin/ip link set eth0 up mtu 1500
 /sbin/ethtool -K eth0 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth0 on
-/sbin/ifconfig eth1 up mtu 1500
+/sbin/ip link set eth1 up mtu 1500
 /sbin/ethtool -K eth1 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth1 off
 /usr/bin/ovs-vsctl --timeout=20
@@ -897,7 +896,7 @@ Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
     br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
 /sbin/ifup xapi1
 action_up: bring up bond0
-/sbin/ifconfig bond0 up
+/sbin/ip link set bond0 up
 /sbin/update-issue
 Committing changes to /etc/sysconfig/network-scripts/route-xapi1 configuration
 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
@@ -927,8 +926,8 @@ action_down: xapi1
 deconfigure ipdev xapi1 on xapi1
 deconfigure_bridge: bridge           - xapi1
 action_down: bring down physical devices - ['eth0', 'eth1']
-/sbin/ifconfig eth0 down
-/sbin/ifconfig eth1 down
+/sbin/ip link set eth0 down
+/sbin/ip link set eth1 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi1
     --if-exists del-br xapi1
@@ -966,10 +965,10 @@ netdev: down: device xenbr0 does not exist, ignoring
 netdev: down: device xenbr1 does not exist, ignoring
 Applying changes to /etc/sysconfig/network-scripts/route-xapi2 configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
-/sbin/ifconfig eth0 up mtu 1500
+/sbin/ip link set eth0 up mtu 1500
 /sbin/ethtool -K eth0 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth0 on
-/sbin/ifconfig eth1 up mtu 1500
+/sbin/ip link set eth1 up mtu 1500
 /sbin/ethtool -K eth1 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth1 off
 /usr/bin/ovs-vsctl --timeout=20
@@ -991,7 +990,7 @@ Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
     set Interface xapi2 MAC="00:22:19:22:4b:af"
 /sbin/ifup xapi2
 action_up: bring up bond0
-/sbin/ifconfig bond0 up
+/sbin/ip link set bond0 up
 /sbin/update-issue
 Committing changes to /etc/sysconfig/network-scripts/route-xapi2 configuration
 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
@@ -1023,8 +1022,8 @@ deconfigure_bridge: bridge           - xapi2
 action_down: no more masters, bring down slave xapi1
 deconfigure_bridge: bridge           - xapi1
 action_down: bring down physical devices - ['eth0', 'eth1']
-/sbin/ifconfig eth0 down
-/sbin/ifconfig eth1 down
+/sbin/ip link set eth0 down
+/sbin/ip link set eth1 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi2
     --if-exists del-br xapi2
diff --git a/utilities/bugtool/ovs-bugtool.in b/utilities/bugtool/ovs-bugtool.in
index 506e42876934..5eb3440b7b2c 100755
--- a/utilities/bugtool/ovs-bugtool.in
+++ b/utilities/bugtool/ovs-bugtool.in
@@ -14,7 +14,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 # Copyright (c) 2005, 2007 XenSource Ltd.
-# Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016 Nicira, Inc.
+# Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016, 2017 Nicira, Inc.
 
 #
 # To add new entries to the bugtool, you need to:
@@ -137,7 +137,7 @@ DPKG_QUERY = 'dpkg-query'
 ETHTOOL = 'ethtool'
 FDISK = 'fdisk'
 FIND = 'find'
-IFCONFIG = 'ifconfig'
+IP = 'ip'
 IPTABLES = 'iptables'
 ISCSIADM = 'iscsiadm'
 LOSETUP = 'losetup'
@@ -582,7 +582,7 @@ exclude those logs from the archive.
     file_output(CAP_NETWORK_CONFIG, [OPENVSWITCH_DEFAULT_SWITCH,
                 OPENVSWITCH_SYSCONFIG_SWITCH])
 
-    cmd_output(CAP_NETWORK_INFO, [IFCONFIG, '-a'])
+    cmd_output(CAP_NETWORK_INFO, [IP, 'addr', 'show'])
     cmd_output(CAP_NETWORK_INFO, [ROUTE, '-n'])
     cmd_output(CAP_NETWORK_INFO, [ARP, '-n'])
     cmd_output(CAP_NETWORK_INFO, [NETSTAT, '-an'])
diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in
index ed75b32a3808..56a1ed321d66 100644
--- a/utilities/ovs-ofctl.8.in
+++ b/utilities/ovs-ofctl.8.in
@@ -135,8 +135,8 @@ may be any one of the following:
 .RS
 .IQ \fBup\fR
 .IQ \fBdown\fR
-Enable or disable the interface.  This is equivalent to \fBifconfig
-up\fR or \fBifconfig down\fR on a Unix system.
+Enable or disable the interface.  This is equivalent to \fBip
+link set up\fR or \fBip link set down\fR on a Unix system.
 .
 .IP \fBstp\fR
 .IQ \fBno\-stp\fR
diff --git a/utilities/ovs-vsctl.8.in b/utilities/ovs-vsctl.8.in
index 6aca267a7067..4a440a4d25fa 100644
--- a/utilities/ovs-vsctl.8.in
+++ b/utilities/ovs-vsctl.8.in
@@ -600,7 +600,7 @@ access port for VLAN 10, and configure it with an IP address:
 .IP
 .B "ovs\-vsctl add\-port br0 vlan10 tag=10 \-\- set Interface vlan10 type=internal"
 .IP
-.B "ifconfig vlan10 192.168.0.123"
+.B "ip addr add 192.168.0.123 dev vlan10"
 .
 .PP
 Add a GRE tunnel port \fBgre0\fR to remote IP address 1.2.3.4 to
diff --git a/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py b/xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
index c65fb3da44fc..53468b7064e5 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 ea4a7421facf..a82043fb5b12 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])
 
-- 
2.10.2



More information about the dev mailing list