On Thu, 13 Aug 2020 21:58:16 +0200 Jason A. Donenfeld wrote:
> - cls_bpf does not support the same feature set as XDP, and operates at
> a slightly different stage in the networking stack.
Please elaborate.
> I had originally dropped this patch, but the issue kept coming up in
> user reports, so here's a v4 of it. Testing of it is still rather slim,
> but hopefully that will change in the coming days.
Here an alternative patch, untested:
diff --git a/net/core/dev.c b/net/core/dev.c
index d3d53dc601f9..7f68831bdd4f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5434,6 +5434,11 @@ static int generic_xdp_install(struct net_device *dev,
struct netdev_bpf *xdp)
struct bpf_prog *new = xdp->prog;
int ret = 0;
+ if (!dev->hard_header_len) {
+ NL_SET_ERR_MSG(xdp->extack, "generic XDP not supported on L3
devices, please use cls_bpf");
+ return -EINVAL;
+ }
+
if (new) {
u32 i;