@@ -6635,6 +6635,8 @@ static const struct bpf_sec_def section_defs[] = {
.expected_attach_type = BPF_TRACE_ITER,
.is_attach_btf = true,
.attach_fn = attach_iter),
+ BPF_EAPROG_SEC("xdp_egress", BPF_PROG_TYPE_XDP,
+ BPF_XDP_EGRESS),
BPF_PROG_SEC("xdp", BPF_PROG_TYPE_XDP),
BPF_PROG_SEC("perf_event", BPF_PROG_TYPE_PERF_EVENT),
BPF_PROG_SEC("lwt_in", BPF_PROG_TYPE_LWT_IN),
@@ -463,6 +463,7 @@ struct xdp_link_info {
__u32 hw_prog_id;
__u32 skb_prog_id;
__u8 attach_mode;
+ __u32 egress_prog_id;
};
struct bpf_xdp_set_link_opts {
@@ -280,6 +280,10 @@ static int get_xdp_info(void *cookie, void *msg, struct nlattr **tb)
xdp_id->info.hw_prog_id = libbpf_nla_getattr_u32(
xdp_tb[IFLA_XDP_HW_PROG_ID]);
+ if (xdp_tb[IFLA_XDP_EGRESS_PROG_ID])
+ xdp_id->info.egress_prog_id = libbpf_nla_getattr_u32(
+ xdp_tb[IFLA_XDP_EGRESS_PROG_ID]);
+
return 0;
}
@@ -331,6 +335,8 @@ static __u32 get_xdp_id(struct xdp_link_info *info, __u32 flags)
return info->hw_prog_id;
if (flags & XDP_FLAGS_SKB_MODE)
return info->skb_prog_id;
+ if (flags & XDP_FLAGS_EGRESS_MODE)
+ return info->egress_prog_id;
return 0;
}