interface: fix check in set_interface_name api
[vpp.git] / extras / vagrant / clearinterfaces.sh
1 #!/usr/bin/env bash
2
3 # Capture all the interface IPs, in case we need them later
4 ip -o addr show > ~vagrant/ifconfiga
5 chown vagrant:vagrant ~vagrant/ifconfiga
6
7 # Disable all ethernet interfaces other than the default route
8 # interface so VPP will use those interfaces.  The VPP auto-blacklist
9 # algorithm prevents the use of any physical interface contained in the
10 # routing table (i.e. "route --inet --inet6") preventing the theft of
11 # the management ethernet interface by VPP from the kernel.
12 for intf in $(ls /sys/class/net) ; do
13     if [ -d /sys/class/net/$intf/device ] &&
14         [ "$(route --inet --inet6 | grep default | grep $intf)" == "" ] ; then
15         sudo -E ifconfig $intf down
16     fi
17 done