/samples/bpf/ |
D | tcbpf1_kern.c | 16 static inline void set_dst_mac(struct __sk_buff *skb, char *mac) in set_dst_mac() argument 18 bpf_skb_store_bytes(skb, 0, mac, ETH_ALEN, 1); in set_dst_mac() 24 static inline void set_ip_tos(struct __sk_buff *skb, __u8 new_tos) in set_ip_tos() argument 26 __u8 old_tos = load_byte(skb, TOS_OFF); in set_ip_tos() 28 bpf_l3_csum_replace(skb, IP_CSUM_OFF, htons(old_tos), htons(new_tos), 2); in set_ip_tos() 29 bpf_skb_store_bytes(skb, TOS_OFF, &new_tos, sizeof(new_tos), 0); in set_ip_tos() 37 static inline void set_tcp_ip_src(struct __sk_buff *skb, __u32 new_ip) in set_tcp_ip_src() argument 39 __u32 old_ip = _htonl(load_word(skb, IP_SRC_OFF)); in set_tcp_ip_src() 41 bpf_l4_csum_replace(skb, TCP_CSUM_OFF, old_ip, new_ip, IS_PSEUDO | sizeof(new_ip)); in set_tcp_ip_src() 42 bpf_l3_csum_replace(skb, IP_CSUM_OFF, old_ip, new_ip, sizeof(new_ip)); in set_tcp_ip_src() [all …]
|
D | test_lwt_bpf.c | 37 int do_nop(struct __sk_buff *skb) in do_nop() argument 44 int do_test_ctx(struct __sk_buff *skb) in do_test_ctx() argument 46 skb->cb[0] = CB_MAGIC; in do_test_ctx() 47 printk("len %d hash %d protocol %d\n", skb->len, skb->hash, in do_test_ctx() 48 skb->protocol); in do_test_ctx() 49 printk("cb %d ingress_ifindex %d ifindex %d\n", skb->cb[0], in do_test_ctx() 50 skb->ingress_ifindex, skb->ifindex); in do_test_ctx() 57 int do_test_cb(struct __sk_buff *skb) in do_test_cb() argument 59 printk("cb0: %x cb1: %x cb2: %x\n", skb->cb[0], skb->cb[1], in do_test_cb() 60 skb->cb[2]); in do_test_cb() [all …]
|
D | sockex3_kern.c | 42 static inline void parse_eth_proto(struct __sk_buff *skb, u32 proto) in parse_eth_proto() argument 47 bpf_tail_call(skb, &jmp_table, PARSE_VLAN); in parse_eth_proto() 51 bpf_tail_call(skb, &jmp_table, PARSE_MPLS); in parse_eth_proto() 54 bpf_tail_call(skb, &jmp_table, PARSE_IP); in parse_eth_proto() 57 bpf_tail_call(skb, &jmp_table, PARSE_IPV6); in parse_eth_proto() 125 static void update_stats(struct __sk_buff *skb, struct globals *g) in update_stats() argument 133 __sync_fetch_and_add(&value->bytes, skb->len); in update_stats() 135 struct pair val = {1, skb->len}; in update_stats() 141 static __always_inline void parse_ip_proto(struct __sk_buff *skb, in parse_ip_proto() argument 144 __u32 nhoff = skb->cb[0]; in parse_ip_proto() [all …]
|
D | sockex2_kern.c | 62 static inline __u64 parse_ip(struct __sk_buff *skb, __u64 nhoff, __u64 *ip_proto, in parse_ip() argument 67 if (unlikely(ip_is_fragment(skb, nhoff))) in parse_ip() 70 *ip_proto = load_byte(skb, nhoff + offsetof(struct iphdr, protocol)); in parse_ip() 73 flow->src = load_word(skb, nhoff + offsetof(struct iphdr, saddr)); in parse_ip() 74 flow->dst = load_word(skb, nhoff + offsetof(struct iphdr, daddr)); in parse_ip() 77 verlen = load_byte(skb, nhoff + 0/*offsetof(struct iphdr, ihl)*/); in parse_ip() 86 static inline __u64 parse_ipv6(struct __sk_buff *skb, __u64 nhoff, __u64 *ip_proto, in parse_ipv6() argument 89 *ip_proto = load_byte(skb, in parse_ipv6() 91 flow->src = ipv6_addr_hash(skb, in parse_ipv6() 93 flow->dst = ipv6_addr_hash(skb, in parse_ipv6() [all …]
|
D | tracex1_kern.c | 34 struct sk_buff *skb; in bpf_prog1() local 38 bpf_probe_read_kernel(&skb, sizeof(skb), (void *)PT_REGS_PARM1(ctx)); in bpf_prog1() 39 dev = _(skb->dev); in bpf_prog1() 40 len = _(skb->len); in bpf_prog1() 47 bpf_trace_printk(fmt, sizeof(fmt), skb, len); in bpf_prog1()
|
D | parse_ldabs.c | 28 int handle_ingress(struct __sk_buff *skb) in handle_ingress() argument 32 if (load_half(skb, offsetof(struct ethhdr, h_proto)) != ETH_P_IP) in handle_ingress() 34 if (load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol)) != IPPROTO_UDP || in handle_ingress() 35 load_byte(skb, ETH_HLEN) != 0x45) in handle_ingress() 37 if (ip_is_fragment(skb, ETH_HLEN)) in handle_ingress() 39 if (load_half(skb, troff + offsetof(struct udphdr, dest)) == DEFAULT_PKTGEN_UDP_PORT) in handle_ingress()
|
D | sockex1_kern.c | 16 int bpf_prog1(struct __sk_buff *skb) in bpf_prog1() argument 18 int index = load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol)); in bpf_prog1() 21 if (skb->pkt_type != PACKET_OUTGOING) in bpf_prog1() 26 __sync_fetch_and_add(value, skb->len); in bpf_prog1()
|
D | tc_l2_redirect_kern.c | 59 int _l2_to_iptun_ingress_forward(struct __sk_buff *skb) in _l2_to_iptun_ingress_forward() argument 62 void *data = (void *)(long)skb->data; in _l2_to_iptun_ingress_forward() 64 void *data_end = (void *)(long)skb->data_end; in _l2_to_iptun_ingress_forward() 110 int _l2_to_iptun_ingress_redirect(struct __sk_buff *skb) in _l2_to_iptun_ingress_redirect() argument 113 void *data = (void *)(long)skb->data; in _l2_to_iptun_ingress_redirect() 115 void *data_end = (void *)(long)skb->data_end; in _l2_to_iptun_ingress_redirect() 146 bpf_skb_set_tunnel_key(skb, &tkey, sizeof(tkey), 0); in _l2_to_iptun_ingress_redirect() 151 int _l2_to_ip6tun_ingress_redirect(struct __sk_buff *skb) in _l2_to_ip6tun_ingress_redirect() argument 154 void *data = (void *)(long)skb->data; in _l2_to_ip6tun_ingress_redirect() 156 void *data_end = (void *)(long)skb->data_end; in _l2_to_ip6tun_ingress_redirect() [all …]
|
D | hbm_edt_kern.c | 56 int _hbm_out_cg(struct __sk_buff *skb) in _hbm_out_cg() argument 68 int len = skb->len; in _hbm_out_cg() 74 if (qsp != NULL && !qsp->loopback && (skb->ifindex == 1)) in _hbm_out_cg() 77 hbm_get_pkt_info(skb, &pkti); in _hbm_out_cg() 107 skb->tstamp = sendtime; in _hbm_out_cg() 128 if (bpf_skb_ecn_set_ce(skb)) { in _hbm_out_cg()
|
D | test_cgrp2_tc_kern.c | 42 int handle_egress(struct __sk_buff *skb) in handle_egress() argument 44 void *data = (void *)(long)skb->data; in handle_egress() 47 void *data_end = (void *)(long)skb->data_end; in handle_egress() 61 } else if (bpf_skb_under_cgroup(skb, &test_cgrp2_array_pin, 0) != 1) { in handle_egress()
|
D | parse_simple.c | 27 int handle_ingress(struct __sk_buff *skb) in handle_ingress() argument 29 void *data = (void *)(long)skb->data; in handle_ingress() 33 void *data_end = (void *)(long)skb->data_end; in handle_ingress()
|
D | hbm_out_kern.c | 58 int _hbm_out_cg(struct __sk_buff *skb) in _hbm_out_cg() argument 61 int len = skb->len; in _hbm_out_cg() 76 if (qsp != NULL && !qsp->loopback && (skb->ifindex == 1)) in _hbm_out_cg() 79 hbm_get_pkt_info(skb, &pkti); in _hbm_out_cg() 145 if (bpf_skb_ecn_set_ce(skb)) { in _hbm_out_cg()
|
D | hbm_kern.h | 84 static int get_tcp_info(struct __sk_buff *skb, struct hbm_pkt_info *pkti) in get_tcp_info() argument 89 sk = skb->sk; in get_tcp_info() 110 static void hbm_get_pkt_info(struct __sk_buff *skb, in hbm_get_pkt_info() argument 118 bpf_skb_load_bytes(skb, 0, &iph, 12); in hbm_get_pkt_info() 134 get_tcp_info(skb, pkti); in hbm_get_pkt_info()
|
D | lwt_len_hist_kern.c | 67 int do_len_hist(struct __sk_buff *skb) in do_len_hist() argument 71 key = log2l(skb->len); in do_len_hist()
|
D | parse_varlen.c | 113 int handle_ingress(struct __sk_buff *skb) in handle_ingress() argument 115 void *data = (void *)(long)skb->data; in handle_ingress() 117 void *data_end = (void *)(long)skb->data_end; in handle_ingress()
|
/samples/connector/ |
D | cn_test.c | 45 struct sk_buff *skb; 53 skb = alloc_skb(size, GFP_ATOMIC); 54 if (!skb) { 59 nlh = nlmsg_put(skb, 0, 0x123, NLMSG_DONE, size - sizeof(*nlh), 0); 61 kfree_skb(skb); 104 NETLINK_CB(skb).dst_group = ctl->group; 106 netlink_unicast(nls, skb, 0, 0);
|