[Bridge] Bug when using bridge + ipv6 link local addresses

Tomas Carnecky tom at dbservice.com
Sun Jan 31 15:34:14 PST 2010


While trying to make distcc compatible with IPv6, I came across this.. 
uhm, bug..?

My setup: I use a bridge as my primary network interface. This is so I 
can brigde my KVM VMs with the physical network. But most of the time 
the bridge (vmnet) contains only the physical interface (eth0):

$ brctl show vmnet
bridge name	bridge id		STP enabled	interfaces
vmnet		8000.0016d3ce57d9	no		eth0

The network configuration:

$ ifconfig
eth0   Link encap:Ethernet  HWaddr 00:16:d3:ce:57:d9
        inet6 addr: fe80::216:d3ff:fece:57d9/64 Scope:Link

vmnet  Link encap:Ethernet  HWaddr 00:16:d3:ce:57:d9
        inet addr:192.168.0.82  Bcast:192.168.0.255  Mask:255.255.255.0
        inet6 addr: 2001:xxxx:xxxx:0:216:d3ff:fece:57d9/64 Scope:Global
        inet6 addr: fe80::216:d3ff:fece:57d9/64 Scope:Link

As you can see the IPv6 link local address is assigned to both vmnet and 
eth0. But I can ping both interfaces (ping6 fe80..%vmnet and %eth0) just 
fine.

I was able to create a small application which reproduces the bug. In 
short, a server listens on ::, a client connects to a link-local address 
(fe80..%eth0) and starts writing data, while the server reads it from 
the socket. After a while both processes block in read/write 
respectively and I see the following:

$ netstat -ntp
tcp6 0  53188 fe80::...:45398 fe80::....:8080 ESTABLISHED
tcp6 0      0 fe80::....:8080 fe80::...:45398 ESTABLISHED

The send-queue of the writing application has data in it, but somehow 
the reading side can't read it. When I change the client to connect to 
fe80..%vmnet (or ::1 or the global scope address) the test application 
(and distcc) work as expected.

The test application I use is attached. You should change the address 
the client is trying to connect to (line 63, replace it with your real 
link local address and append the scope id of either the bridge or the 
network interface attached to the bridge). This is the output on my box:

child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
child: wrote 4096 bytes
hostname: fe80::216:d3ff:fece:57d9%eth0
parent: read 4096 bytes
parent: read 4096 bytes
parent: read 4096 bytes
parent: read 4096 bytes
parent: read 4076 bytes

The child blocks while writing between byte 49152 and 53248 (which 
matches the contents of the send-queue), and the server blocks sometime 
after reading 20460 bytes.

I am willing to test patches, even experimental ones.

tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bridge-ipv6.c
Type: text/x-csrc
Size: 2500 bytes
Desc: not available
Url : http://lists.linux-foundation.org/pipermail/bridge/attachments/20100201/b087c44e/attachment.c 


More information about the Bridge mailing list