Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UDP Server Bound to a TAP interface fails to receive data #1

Open
bob2oneil opened this issue Jul 24, 2021 · 10 comments
Open

UDP Server Bound to a TAP interface fails to receive data #1

bob2oneil opened this issue Jul 24, 2021 · 10 comments

Comments

@bob2oneil
Copy link

I need to have Iperf2 handle a simple IPv4 data stream on a single Linux workstation, where various TAP interfaces are present to represent virtual Ethernet interfaces. I have routing setup such that on the tx side, Iperf2 works well and targets in my case, the zeth0 TAP interface. The following command is used to transmit the data:

iperf -c 192.0.1.1 -u -i1 -b5M -l188 -p49169 -t5

I am unable to get Iperf2 on the listen side to see any of the data, which is written by an application to a virtual TAP interface as zeth1.

I have changed the source code such that when the following arguments are used, it attempts to bind the listen socket to the zeth1 interface. The address I will be using is not a real multicast.

-s -u -B0.0.0.0%zeth1 -p49169

I have tried both the ANY IP address, as well as a targeted one as 138.0.0.254, which is assigned to the outgoing TAP interface.

Wireshark traces on zeth1 show the presence of the data, with the destination port matching the assignment as 49169, a destination IP as 138.0.0.254, and a broadcast destination MAC address.

Within config.h, I have HAVE_THREAD_DEBUG defined so that the output provides additional information. A running log of the program is as follows.

I have breakpoints set for the various recvfrom() calls that never get triggered.

The custom code added result in the following text in the output:

Listen socket 3 successfully bound to interface 'zeth1'
Listen socket 3 bound to port 49169
Listen socket 3 bound to address 138.0.0.254

Are there any recommendations on what is happening and how to bind the listener to a particular virtual device? I would prefer to bind to both a destination device as well as a destination or source IP if possible.

00:35:49: Starting /home/robocom/Downloads/iperf-2.1.1-dev/src/iperf -s -u -B138.0.0.254%zeth1 -p49169 ...
THREAD(24633):[00:35:49.100752] Copy thread settings (malloc) from/to=0x55bf91f05eb0/0x55bf91f06400 report/sum/fullduplex (nil)/(nil)/(nil)
THREAD(24633):[00:35:49.100852] Thread_run_wrapper(0x55bf91f06400 mode=3) thread counts tot/trfc=1/0
THREAD(24634):[00:35:49.100872] Reporter thread started
THREAD(24635):[00:35:49.100919] Listener main loop port 49169 
THREAD(24634):[00:35:49.100942] Alloc common=0x7fefe4000d50
THREAD(24633):[00:35:49.100957] Thread_run_wrapper(0x55bf91f05eb0 mode=7) thread counts tot/trfc=2/0
THREAD(24634):[00:35:49.100977] Reporter await done
THREAD(24635):[00:35:49.100990] Alloc common=0x7fefdc0014f0
THREAD(24635):[00:35:49.101002] Init settings report 0x7fefdc001280
THREAD(24635):[00:35:49.101007] Jobq *POST* report 0x7fefdc001280 (settings)
THREAD(24634):[00:35:49.101016] Jobq *WAIT* exit  (nil)/0x7fefdc001280 cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:49.101031] Jobq *ROOT* 0x7fefdc001280 (last=(nil))
------------------------------------------------------------
Server listening on UDP port 49169
THREAD(24635):[00:35:49.101045] Copy thread settings (malloc) from/to=0x55bf91f05eb0/0x7fefdc001780 report/sum/fullduplex (nil)/(nil)/(nil)
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
THREAD(24635):[00:35:49.101057] Listener thread listening for UDP (sock=3)
THREAD(24634):[00:35:49.101066] Jobq *FREE* report 0x7fefdc001280 (settings)
THREAD(24634):[00:35:49.101074] Free common=0x7fefdc0014f0
THREAD(24634):[00:35:49.101080] Jobq *REMOVE* 0x7fefdc001280
Listen socket 3 successfully bound to interface 'zeth1'
Listen socket 3 bound to port 49169
Listen socket 3 bound to address 138.0.0.254
THREAD(24634):[00:35:50.101147] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:51.101236] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:52.101323] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:53.101412] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:54.101500] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:55.101595] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:56.101684] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:57.101774] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:58.101862] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:35:59.101948] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:36:00.102037] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:36:01.102121] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0
THREAD(24634):[00:36:02.102217] Jobq *WAIT* exit  (nil)/(nil) cond=0x55bf9187b9c0 threads=0


