bool offload = strcmp(*argv, "xdpoffload") == 0;
NEXT_ARG();
- if (xdp_parse(&argc, &argv, req, generic, drv,
- offload))
+ if (xdp_parse(&argc, &argv, req, dev_index,
+ generic, drv, offload))
exit(-1);
} else if (strcmp(*argv, "netns") == 0) {
NEXT_ARG();
return 0;
}
-int xdp_parse(int *argc, char ***argv, struct iplink_req *req, bool generic,
- bool drv, bool offload)
+int xdp_parse(int *argc, char ***argv, struct iplink_req *req, __u32 ifindex,
+ bool generic, bool drv, bool offload)
{
struct bpf_cfg_in cfg = {
.type = BPF_PROG_TYPE_XDP,
.req = req,
};
+ if (offload) {
+ if (!ifindex)
+ incomplete_command();
+ cfg.ifindex = ifindex;
+ }
+
if (!force)
xdp.flags |= XDP_FLAGS_UPDATE_IF_NOEXIST;
if (generic)
#include "utils.h"
-int xdp_parse(int *argc, char ***argv, struct iplink_req *req, bool generic,
- bool drv, bool offload);
+int xdp_parse(int *argc, char ***argv, struct iplink_req *req, __u32 ifindex,
+ bool generic, bool drv, bool offload);
void xdp_dump(FILE *fp, struct rtattr *tb, bool link, bool details);
#endif /* __XDP__ */