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 
<[email protected]> -----

Date: Sun, 15 Feb 2015 07:40:55 -0800
From: Robert Ã…kerblom-Andersson <[email protected]>
To: openvswitch/ovs-issues <[email protected]>
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
[email protected]
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to