bpf_map_lookup_elem, bpf_map_elem, bpf_map_delete_elem, bpf_ktime_get_ns, bpf_get_prandom_u32, bpf_get_smp_processor_id, bpf_skb_store_bytes, bpf_l3_csum_replace, bpf_l4_csum_replace, bpf_tail_call, bpf_clone_redirect, bpf_get_cgroup_classid, bpf_skb_vlan_push, bpf...
*/ ret = bpf_l4_csum_replace(skb, sizeof(eth) + sizeof(ip6h) + offsetof(struct icmphdr, checksum), oldsum, newsum, BPF_F_PSEUDO_HDR | sizeof(newsum)); if (ret) { bpf_debug("bpf_l4_csum_replace returned %d\n", ret); return TC_ACT_SHOT; }...
static long (*bpf_l4_csum_replace)(struct __sk_buff *skb, __u32 offset, __u64 from, __u64 to, __u64 fla... ^ /virtual/include/bcc/helpers.h:830:14: note: previous definition is here static int (*bpf_l4_csum_replace)(voidctx, unsigned long long off, unsigned long long fro...
BPF_PROG_TYPE_XDP: BPF_FUNC_perf_event_output() BPF_FUNC_get_smp_processor_id() BPF_FUNC_csum_diff() BPF_FUNC_xdp_adjust_head() BPF_FUNC_xdp_adjust_meta() BPF_FUNC_redirect() BPF_FUNC_redirect_map() BPF_FUNC_xdp_adjust_tail() BPF_FUNC_fib_lookup() Base functions 5. perf 事件...
143: (18) r1 =0x5f6d7573635f346c 145: (7b) *(u64 *)(r10-32) = r1 146: (bf) r1 = r10 147: (07) r1 +=-32 148: (b7) r2 =32 149: (85) call bpf_trace_printk#-55408// print "l4_csum_replace tcp_flag error\n" 150: (b7) r0 =...
**TL; DR.**Helperskb_store_bytes、l3_csum_replace和l4_csum_replace对于验证者来说是修改数据包...
int bpf_l4_csum_replace(struct sk_buff *skb, u32 offset, u64 from, u64 to, u64 flags) Description Recompute the layer 4 (e.g. TCP, UDP or ICMP) checksum for the packet associated to skb. Computation is incremental, so the helper must know the former value of the header field ...
2. bpf_l3_csum_replace、bpf_l4_csum_replace:用于计算并更新数据包的校验和。这些函数可以用于修改数据包的头部信息,如修改IP头的校验和、TCP头的校验和等。 3. bpf_skb_get_proto:获取数据包的协议类型(如IPv4、IPv6、TCP、UDP等)。这个函数可以用于对不同类型的数据包进行不同的处理。 4. bpf_skb_pull...
(*bpf_l4_csum_replace)(void *ctx, int off, int from, int to, int flags) = (void *) BPF_FUNC_l4_csum_replace; static void *(*bpf_map_lookup_elem)(void *map, void *key) = (void *) BPF_FUNC_map_lookup_elem; /* Some used BPF intrinsics. */ unsigned long long load_byte(...
(bpf_l4_csum_replace(ctx, TCP_CSUM_OFFSET, 0, sz / 4, BPF_F_PSEUDO_HDR | sizeof(u8))) u16 csum = bpf_csum_diff(0, 0, (u32*)&token, sizeof(token), 0); // 2 tcp pseudo // RET_IF(bpf_l4_csum_replace(ctx, TCP_CSUM_OFFSET, 0, csum, 0)); update_metrics(); return...