@@ -6366,6 +6366,8 @@ static const struct bpf_sec_def section_defs[] = {
.is_attach_btf = true,
.expected_attach_type = BPF_LSM_MAC,
.attach_fn = attach_lsm),
+ 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),
@@ -454,6 +454,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;
}
@@ -329,6 +333,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;
}