|
@@ -2598,7 +2598,7 @@ static const struct bpf_func_proto bpf_xdp_event_output_proto = {
|
|
|
};
|
|
|
|
|
|
static const struct bpf_func_proto *
|
|
|
-sk_filter_func_proto(enum bpf_func_id func_id)
|
|
|
+bpf_base_func_proto(enum bpf_func_id func_id)
|
|
|
{
|
|
|
switch (func_id) {
|
|
|
case BPF_FUNC_map_lookup_elem:
|
|
@@ -2625,6 +2625,17 @@ sk_filter_func_proto(enum bpf_func_id func_id)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static const struct bpf_func_proto *
|
|
|
+sk_filter_func_proto(enum bpf_func_id func_id)
|
|
|
+{
|
|
|
+ switch (func_id) {
|
|
|
+ case BPF_FUNC_skb_load_bytes:
|
|
|
+ return &bpf_skb_load_bytes_proto;
|
|
|
+ default:
|
|
|
+ return bpf_base_func_proto(func_id);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static const struct bpf_func_proto *
|
|
|
tc_cls_act_func_proto(enum bpf_func_id func_id)
|
|
|
{
|
|
@@ -2680,7 +2691,7 @@ tc_cls_act_func_proto(enum bpf_func_id func_id)
|
|
|
case BPF_FUNC_skb_under_cgroup:
|
|
|
return &bpf_skb_under_cgroup_proto;
|
|
|
default:
|
|
|
- return sk_filter_func_proto(func_id);
|
|
|
+ return bpf_base_func_proto(func_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2695,7 +2706,7 @@ xdp_func_proto(enum bpf_func_id func_id)
|
|
|
case BPF_FUNC_xdp_adjust_head:
|
|
|
return &bpf_xdp_adjust_head_proto;
|
|
|
default:
|
|
|
- return sk_filter_func_proto(func_id);
|
|
|
+ return bpf_base_func_proto(func_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2706,7 +2717,7 @@ cg_skb_func_proto(enum bpf_func_id func_id)
|
|
|
case BPF_FUNC_skb_load_bytes:
|
|
|
return &bpf_skb_load_bytes_proto;
|
|
|
default:
|
|
|
- return sk_filter_func_proto(func_id);
|
|
|
+ return bpf_base_func_proto(func_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2733,7 +2744,7 @@ lwt_inout_func_proto(enum bpf_func_id func_id)
|
|
|
case BPF_FUNC_skb_under_cgroup:
|
|
|
return &bpf_skb_under_cgroup_proto;
|
|
|
default:
|
|
|
- return sk_filter_func_proto(func_id);
|
|
|
+ return bpf_base_func_proto(func_id);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2983,10 +2994,10 @@ void bpf_warn_invalid_xdp_action(u32 act)
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(bpf_warn_invalid_xdp_action);
|
|
|
|
|
|
-static u32 sk_filter_convert_ctx_access(enum bpf_access_type type,
|
|
|
- const struct bpf_insn *si,
|
|
|
- struct bpf_insn *insn_buf,
|
|
|
- struct bpf_prog *prog)
|
|
|
+static u32 bpf_convert_ctx_access(enum bpf_access_type type,
|
|
|
+ const struct bpf_insn *si,
|
|
|
+ struct bpf_insn *insn_buf,
|
|
|
+ struct bpf_prog *prog)
|
|
|
{
|
|
|
struct bpf_insn *insn = insn_buf;
|
|
|
int off;
|
|
@@ -3210,7 +3221,7 @@ static u32 tc_cls_act_convert_ctx_access(enum bpf_access_type type,
|
|
|
offsetof(struct net_device, ifindex));
|
|
|
break;
|
|
|
default:
|
|
|
- return sk_filter_convert_ctx_access(type, si, insn_buf, prog);
|
|
|
+ return bpf_convert_ctx_access(type, si, insn_buf, prog);
|
|
|
}
|
|
|
|
|
|
return insn - insn_buf;
|
|
@@ -3242,7 +3253,7 @@ static u32 xdp_convert_ctx_access(enum bpf_access_type type,
|
|
|
static const struct bpf_verifier_ops sk_filter_ops = {
|
|
|
.get_func_proto = sk_filter_func_proto,
|
|
|
.is_valid_access = sk_filter_is_valid_access,
|
|
|
- .convert_ctx_access = sk_filter_convert_ctx_access,
|
|
|
+ .convert_ctx_access = bpf_convert_ctx_access,
|
|
|
};
|
|
|
|
|
|
static const struct bpf_verifier_ops tc_cls_act_ops = {
|
|
@@ -3261,24 +3272,24 @@ static const struct bpf_verifier_ops xdp_ops = {
|
|
|
static const struct bpf_verifier_ops cg_skb_ops = {
|
|
|
.get_func_proto = cg_skb_func_proto,
|
|
|
.is_valid_access = sk_filter_is_valid_access,
|
|
|
- .convert_ctx_access = sk_filter_convert_ctx_access,
|
|
|
+ .convert_ctx_access = bpf_convert_ctx_access,
|
|
|
};
|
|
|
|
|
|
static const struct bpf_verifier_ops lwt_inout_ops = {
|
|
|
.get_func_proto = lwt_inout_func_proto,
|
|
|
.is_valid_access = lwt_is_valid_access,
|
|
|
- .convert_ctx_access = sk_filter_convert_ctx_access,
|
|
|
+ .convert_ctx_access = bpf_convert_ctx_access,
|
|
|
};
|
|
|
|
|
|
static const struct bpf_verifier_ops lwt_xmit_ops = {
|
|
|
.get_func_proto = lwt_xmit_func_proto,
|
|
|
.is_valid_access = lwt_is_valid_access,
|
|
|
- .convert_ctx_access = sk_filter_convert_ctx_access,
|
|
|
+ .convert_ctx_access = bpf_convert_ctx_access,
|
|
|
.gen_prologue = tc_cls_act_prologue,
|
|
|
};
|
|
|
|
|
|
static const struct bpf_verifier_ops cg_sock_ops = {
|
|
|
- .get_func_proto = sk_filter_func_proto,
|
|
|
+ .get_func_proto = bpf_base_func_proto,
|
|
|
.is_valid_access = sock_filter_is_valid_access,
|
|
|
.convert_ctx_access = sock_filter_convert_ctx_access,
|
|
|
};
|