Merge branch 'master' into net-next
This commit is contained in:
commit
6ef590ed88
|
|
@ -79,17 +79,20 @@ int xdp_parse(int *argc, char ***argv, struct iplink_req *req, bool generic)
|
||||||
void xdp_dump(FILE *fp, struct rtattr *xdp)
|
void xdp_dump(FILE *fp, struct rtattr *xdp)
|
||||||
{
|
{
|
||||||
struct rtattr *tb[IFLA_XDP_MAX + 1];
|
struct rtattr *tb[IFLA_XDP_MAX + 1];
|
||||||
__u32 flags = 0;
|
__u8 mode;
|
||||||
|
|
||||||
parse_rtattr_nested(tb, IFLA_XDP_MAX, xdp);
|
parse_rtattr_nested(tb, IFLA_XDP_MAX, xdp);
|
||||||
|
|
||||||
if (!tb[IFLA_XDP_ATTACHED] ||
|
if (!tb[IFLA_XDP_ATTACHED])
|
||||||
!rta_getattr_u8(tb[IFLA_XDP_ATTACHED]))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tb[IFLA_XDP_FLAGS])
|
mode = rta_getattr_u8(tb[IFLA_XDP_ATTACHED]);
|
||||||
flags = rta_getattr_u32(tb[IFLA_XDP_FLAGS]);
|
if (mode == XDP_ATTACHED_NONE)
|
||||||
|
return;
|
||||||
fprintf(fp, "xdp%s ",
|
else if (mode == XDP_ATTACHED_DRV)
|
||||||
flags & XDP_FLAGS_SKB_MODE ? "generic" : "");
|
fprintf(fp, "xdp ");
|
||||||
|
else if (mode == XDP_ATTACHED_SKB)
|
||||||
|
fprintf(fp, "xdpgeneric ");
|
||||||
|
else
|
||||||
|
fprintf(fp, "xdp[%u] ", mode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
lib/bpf.c
12
lib/bpf.c
|
|
@ -648,6 +648,16 @@ static int bpf_obj_get(const char *pathname, enum bpf_prog_type type)
|
||||||
return bpf(BPF_OBJ_GET, &attr, sizeof(attr));
|
return bpf(BPF_OBJ_GET, &attr, sizeof(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int bpf_obj_pinned(const char *pathname, enum bpf_prog_type type)
|
||||||
|
{
|
||||||
|
int prog_fd = bpf_obj_get(pathname, type);
|
||||||
|
|
||||||
|
if (prog_fd < 0)
|
||||||
|
fprintf(stderr, "Couldn\'t retrieve pinned program \'%s\': %s\n",
|
||||||
|
pathname, strerror(errno));
|
||||||
|
return prog_fd;
|
||||||
|
}
|
||||||
|
|
||||||
enum bpf_mode {
|
enum bpf_mode {
|
||||||
CBPF_BYTECODE,
|
CBPF_BYTECODE,
|
||||||
CBPF_FILE,
|
CBPF_FILE,
|
||||||
|
|
@ -750,7 +760,7 @@ static int bpf_parse(enum bpf_prog_type *type, enum bpf_mode *mode,
|
||||||
else if (*mode == EBPF_OBJECT)
|
else if (*mode == EBPF_OBJECT)
|
||||||
ret = bpf_obj_open(file, *type, section, verbose);
|
ret = bpf_obj_open(file, *type, section, verbose);
|
||||||
else if (*mode == EBPF_PINNED)
|
else if (*mode == EBPF_PINNED)
|
||||||
ret = bpf_obj_get(file, *type);
|
ret = bpf_obj_pinned(file, *type);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue