When detaching a generic XDP program to an interface without native XDP
support, remove_xdp() showed the following message:
bpf: nlmsg error Operation not supported
Add the flags parameter to notify the kernel that it's a generic XDP
program.
break;
if mode == BPF.XDP:
- b.remove_xdp(device)
+ b.remove_xdp(device, flags)
else:
ip.tc("del", "clsact", idx)
ipdb.release()
% (dev, errstr))
@staticmethod
- def remove_xdp(dev):
+ def remove_xdp(dev, flags=0):
'''
This function removes any BPF function from a device on the
device driver level (XDP)
'''
- res = lib.bpf_attach_xdp(dev.encode("ascii"), -1, 0)
+ res = lib.bpf_attach_xdp(dev.encode("ascii"), -1, flags)
if res < 0:
errstr = os.strerror(ct.get_errno())
raise Exception("Failed to detach BPF from device %s: %s"