Sample Header Ad - 728x90

Linux networking bridge not forwarding manually created packet

0 votes
0 answers
60 views
I am trying to implement packet forwarding using a BPF-program. The idea is to forward a suitable packet from veth1 (ingress) directly to veth2 (egress). The problem I am facing is that the redirected packets seem to be dropped by the bridge v-net-1. I have been analyzing the traffic with Wireshark and the packets leave from veth2 and enter at veth2-br just as intended but never reach veth3-br. Now there are a few things where I do not really understand why they are happening. The first would be that when I turn off my BPF-program and let the user-space-program build the packet the destination IP address of the packet is the one of the bridge (192.168.11.10), however the way I understood IP addresses was that they are end-to-end i.e. there should be the IP address of the client in the packet (192.168.11.1) and only the MAC addresses would change while routing the packet. The second one would be that a packet created by my BPF-program, which has the exact same MAC and IP entries, is not sent to veth3-br, while one created by the user-space-program is sent there. The UDP-port is the only thing that differed between my tries but as far as I understand it that cannot be the reason for a drop since the bridge is not considering l4 protocols. The setup looks like this:
_______________________________________              ______________________
  |            Relay namespace            |            |   Client namespace   |
  |    ______________   ______________    |            |     ____________     |
  |   | 192.168.10.2 | | 192.168.11.2 |   |            |    |192.168.11.1|    |
  |___|____veth1_____|_|____veth2_____|___|            |____|____veth3___|____|
 	                          \                                   /
				               \                                 /
				                \                               /
				         	     \                             /
				        	    __\ _________________________ /
				          	   /veth2-br|            |veth3-br\
					           |                              |
				        	   \__________v-net-1_____________/
				        	                 /
				        	       ip: 192.168.11.10
					               net: 192.168.11.0/24
the link info of the relay namespace is:
9: veth1@if8:  mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether a2:85:a2:09:2a:77 brd ff:ff:ff:ff:ff:ff link-netnsid 0
14: veth2@if13:  mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether ce:b8:3f:d5:f3:17 brd ff:ff:ff:ff:ff:ff link-netnsid 0
the link info of the global namespace is:
10: v-net-1:  mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether d6:06:cb:05:65:62 brd ff:ff:ff:ff:ff:ff
11: veth3-br@if12:  mtu 1500 qdisc noqueue master v-net-1 state UP mode DEFAULT group default qlen 1000
    link/ether a6:bc:ae:a2:75:8f brd ff:ff:ff:ff:ff:ff link-netns client_ns
13: veth2-br@if14:  mtu 1500 qdisc noqueue master v-net-1 state UP mode DEFAULT group default qlen 1000
    link/ether 0a:85:99:6c:80:1f brd ff:ff:ff:ff:ff:ff link-netns relay_ns
the link info of the client namespace is:
12: veth3@if11:  mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether f2:51:1c:4c:2b:0b brd ff:ff:ff:ff:ff:ff link-netnsid 0
and the bridge forwarding database looks like that:
33:33:00:00:00:01 self permanent
01:00:5e:00:00:6a self permanent
33:33:00:00:00:6a self permanent
01:00:5e:00:00:01 self permanent
33:33:ff:05:65:62 self permanent
01:00:5e:00:00:fb self permanent
33:33:00:00:00:fb self permanent
d6:06:cb:05:65:62 vlan 1 master v-net-1 permanent
d6:06:cb:05:65:62 master v-net-1 permanent
Asked by Dan23 (9 rep)
Mar 28, 2024, 10:54 AM
Last activity: Mar 28, 2024, 10:56 AM