xdp-project / xdp-tools

Utilities and example programs for use with XDP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

xdpdump ERROR: The kernel does not support fentry function load

shiponcs opened this issue · comments

I am getting an error, ERROR: The kernel does not support fentry function load because it is too old, while trying use xdpdump on an interface. The program that was loaded on the interface is really simple:

#include <linux/bpf.h>
#include <linux/if_ether.h>
#include <linux/in.h>
#include <linux/ip.h>

#define SEC(NAME) __attribute__((section(NAME), used))

SEC("mysection")
int myprogram(struct xdp_md *ctx) {
  int ipsize = 0;
  void *data = (void *)(long)ctx->data;
  void *data_end = (void *)(long)ctx->data_end;
  struct ethhdr *eth = data;
  struct iphdr *ip;

  ipsize = sizeof(*eth);
  ip = data + ipsize;
  ipsize += sizeof(struct iphdr);
  if (data + ipsize > data_end) {
    return XDP_DROP;
  }

  if (ip->protocol == IPPROTO_UDP) {
    return XDP_DROP;
  }

  return XDP_PASS;
}

The program was built with clang:

$ clang -g -c -O2 -target bpf -c drop-packets.c -o drop-packets.o

and, loaded with xdp-loader:

$ xdp-loader load -m skb -s mysection eth0 drop-packets.o

And, when tried to use xdp dump:

$ sudo ./xdpdump -i eth0 -x --rx-capture entry,exit
ERROR: The kernel does not support fentry function load because it is too old!

System info

$ uname -r
5.4.0-173-generic
$ clang --version
Ubuntu clang version 12.0.0-3ubuntu1~20.04.5
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin