Re: XDP - Bridge - not redirecting all UDP

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

 



I did some more investigation.

First, my setup:  Raspberry Pi (ARM7) running 64-bit SuSE
(4.12.14-lp151.28.25-default)
As mentioned before I have it setup as a bridge.  eth0 is using the
lan78xx driver and eth1 is using ax88179_178a driver.

I tried to simplify things, so use xdp-tutorial/basic01-xdp-pass and
changed xdp_prog_simple() to print the destination IP address:
int  xdp_prog_simple(struct xdp_md *ctx)
{
    void *data_end = (void*)(long) ctx->data_end;
    void *data = (void*)(long) ctx->data;
    struct ethhdr *eth = (struct ethhdr*) data;

    if (eth + 1 > data_end) {
        return XDP_PASS;
    }

    if (eth->h_proto != bpf_htons(ETH_P_IP))
        return XDP_PASS;

    struct iphdr *iph = data + sizeof(struct ethhdr);
    if (iph + 1 > data_end)
        return XDP_PASS;

    if (iph->protocol != IPPROTO_UDP)
        return XDP_PASS;

    bpf_printk("udp: dst port: %x proto=%d\n", bpf_ntohl(iph->daddr),
iph->protocol);

    return XDP_PASS;
}

Then wrote a small test tool to be able to send udp packets.  I have
it set to send 20 udp packets.
When I look at trace_pipe for the above print statement, I will see
less than 20 lines.

So, for some reason, I am not getting all the packets.  Any thoughts?
I am not sure where to go from here.

On Thu, Nov 21, 2019 at 3:42 PM Joubert Berger
<joubert@xxxxxxxxxxxxxxxxx> wrote:
>
> I have been playing around with Ilya's xdpbridge sample.  In my case, what I am interested in is pushing all UDP traffic to userspace.  All other traffic can flow through my box.  So, I setup something like this:
>
> eth0 --> br0 --> eth1
>
> I then capture all packets on eth0/eth1 and return XDP_PASS for all but  UDP packets.  These I redirect it to the user space application. There I set the UDP checksum to zero, that way I know it hit my code and then send it to "other" interface.
>
> The problem is that not *all* my UDP traffic has the checksum set to zero.  Anyone have any ideas why that might be the case?  Why is only some of the UDP traffic being pushed to user space?
>
> --joubert
>



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux