NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

tap(4), bridge(4), rump server networking: seeing duplicated packets



Hello folks,
I'm trying to setup two separate rump servers based on
<https://www.netbsd.org/docs/rump/sptut.html> in order to generate and
record some network traffic via tcpdump(8).
I was able to setup two bridged tap-s interface and they are able to
communicate. However, when observing on an interface the packets seems
duplicated. I would expect to have no duplicate packets.

I have setup the two tap(4)-s and bridge(4) as follows:

```
# sysctl -w net.inet.ip.forwarding=1
# sysctl -w net.inet6.ip6.forwarding=1
# ifconfig tap0 create
# ifconfig tap0 up
# ifconfig tap1 create
# ifconfig tap1 up
# ifconfig bridge0 create
# brconfig bridge0 add tap0 add tap1
# brconfig bridge0 up
```

Then I start the 1st rump server via:

```
$ export RUMP_SERVER=unix:///tmp/rump0
$ rump_allserver ${RUMP_SERVER}
$ rump.ifconfig virt0 create
$ rump.ifconfig virt0 10.0.0.1/24 up
```

...and I start the 2nd rump server via:

```
$ export RUMP_SERVER=unix:///tmp/rump1
$ rump_allserver ${RUMP_SERVER}
$ rump.ifconfig virt1 create
$ rump.ifconfig virt1 10.0.0.2/24 up
```

(This is optional but leaving that here for completeness, then I check
that the networking works by pinging the two servers...
From the 1st rump server:

```
$ rump.ping -c 1 10.0.0.2
PING 10.0.0.2 (10.0.0.2): 56 data bytes
64 bytes from 10.0.0.2: icmp_seq=0 ttl=255 time=3.582870 ms

----10.0.0.2 PING Statistics----
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 3.582870/3.582870/3.582870/0.000000 ms
```

...and the 2nd rump server:

```
$ rump.ping -c 1 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 56 data bytes
64 bytes from 10.0.0.1: icmp_seq=0 ttl=255 time=1.973813 ms

----10.0.0.1 PING Statistics----
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.973813/1.973813/1.973813/0.000000 ms
```
)

All fine here.

However, when I try to spin up a TCP transmission, from the 2nd rump
server (10.0.0.2) I do:

```
$ export LD_PRELOAD=/usr/lib/librumphijack.so
$ socat TCP-LISTEN:1234 -
```

I then start capturing traffic on tap0:

```
$ tcpdump -w /tmp/dup.pcap -n -i tap0
```

...and from the 1st rump server (10.0.0.1) I do:

```
$ export LD_PRELOAD=/usr/lib/librumphijack.so
$ echo 'frobnitz' | socat - TCP-CONNECT:10.0.0.2:1234
```

The corresponding PCAP is:

```
$ tcpdump -r /tmp/dup.pcap -n
reading from file /tmp/dup.pcap, link-type EN10MB (Ethernet), snapshot length 262144
17:28:30.031903 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [S], seq 271347250, win 32768, options [mss 1460,nop,wscale 3,sackOK,TS val 1 ecr 0], length 0
17:28:30.031907 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [S], seq 271347250, win 32768, options [mss 1460,nop,wscale 3,sackOK,TS val 1 ecr 0], length 0
17:28:30.036741 IP 10.0.0.2.1234 > 10.0.0.1.56598: Flags [S.], seq 3650133023, ack 271347251, win 32768, options [mss 1460,nop,wscale 3,sackOK,TS val 1 ecr 1], length 0
17:28:30.039381 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [.], ack 1, win 4197, options [nop,nop,TS val 1 ecr 1], length 0
17:28:30.039392 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [.], ack 1, win 4197, options [nop,nop,TS val 1 ecr 1], length 0
17:28:30.044156 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [P.], seq 1:10, ack 1, win 4197, options [nop,nop,TS val 1 ecr 1], length 9
17:28:30.044160 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [P.], seq 1:10, ack 1, win 4197, options [nop,nop,TS val 1 ecr 1], length 9
17:28:30.046127 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [F.], seq 10, ack 1, win 4197, options [nop,nop,TS val 1 ecr 1], length 0
17:28:30.046130 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [F.], seq 10, ack 1, win 4197, options [nop,nop,TS val 1 ecr 1], length 0
17:28:30.046975 IP 10.0.0.2.1234 > 10.0.0.1.56598: Flags [.], ack 11, win 4197, options [nop,nop,TS val 1 ecr 1], length 0
17:28:30.557906 IP 10.0.0.2.1234 > 10.0.0.1.56598: Flags [F.], seq 1, ack 11, win 4197, options [nop,nop,TS val 2 ecr 1], length 0
17:28:30.558200 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [.], ack 2, win 4197, options [nop,nop,TS val 2 ecr 2], length 0
17:28:30.558204 IP 10.0.0.1.56598 > 10.0.0.2.1234: Flags [.], ack 2, win 4197, options [nop,nop,TS val 2 ecr 2], length 0
```

...where most packages are duplicated. The PCAP is also available at
<https://www.netbsd.org/~leot/tmp/rump-20250405-dup.pcap>.


Any idea why they are duplicated and any idea how to possibly avoid
such duplication?


Thank you!


Home | Main Index | Thread Index | Old Index