1 // SPDX-License-Identifier: GPL-2.0
3 #include "bpf_tracing_net.h"
4 #include <bpf/bpf_helpers.h>
6 struct bpf_xfrm_info___local {
9 } __attribute__((preserve_access_index));
14 int bpf_skb_set_xfrm_info(struct __sk_buff *skb_ctx,
15 const struct bpf_xfrm_info___local *from) __ksym;
16 int bpf_skb_get_xfrm_info(struct __sk_buff *skb_ctx,
17 struct bpf_xfrm_info___local *to) __ksym;
20 int set_xfrm_info(struct __sk_buff *skb)
22 struct bpf_xfrm_info___local info = { .if_id = req_if_id };
24 return bpf_skb_set_xfrm_info(skb, &info) ? TC_ACT_SHOT : TC_ACT_UNSPEC;
28 int get_xfrm_info(struct __sk_buff *skb)
30 struct bpf_xfrm_info___local info = {};
32 if (bpf_skb_get_xfrm_info(skb, &info) < 0)
35 resp_if_id = info.if_id;
40 char _license[] SEC("license") = "GPL";