[ovs-discuss] [ovs-issues] Network netspace is cleared when adding new unrelated port (#68)

Ansis Atteka aatteka at nicira.com
Tue Feb 17 03:06:58 UTC 2015


It seems that this bug (interface being moved out of namespace) was
triggered because interface name was changed from m1-eth0 to eth0:

sudo ip netns exec $M1_NSPID ip link set $M1_ETH0 name eth0

I reduced original test to:

#ovs-vsctl add-br brTest
#ovs-vsctl add-port brTest pTest -- set Interface pTest type=internal
#ip netns add nsTest
#ip link set pTest netns nsTest
#ip netns exec nsTest ifconfig -a
lo        Link encap:Local Loopback
          LOOPBACK  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

pTest     Link encap:Ethernet  HWaddr 72:d7:b6:d9:67:61
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

#ip netns exec nsTest ip link set pTest name Test
#ip netns exec nsTest ifconfig -a
Test      Link encap:Ethernet  HWaddr 72:d7:b6:d9:67:61
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          LOOPBACK  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

#ovs-vsctl add-port brTest pTest2 -- set Interface pTest2 type=internal
#ip netns exec nsTest ifconfig -a
lo        Link encap:Local Loopback
          LOOPBACK  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


However, I think there is a bigger issue where OVS does not handle
net-device renames at all, Each rename seem to correlate with
following error message in ovs-vswitchd.log:

2015-02-17T02:35:04.950Z|00052|netdev_linux|WARN|pTest: obtaining
netdev stats via vport failed (No such device)

and then the renamed interface simply disappears and OVS creates a new
one with the original name as specified in OVSDB.

On Sun, Feb 15, 2015 at 8:29 AM, Ben Pfaff <blp at nicira.com> wrote:
> This was filed in OVS's github bug tracker.  I'm forwarding it to the
> bugs list to make sure it doesn't get lost.
>
> ----- Forwarded message from Robert Åkerblom-Andersson <notifications at github.com> -----
>
> Date: Sun, 15 Feb 2015 07:40:55 -0800
> From: Robert Åkerblom-Andersson <notifications at github.com>
> To: openvswitch/ovs-issues <ovs-issues at noreply.github.com>
> Subject: [ovs-issues] Network netspace is cleared when adding new unrelated port
>         (#68)
>
> Hi,
>
> I think I have found a bug, I'm using Linux running:
> ```
> uname -a
> Linux rb-00001 3.13.0-44-generic #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>
> sudo ovs-vsctl -V
> ovs-vsctl (Open vSwitch) 2.3.1
> Compiled Feb 11 2015 13:39:02
> DB Schema 7.6.2
> ```
>
> Simply put, if I setup an OVS port connected to a network namespace, setup it's ip settings etc, then things looks and works good. However, if I add a new internal port to the bridge, then all netns stuff is simply cleared. I create added some commands here to reproduce this.
>
> To test this I assume this:
> - Running Ubuntu 14.04 (but by all means try on a different distro, I don't think this is Ubuntu specific)
> - Docker is installed and the docker deamon has been started with these settings DOCKER_OPTS="-b none --dns 8.8.8.8 --dns 8.8.4.4", meaning it does not create or touch any bridge on it's own. This can be setup in "/etc/default/docker" on Ubuntu (or otherwise in other dists).
>
> To test this the best way, start a bash shell, and then copy paste these command (the first "sudo echo" just to cache sudo access so the other commands can be pasted without issues. I suggest the pasting method of the commands since you can at any point stop and check with additional commands while still keeping all env vars etc):
> ```
> sudo echo
>
> # Settings
> BR="br0"
> MATE_ETH="mate-eth"
> GWADDR="172.17.0.1"
>
> # Bridge network and ip
> BR_NET="172.17.0.0/24"
> BR_IP="172.17.0.1/24"
>
> # Enable ip ip_forward
> sudo sysctl -w net.ipv4.ip_forward=1
>
> # Create bridge
> sudo ovs-vsctl add-br $BR
>
> # Start containers
> M1=$(sudo docker run --privileged -d --net="none" -t -i ubuntu:14.04 /bin/bash)
>
> # Setup ip on $BR
> sudo ip addr add $BR_IP dev $BR
> sudo ip link set dev $BR up
>
> M1_ETH0="m1-eth0"
> M1_IP="172.16.0.11/22"
> M1_GW="172.16.0.1"
> M1_NSPID=`sudo docker inspect -f '{{.State.Pid}}' $M1`
>
> # Setup network namespace pids (namespaces created by Docker)
> sudo mkdir -p /var/run/netns
> sudo rm -f /var/run/netns/$M1_NSPID | true
> sudo ln -s /proc/$M1_NSPID/ns/net /var/run/netns/$M1_NSPID
>
> # Add ovs port
> sudo ovs-vsctl add-port $BR $M1_ETH0 -- set interface $M1_ETH0 type=internal
>
> # Create new ovs ports for router
> sudo ip link set dev $M1_ETH0 up
>
> # Move ports into the containers network namespace
> sudo ip link set $M1_ETH0 netns $M1_NSPID
>
> # Setup IP settings for the netns
> sudo ip netns exec $M1_NSPID ip link set $M1_ETH0 name eth0
> sudo ip netns exec $M1_NSPID ip addr add $M1_IP dev eth0
> sudo ip netns exec $M1_NSPID ip link set dev eth0 up
> sudo ip netns exec $M1_NSPID ip route add default via $M1_GW
> ```
>
> When these command have been run, you can now with this command to see the ip settings:
> ```
> # Check that netns settings looks good, yes, they do
> sudo ip netns exec $M1_NSPID ip link
> sudo ip netns exec $M1_NSPID ip address
> ```
>
> Now try and add a new, unrelated port to the bridge:
> ```
> # Add a unrelated test port to the bridge
> sudo ovs-vsctl add-port br0 testPort -- set interface testPort type=internal
> ```
>
> After this, you can now see how the netns settings have disappeared:
> ```
> # Check again and see how the netns settings have been blown away...
> sudo ip netns exec $M1_NSPID ip link
> sudo ip netns exec $M1_NSPID ip address
> ```
>
> Do anyone have a clue on why this is happening? Feel free to ask if I've been unclear in any way.
>
> Best Regards, Robert
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/openvswitch/ovs-issues/issues/68
>
> ----- End forwarded message -----
> _______________________________________________
> discuss mailing list
> discuss at openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss



More information about the discuss mailing list