Ilya Goslhtein <ilejn@xxxxxxxxx> writes: > Hello, > > I am trying to use a network interface to > (1) send packets via AF_XDP > (2) receive packets and redirect to another interface via xdp_redirect_map > > Basically, I am making xdpbridge https://github.com/ilejn/xdpbridge. > bidirectional. My goal is to process packets in one direction in > kernelspace (xdp_redirect_map) and to pass packets in opposite direction > via userspace (recieve via AF_XDP then send via AF_XDP, rings are not > shared, so I perform memcpy). > > For test purposes I ran two applications: my xdpbridge and > xdp_redirect_map bpf sample. > > It does not work. Only few packets are received, then the thing stops. > Redirecting works until xdpbridge does 'bind' against the interface. This is because the AF_XDP application loads another XDP program on the interface that redirects the traffic into the socket. It is possible to write an XDP program that can do both (i.e., for each packet, decide whether to redirect it into the AF_XDP socket, or to another interface), but obviously none of the example programs know how to do this, so they end up stepping on each other's toes... -Toke