From c1882a3ee342da5b41312e67f702ceef214d7afb Mon Sep 17 00:00:00 2001 From: Anil Kumar Vishnoi Date: Tue, 10 May 2022 23:18:35 -0700 Subject: [PATCH] skip ebpf program Signed-off-by: Anil Kumar Vishnoi --- bpf/mb_bind.c | 2 ++ bpf/mb_connect.c | 3 +++ bpf/mb_get_sockopts.c | 3 +++ bpf/mb_recvmsg.c | 3 +++ bpf/mb_redir.c | 3 +++ bpf/mb_sendmsg.c | 3 +++ bpf/mb_sockops.c | 3 +++ bpf/mb_xdp.c | 3 +++ 8 files changed, 23 insertions(+) diff --git a/bpf/mb_bind.c b/bpf/mb_bind.c index 80b60bbf..8d6cb6bb 100644 --- a/bpf/mb_bind.c +++ b/bpf/mb_bind.c @@ -23,6 +23,8 @@ limitations under the License. // 0.0.0.0:4140 __section("cgroup/bind4") int mb_bind(struct bpf_sock_addr *ctx) { + debugf("cgroup/bind4 entry"); + return 1; #if MESH != LINKERD // only works on linkerd return 1; diff --git a/bpf/mb_connect.c b/bpf/mb_connect.c index 6670b799..baefac8b 100644 --- a/bpf/mb_connect.c +++ b/bpf/mb_connect.c @@ -264,6 +264,9 @@ static inline int tcp4_connect(struct bpf_sock_addr *ctx) __section("cgroup/connect4") int mb_sock4_connect(struct bpf_sock_addr *ctx) { + debugf("cgroup/connect4 entry"); + return 1; + switch (ctx->protocol) { case IPPROTO_TCP: return tcp4_connect(ctx); diff --git a/bpf/mb_get_sockopts.c b/bpf/mb_get_sockopts.c index afb42556..119ee7f2 100644 --- a/bpf/mb_get_sockopts.c +++ b/bpf/mb_get_sockopts.c @@ -23,6 +23,9 @@ limitations under the License. __section("cgroup/getsockopt") int mb_get_sockopt(struct bpf_sockopt *ctx) { + debugf("cgroup/getsockopt entry"); + return 1; + // currently, eBPF can not deal with optlen more than 4096 bytes, so, we // should limit this. if (ctx->optlen > MAX_OPS_BUFF_LENGTH) { diff --git a/bpf/mb_recvmsg.c b/bpf/mb_recvmsg.c index aa429b54..b23c869a 100644 --- a/bpf/mb_recvmsg.c +++ b/bpf/mb_recvmsg.c @@ -21,6 +21,9 @@ limitations under the License. __section("cgroup/recvmsg4") int mb_recvmsg4(struct bpf_sock_addr *ctx) { + debugf("cgroup/recvmsg4 entry"); + return 1; + #if MESH != ISTIO // only works on istio return 1; diff --git a/bpf/mb_redir.c b/bpf/mb_redir.c index 8763e841..4b1041e2 100644 --- a/bpf/mb_redir.c +++ b/bpf/mb_redir.c @@ -20,6 +20,9 @@ limitations under the License. __section("sk_msg") int mb_msg_redir(struct sk_msg_md *msg) { + debugf("sk_msg entry"); + return 1; + struct pair p = { .dip = msg->local_ip4, .dport = bpf_htons(msg->local_port), diff --git a/bpf/mb_sendmsg.c b/bpf/mb_sendmsg.c index a9a6bb5e..0f0e3482 100644 --- a/bpf/mb_sendmsg.c +++ b/bpf/mb_sendmsg.c @@ -21,6 +21,9 @@ limitations under the License. __section("cgroup/sendmsg4") int mb_sendmsg4(struct bpf_sock_addr *ctx) { + debugf("cgroup/sendmsg4 entry"); + return 1; + #if MESH != ISTIO // only works on istio return 1; diff --git a/bpf/mb_sockops.c b/bpf/mb_sockops.c index d56d1378..1f1121da 100644 --- a/bpf/mb_sockops.c +++ b/bpf/mb_sockops.c @@ -70,6 +70,9 @@ static inline int sockops_ipv4(struct bpf_sock_ops *skops) __section("sockops") int mb_sockops(struct bpf_sock_ops *skops) { + debugf("sockops entry"); + return 1; + __u32 family, op; family = skops->family; op = skops->op; diff --git a/bpf/mb_xdp.c b/bpf/mb_xdp.c index 07ea6df1..9dc7c5ef 100644 --- a/bpf/mb_xdp.c +++ b/bpf/mb_xdp.c @@ -50,6 +50,9 @@ static __always_inline __u16 csum_diff4(__u32 from, __u32 to, __u16 csum) __section("xdp") int mb_xdp(struct xdp_md *ctx) { + debugf("xdp entry"); + return XDP_PASS; + void *data = (void *)(long)ctx->data; void *data_end = (void *)(long)ctx->data_end; struct ethhdr *eth = (struct ethhdr *)data;