Re: [PATCH bpf-next 1/3] bpf: Disallow freplace on XDP with mismatched xdp_has_frags values

Jakub Kicinski
2026-03-28T00:12:22Z

On Fri, 27 Mar 2026 14:42:19 +0800 Leon Hwang wrote:
> > It may be worth adding a selftest to
> > tools/testing/selftests/drivers/net/xdp.py
> > which sets MTU to 9k, tries to attach a non-frag-capable prog
> > if that fails attaches a frag-capable prog and then checks if
> > replacing the capable prog with non-capable fails.
> > Drivers may be buggy in this regard.
>
> Do you mean adding these two tests to xdp.py?
>
> 1. Verify the failure of attaching non-frag-capable prog to mtu=9k
> driver.
> 2. Verify the failure of updating frag-capable prog with non-frag-
> capable prog via libbpf.c::bpf_link__update_program().

Not directly via libbpf just ip -f link, it uses libbpf internally
but testing with ip link is simpler. Also - there are already XDP
progs which return XDP_PASS in frag-capable and non-capable mode,
so just use those.

> As for test #2, it may require a helper to attach prog then update prog
> using libbpf's APIs.

See above.