Dellwyn Tennison
Dellwyn Tennison

Reputation: 1

Unable to attach eBPF program to eth0 interface on ubuntu

I am trying to attach an XDP program that prints hello world on receiving a ICMP message onto the eth0 interface on an EC2 ubuntu VM. I am getting the following error : Error: interface xdp attach failed: Invalid argument.

However I am able to attach the program to the lo loopback interface. This is the command I am using: sudo bpftool net -d attach xdp name $1 dev $2 overwrite

Upvotes: 0

Views: 838

Answers (1)

Anubhav Gupta
Anubhav Gupta

Reputation: 1

As said by @dellwyn-tennison this is due to the MTU size. XDP programs can only be attached to interfaces with maximum MTU of 3840.

To find the current MTU of your interfaces:

$ ifconfig | grep mtu

Change the MTU size of your interface:

$ ifconfig <Interface_name> mtu <mtu_size> up

Upvotes: 0

Related Questions