Routing table and ifconfig dumps are as follows:

zeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1600
        inet 192.0.1.2  netmask 255.255.255.0  broadcast 192.0.1.255
        inet6 fe80::200:5eff:fe00:53ff  prefixlen 64  scopeid 0x20<link>
        ether 00:00:5e:00:53:ff  txqueuelen 1000  (Ethernet)
        RX packets 9  bytes 378 (378.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 174617  bytes 40153500 (40.1 MB)
        TX errors 0  dropped 2 overruns 0  carrier 0  collisions 0

zeth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
        inet 138.0.0.254  netmask 255.255.255.0  broadcast 138.0.0.255
        inet6 fe80::200:5eff:fe00:52ff  prefixlen 64  scopeid 0x20<link>
        ether 00:00:5e:00:52:ff  txqueuelen 1000  (Ethernet)
        RX packets 174530  bytes 40141900 (40.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 78  bytes 11222 (11.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         home            0.0.0.0         UG    600    0        0 wlp3s0
138.0.0.0       0.0.0.0         255.255.255.0   U     0      0        0 zeth1
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 wlp3s0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.0.1.0       0.0.0.0         255.255.255.0   U     0      0        0 zeth0
192.168.200.0   0.0.0.0         255.255.255.0   U     600    0        0 wlp3s0
200.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 zeth0


@rjmcmahon
Copy link
Contributor

Please use -e on the command line. This provide more information.

Also use ./configure --enable-thread-debug to configure.h though direct edits will work.

I've fixed the -B bind to device in 2.1.4-rc dated July 24 so you should use that. It seems to work with a 0.0.0.0 address as well a specified one. Then append % for the bind to device.

Not sure how to test the tap interfaces. Can you explain further the setup?

@bob2oneil
Copy link
Author

bob2oneil commented Jul 24, 2021

Thanks, I will test it out. The TAP device is created using the net-setup script that I attached to the discussion on the SourceForge project. It creates 2 TAP interfaces as zeth0 and zeth1 with routing. My application is a radio simulator and bridges packets received from the wired interface as zeth0 to zeth1. So I have iperf client driving the wired side, and want Iperf server on the wireless side. This binding was not working.

If it works for me, I think you can say that Iperf2 will work in a network emulation (as opposed to simulation) environment, with multiple instances of an application running, with presumably multiple TAP interfaces created to represent virtual Ethernet interfaces.

That is sort of a big win for Iperf - to support that type of environment.

I can send you my binary application which runs under Ubuntu and CentOS 64-bit to test out along with the script if this does not work for me. It is a bridge application at the moment, packets received over zeth0 get transmitted out of zeth1, but with the IP header content different such as the IPs and MACs to match the convention of the zeth1 network.

I will be back in touch once I get a chance to test things out, probably Sunday sometime.

@bob2oneil
Copy link
Author

A Tap interface is a virtual Layer 2 Ethernet interface created as an entry point for a network stack. In this case, it is created on the LInux host device via the attached script Here you run "net-setup.sh start", then use ifconfig to verify the existence of the virtual Ethernet interfaces zeth0 and zeth1, as well as look at the routing established to the 2 interfaces.

A TAP interface is a layer 2 interface that includes a MAC address, and behaves similar to a real Ethernet interface such as eth0 and eth1. A closely related cousin is a TUN interface, which does not include Layer 2 routing.

https://www.kernel.org/doc/Documentation/networking/tuntap.txt

@rjmcmahon
Copy link
Contributor

rjmcmahon commented Jul 25, 2021

I can run the net-setup.sh start script. What iperf commands are you using to test this?

How are these packets actually routed?

[root@ryzen3950 Downloads]# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.5254006e61c1 yes virbr0-nic

[root@ryzen3950 Downloads]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 100 0 0 enp4s0
default _gateway 0.0.0.0 UG 101 0 0 enp7s0
138.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 zeth1
192.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 zeth0
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 enp4s0
192.168.1.0 0.0.0.0 255.255.255.0 U 101 0 0 enp7s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0

[root@ryzen3950 Downloads]# ip route show
default via 192.168.1.1 dev enp4s0 proto dhcp metric 100
default via 192.168.1.1 dev enp7s0 proto dhcp metric 101
138.0.0.0/24 dev zeth1 proto kernel scope link src 138.0.0.254 linkdown
192.0.1.0/24 dev zeth0 proto kernel scope link src 192.0.1.2 linkdown
192.168.1.0/24 dev enp4s0 proto kernel scope link src 192.168.1.133 metric 100
192.168.1.0/24 dev enp7s0 proto kernel scope link src 192.168.1.90 metric 101
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

@bob2oneil
Copy link
Author

bob2oneil commented Jul 25, 2021

Thanks for the response Robert. I added "ifconfig zeth0 up" and "ifconfig zeth1 up" to the setup scripts. Attached is the revision.

I am also attaching the radio simulator application, zephyr.exe, which is a Linux binary that should run in a terminal.

Iperf Commands:

Transmitter: iperf -c 192.0.1.1 -u -i1 -b5M -l188 -p49169 -t5

Receiver: iperf -e -s -u -B0.0.0.0%zeth1 -p49169

The virtual TAP interfaces zeth0 and zeth1 are the virtual Ethernet interfaces of interest.

The interface zeth1 shows as RX packets the count of packets received by the interface.

zeth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1600
        inet 192.0.1.2  netmask 255.255.255.0  broadcast 192.0.1.255
        inet6 fe80::200:5eff:fe00:53ff  prefixlen 64  scopeid 0x20<link>
        ether 00:00:5e:00:53:ff  txqueuelen 1000  (Ethernet)
        RX packets 4  bytes 168 (168.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 69884  bytes 16064956 (16.0 MB)
        TX errors 0  dropped 2 overruns 0  carrier 0  collisions 0

zeth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9000
        inet 138.0.0.254  netmask 255.255.255.0  broadcast 138.0.0.255
        inet6 fe80::200:5eff:fe00:52ff  prefixlen 64  scopeid 0x20<link>
        ether 00:00:5e:00:52:ff  txqueuelen 1000  (Ethernet)
        RX packets 69813  bytes 16056802 (16.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 70  bytes 8240 (8.2 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


robocom@scnuc-1:~/Downloads/iperf-2.1.4-rc/src$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         home            0.0.0.0         UG    600    0        0 wlp3s0
138.0.0.0       0.0.0.0         255.255.255.0   U     0      0        0 zeth1
link-local      0.0.0.0         255.255.0.0     U     1000   0        0 wlp3s0
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0
192.0.1.0       0.0.0.0         255.255.255.0   U     0      0        0 zeth0
192.168.200.0   0.0.0.0         255.255.255.0   U     600    0        0 wlp3s0

robocom@scnuc-1:~/Downloads/iperf-2.1.4-rc/src$ ip route show
default via 192.168.200.1 dev wlp3s0 proto dhcp metric 600 
138.0.0.0/24 dev zeth1 proto kernel scope link src 138.0.0.254 
169.254.0.0/16 dev wlp3s0 scope link metric 1000 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.0.1.0/24 dev zeth0 proto kernel scope link src 192.0.1.2 
192.168.200.0/24 dev wlp3s0 proto kernel scope link src 192.168.200.126 metric 600 


IPerf receiver output


./iperf -e -s -u -B0.0.0.0%zeth1 -p49169
THREAD(5268):[09:49:50.058730] Copy thread settings (malloc) from/to=0x557792803eb0/0x557792804410 report/sum/fullduplex (nil)/(nil)/(nil)
THREAD(5268):[09:49:50.058813] Thread_run_wrapper(0x557792804410 mode=3) thread counts tot/trfc=1/0 (id=1883780864)
THREAD(5269):[09:49:50.058832] Reporter thread started
THREAD(5269):[09:49:50.058873] Alloc common rpt/com/size/strsz 0x7f8f68000ba0/0x7f8f68000d40/496/15
THREAD(5268):[09:49:50.058894] Thread_run_wrapper(0x557792803eb0 mode=7) thread counts tot/trfc=2/0 (id=1875388160)
THREAD(5270):[09:49:50.058918] Listener main loop port 49169 
THREAD(5269):[09:49:50.058940] Reporter await done
THREAD(5270):[09:49:50.058960] Alloc common rpt/com/size/strsz 0x7f8f600012a0/0x7f8f60001440/496/15
THREAD(5270):[09:49:50.058973] Init settings report hdr/rpt/com 0x7f8f60001280/0x7f8f600012a0/0x7f8f60001440
THREAD(5270):[09:49:50.058984] Jobq *POST* report 0x7f8f60001280 (settings)
THREAD(5269):[09:49:50.058999] Jobq *WAIT* exit  (nil)/0x7f8f60001280 cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:50.059013] Jobq *ROOT* 0x7f8f60001280 (last=(nil))
------------------------------------------------------------
THREAD(5270):[09:49:50.059028] Copy thread settings (malloc) from/to=0x557792803eb0/0x7f8f60001700 report/sum/fullduplex (nil)/(nil)/(nil)
Server listening on UDP port 49169 with pid 5268
THREAD(5270):[09:49:50.059043] Listener thread listening for UDP (sock=3)
Binding to local address 0.0.0.0 and iface zeth1
Read buffer size: 1.44 KByte (Dist bin width= 183 Byte)
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
THREAD(5269):[09:49:50.059078] Jobq *FREE* report hdr/rpt 0x7f8f60001280/0x7f8f600012a0 (settings)
THREAD(5269):[09:49:50.059087] Free common=0x7f8f60001440
THREAD(5269):[09:49:50.059093] Jobq *REMOVE* 0x7f8f60001280
THREAD(5269):[09:49:51.059158] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:52.059244] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:53.059334] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:54.059425] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:55.059511] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:56.059606] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:57.059695] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:58.059784] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:49:59.059876] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:00.059967] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:01.060060] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:02.060150] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:03.060251] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:04.060352] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:05.060442] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:06.060531] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0
THREAD(5269):[09:50:07.060619] Jobq *WAIT* exit  (nil)/(nil) cond=0x557790ee79c0 threads u/t=2/0

