Create two TAP devices, each of which will be read and written by the userland protocol stack. In addition, the two TAP devices are bridged by the Linux Bridge.
The script to prepare the environment is as follows.
sudo ip tuntap add dev tap0 mode tap
sudo ip tuntap add dev tap1 mode tap
sudo ip addr add 10.0.0.1/24 dev tap0
sudo ip addr add 10.0.0.2/24 dev tap1
sudo ip link set up tap0
sudo ip link set up tap1
sudo brctl addbr br0
sudo brctl addif br0 tap1
sudo brctl addif br0 tap0
sudo ip link set br0 up
The userland protocol stack has the ability to send and receive ARP. The procedure to generate this problem was as follows.
- throw an ARP Request from tap0.
- It reaches tap1 via br0 and throws an ARP Reply.
- br0 receives the ARP Reply, but it does not reach tap0.
I captured the packets as follows.
vagrant@impish64:~$ sudo tcpdump -i br0 -nv
tcpdump: listening on br0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:14:23.103549 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.0.0.2 tell 10.0.0.1, length 28
13:14:23.104203 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.0.0.2 is-at 3a:2c:25:5b:e1:40, length 28
vagrant@impish64:~$ sudo tcpdump -i tap0 -nv
tcpdump: listening on tap0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:13:40.868761 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.0.0.2 tell 10.0.0.1, length 28
vagrant@impish64:~$ sudo tcpdump -i tap1 -nv
tcpdump: listening on tap1, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:12:50.368294 ARP, Ethernet (len 6), IPv4 (len 4), Request who-has 10.0.0.2 tell 10.0.0.1, length 28
13:12:50.368699 ARP, Ethernet (len 6), IPv4 (len 4), Reply 10.0.0.2 is-at 3a:2c:25:5b:e1:40, length 28
The diagram of this problem is as follows.
diagram
Why doesn't the ARP Reply fly to tap0
with this setting?