@@ -73,7 +73,8 @@ static void usage(const char *prog)
"OPTS:\n"
" -S use skb-mode\n"
" -N enforce native mode\n"
- " -F force loading prog\n",
+ " -F force loading prog\n"
+ " -E egress path program\n",
prog);
}
@@ -85,7 +86,7 @@ int main(int argc, char **argv)
};
struct bpf_prog_info info = {};
__u32 info_len = sizeof(info);
- const char *optstr = "FSN";
+ const char *optstr = "FSNE";
int prog_fd, map_fd, opt;
struct bpf_object *obj;
struct bpf_map *map;
@@ -103,13 +104,17 @@ int main(int argc, char **argv)
case 'F':
xdp_flags &= ~XDP_FLAGS_UPDATE_IF_NOEXIST;
break;
+ case 'E':
+ xdp_flags |= XDP_FLAGS_EGRESS_MODE;
+ prog_load_attr.expected_attach_type = BPF_XDP_EGRESS;
+ break;
default:
usage(basename(argv[0]));
return 1;
}
}
- if (!(xdp_flags & XDP_FLAGS_SKB_MODE))
+ if (!(xdp_flags & (XDP_FLAGS_SKB_MODE | XDP_FLAGS_EGRESS_MODE)))
xdp_flags |= XDP_FLAGS_DRV_MODE;
if (optind == argc) {