iperf.test.artifacts.7.25.21.zip

@bob2oneil
Copy link
Author

bob2oneil commented Jul 25, 2021

Good reference on TUN/TAP interfaces.

Here I am assuming that a UDP socket can be opened for read and write on the existing TAP interface. I have done so with a raw socket in previous work, so I assume a standard UDP socket will work as well.

https://backreference.org/2010/03/26/tuntap-interface-tutorial/

The attached application shows a UDP socket on a TUN/TAP interfaces, so it seems like it should work.

tunproxy.zip

@rjmcmahon
Copy link
Contributor

rjmcmahon commented Jul 25, 2021

Can you show the packets going out? You don't need the routing table if you specify the output interface. I don't see any packets being sent. Also, the linkdown state is still set.

[root@ryzen3950 rjmcmahon]# tcpdump -i zeth0
dropped privs to tcpdump
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on zeth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
^C
0 packets captured
0 packets received by filter
0 packets dropped by kernel

iperf -c 138.0.0.254%zeth0 -u -i1 -b5M -l188 -p49169 -t5 -e -B 192.0.1.2


Client connecting to 138.0.0.254, UDP port 49169 with pid 26515 via zeth0 (1 flows)
Sending 188 byte datagrams, IPG target: 286.87 us (kalman adjust)
UDP buffer size: 208 KByte (default)

[ 1] local 192.0.1.2%zeth0 port 50084 connected with 138.0.0.254 port 49169 (sock=3) on 2021-07-25 10:54:56 (PDT)
[ ID] Interval Transfer Bandwidth Write/Err PPS
[ 1] 0.00-1.00 sec 640 KBytes 5.24 Mbits/sec 3487/0 3488 pps
[ 1] 1.00-2.00 sec 640 KBytes 5.24 Mbits/sec 3486/0 3486 pps
[ 1] 2.00-3.00 sec 640 KBytes 5.24 Mbits/sec 3486/0 3486 pps
[ 1] 3.00-4.00 sec 640 KBytes 5.24 Mbits/sec 3486/0 3486 pps
[ 1] 4.00-5.00 sec 640 KBytes 5.24 Mbits/sec 3486/0 3486 pps
[ 1] 0.00-5.00 sec 3.13 MBytes 5.24 Mbits/sec 17434/0 3487 pps
[ 1] Sent 17434 datagrams
[ 3] WARNING: did not receive ack of last datagram after 10 tries.

[root@ryzen3950 Downloads]#
zeth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1600
inet 192.0.1.2 netmask 255.255.255.0 broadcast 192.0.1.255
ether 00:00:5e:00:53:ff txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

zeth1: flags=4099<UP,BROADCAST,MULTICAST> mtu 9000
inet 138.0.0.254 netmask 255.255.255.0 broadcast 138.0.0.255
ether 12:7b:a5:e0:7f:bd txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@ryzen3950 Downloads]# ip route show
default via 192.168.1.1 dev enp4s0 proto dhcp metric 100
default via 192.168.1.1 dev enp7s0 proto dhcp metric 101
138.0.0.0/24 dev zeth1 proto kernel scope link src 138.0.0.254 linkdown
192.0.1.0/24 dev zeth0 proto kernel scope link src 192.0.1.2 linkdown
192.168.1.0/24 dev enp4s0 proto kernel scope link src 192.168.1.133 metric 100
192.168.1.0/24 dev enp7s0 proto kernel scope link src 192.168.1.90 metric 101
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

@bob2oneil
Copy link
Author

bob2oneil commented Jul 26, 2021

The client is on 192.0.1.1, which is zeth0, whereas the output, or the UDP server is on 138.0.0.254 on interface zeth1. The revised scripts I attached should set those interfaces up. If not, you can do so manually via "ifconfig zeth0 up" and "ifconfig zeth1 up". I can view the output on the 138.0.0.0/24 network in two ways. One is the wireshark capture attached which shows the packets appearing on the zeth1 interface. Secondly, "ifconfig" shows rx packets on zeth1 when I drive data via Iperf client into 192.0.1.1. So I am confident the packets are hitting the TAP interface.

To get the packets to bridge from zeth0 to zeth1, you have to run the zephyr.exe application after running the setup scripts to verify the TAP interfaces are correct.

This application acts like a simulated radio, where Iperf data driven into zeth0 will be transmitted out zeth1 with a different IP header.

The zephyr.exe application will only pass UDP traffic through the interfaces.

NOTE: the link status will only show up as UP after the zephyr.exe application is run to create a listener for the two interfaces.

robocom@scnuc-1:~/RCSUS/bridge$ ip route show
default via 192.168.200.1 dev wlp3s0 proto dhcp metric 600 
138.0.0.0/24 dev zeth1 proto kernel scope link src 138.0.0.254 
169.254.0.0/16 dev wlp3s0 scope link metric 1000 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown 
192.0.1.0/24 dev zeth0 proto kernel scope link src 192.0.1.2 
192.168.200.0/24 dev wlp3s0 proto kernel scope link src 192.168.200.126 metric 600 
200.168.1.0/24 dev zeth0 scope link 

@bob2oneil
Copy link
Author

A pure UDP socket does not seem to work, I am going to test with a raw socket. If you can give me some idea in the code where the read routine is for the listen socket, I will convert the UDP socket into a raw socket, and then remove the IP header and presumably pass on the UDP payload to the same processing routine. If there is any general architecture documentation, that would be appreciated.

@bob2oneil
Copy link
Author

A raw socket running as root works to read and write from the TAP interface. A parallel discussion is occurring on SourceForge on this topic in terms of how to integrate this functionality in Iperf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants