On Tue, 2017-05-30 at 09:31 -0700, Ben Pfaff wrote:
> 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 <b...@ovn.org>

A couple of typos below that you can fix on push but otherwise looks
good.

Thanks!

- Greg

> ---
> I tested this via "make check", only.  At least the Python changes need
> real testing before applying.
> v1->v2: Remove unrelated change (thanks Joe!).
> v2->v3: Fix errors pointed out by Russell Bryant.
> v3->v4: Infer /8, /16, /24 from IP addresses instead of relying on "ip".
>   Add many "ip link set up" calls.  Refactor Python code for working
>   with interfaces.  Thanks Greg and Hunt!
> 
>  Documentation/faq/configuration.rst                |  2 +-
>  Documentation/faq/issues.rst                       | 23 +++++-----
>  Documentation/faq/vlan.rst                         |  9 ++--
>  Documentation/howto/dpdk.rst                       | 14 +++---
>  Documentation/howto/kvm.rst                        |  5 ++-
>  Documentation/howto/userspace-tunneling.rst        |  1 +
>  Documentation/ref/ovs-vlan-test.8.rst              |  3 +-
>  Documentation/tutorials/ovs-advanced.rst           | 11 +++--
>  Makefile.am                                        | 14 ++++++
>  python/ovstest/rpcserver.py                        | 10 ++++-
>  python/ovstest/util.py                             | 50 
> +++++++++++++++-------
>  python/ovstest/vswitch.py                          |  1 +
>  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 +-
>  18 files changed, 123 insertions(+), 71 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..c6e33f1a3617 100644
> --- a/Documentation/faq/issues.rst
> +++ b/Documentation/faq/issues.rst
> @@ -43,8 +43,9 @@ 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 addr 192.168.128.5/24 dev br0

Typo.  $ ip addr add

> +        $ ip link set br0 up
>  
>      (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 +57,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 +286,8 @@ 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/24 dev tap0
> +    $ ip link set tap0 up
>      $ ovs-vsctl add-br br0
>      $ ovs-vsctl add-port br0 tap0
>  
> @@ -299,13 +301,15 @@ 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 addr 192.168.0.123/24 dev int0

Another typo of the same sort as above.

> +        $ ip link set int0 up
>  
>      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/24 dev br0
> +        $ ip link set br0 up
>  
>      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 +384,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 +395,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..991bb3d4c7a4 100644
> --- a/Documentation/faq/vlan.rst
> +++ b/Documentation/faq/vlan.rst
> @@ -190,7 +190,8 @@ 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/24 dev vlan9
> +        $ ip link set vlan0 up
>  
>      See also the following question.
>  
> @@ -198,9 +199,11 @@ 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/24 dev br0
> +    $ ip link set br0 up
>      $ 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/24 dev vlan9
> +    $ ip link set vlan0 up
>  
>  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..6d775319413b 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,10 @@ 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
> +    $ ip link set eth1 up
> +    $ ip link set eth2 up
>      $ systemctl stop firewalld.service
>      $ systemctl stop iptables.service
>      $ sysctl -w net.ipv4.ip_forward=1
> @@ -656,8 +658,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 addr add 90.90.90.1/24 dev eth1
> +       $ ip link set eth0 up
> +       $ 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/howto/userspace-tunneling.rst 
> b/Documentation/howto/userspace-tunneling.rst
> index d978b3025cf8..0b488195370b 100644
> --- a/Documentation/howto/userspace-tunneling.rst
> +++ b/Documentation/howto/userspace-tunneling.rst
> @@ -103,6 +103,7 @@ Perform the folowing configuration on `host1`:
>  #. Configure the IP address of the VM interface *in the VM itself*::
>  
>         $ ip addr add 192.168.1.1/24 dev eth0
> +       $ ip link set eth0 up
>  
>  #. On `host1`, add a port for the VXLAN tunnel::
>  
> diff --git a/Documentation/ref/ovs-vlan-test.8.rst 
> b/Documentation/ref/ovs-vlan-test.8.rst
> index 59993817562e..d4fbabbdf39e 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 addr add 1.2.3.4/8 dev vlan-br-tag
> +    ip link set vlan-br-tag up
>  
>  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/rpcserver.py b/python/ovstest/rpcserver.py
> index ca473e01ddc2..ab5b7e89e63a 100644
> --- a/python/ovstest/rpcserver.py
> +++ b/python/ovstest/rpcserver.py
> @@ -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
> diff --git a/python/ovstest/util.py b/python/ovstest/util.py
> index 839c9e7dac61..db2ae989a2bd 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,23 +107,42 @@ 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
> -    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.
> +    This function adds an IP address to an interface. If mask is None
> +    then a mask will be selected automatically.  In case of success
> +    this function returns 0.
>      """
> -    args = ["ifconfig", iface, ip_addr]
> +    interface_ip_op(iface, ip_addr, mask, "add")
> +
> +
> +def interface_remove_ip(iface, ip_addr, mask):
> +    """
> +    This function removes an IP address from an interface. If mask is
> +    None then a mask will be selected automatically.  In case of
> +    success this function returns 0.
> +    """
> +    interface_ip_op(iface, ip_addr, mask, "del")
> +
> +
> +def interface_ip_op(iface, ip_addr, mask, op):
>      if mask is not None:
> -        args.append("netmask")
> -        args.append(mask)
> -    ret, _out, _err = start_process(args)
> +        arg = "%s/%s" % (ip_addr, mask)
> +    elif '/' in ip_addr:
> +        arg = ip_addr
> +    else:
> +        (x1, x2, x3, x4) = struct.unpack("BBBB", socket.inet_aton(ip_addr))
> +        if x1 < 128:
> +            arg = "%s/8" % ip_addr
> +        elif x1 < 192:
> +            arg = "%s/16" % ip_addr
> +        else:
> +            arg = "%s/24" % ip_addr
> +    ret, _out, _err = start_process(["ip", "addr", op, arg, "dev", iface])
>      return ret
>  
> 
> @@ -132,14 +151,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/python/ovstest/vswitch.py b/python/ovstest/vswitch.py
> index 1c6726ea0cc2..9d5b5cffd002 100644
> --- a/python/ovstest/vswitch.py
> +++ b/python/ovstest/vswitch.py
> @@ -41,6 +41,7 @@ def ovs_vsctl_del_pbridge(bridge, iface):
>      """
>      (ip_addr, mask) = util.interface_get_ip(bridge)
>      util.interface_assign_ip(iface, ip_addr, mask)
> +    util.interface_up(iface)
>      util.move_routes(bridge, iface)
>      return ovs_vsctl_del_bridge(bridge)
>  
> 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 d7100b7576be..9013a1e8d022 100644
> --- a/utilities/ovs-ofctl.8.in
> +++ b/utilities/ovs-ofctl.8.in
> @@ -136,8 +136,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..e5e565e8a58a 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/24 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])
>  



_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to