Lines Matching refs:skb
67 static __always_inline void *bpf_flow_dissect_get_header(struct __sk_buff *skb, in bpf_flow_dissect_get_header() argument
71 void *data_end = (void *)(long)skb->data_end; in bpf_flow_dissect_get_header()
72 void *data = (void *)(long)skb->data; in bpf_flow_dissect_get_header()
73 __u16 thoff = skb->flow_keys->thoff; in bpf_flow_dissect_get_header()
84 if (bpf_skb_load_bytes(skb, thoff, buffer, hdr_size)) in bpf_flow_dissect_get_header()
91 static __always_inline int parse_eth_proto(struct __sk_buff *skb, __be16 proto) in parse_eth_proto() argument
93 struct bpf_flow_keys *keys = skb->flow_keys; in parse_eth_proto()
98 bpf_tail_call(skb, &jmp_table, IP); in parse_eth_proto()
101 bpf_tail_call(skb, &jmp_table, IPV6); in parse_eth_proto()
105 bpf_tail_call(skb, &jmp_table, MPLS); in parse_eth_proto()
109 bpf_tail_call(skb, &jmp_table, VLAN); in parse_eth_proto()
120 int _dissect(struct __sk_buff *skb) in _dissect() argument
122 if (!skb->vlan_present) in _dissect()
123 return parse_eth_proto(skb, skb->protocol); in _dissect()
125 return parse_eth_proto(skb, skb->vlan_proto); in _dissect()
129 static __always_inline int parse_ip_proto(struct __sk_buff *skb, __u8 proto) in parse_ip_proto() argument
131 struct bpf_flow_keys *keys = skb->flow_keys; in parse_ip_proto()
132 void *data_end = (void *)(long)skb->data_end; in parse_ip_proto()
142 icmp = bpf_flow_dissect_get_header(skb, sizeof(*icmp), &_icmp); in parse_ip_proto()
148 return parse_eth_proto(skb, bpf_htons(ETH_P_IP)); in parse_ip_proto()
151 return parse_eth_proto(skb, bpf_htons(ETH_P_IPV6)); in parse_ip_proto()
153 gre = bpf_flow_dissect_get_header(skb, sizeof(*gre), &_gre); in parse_ip_proto()
172 eth = bpf_flow_dissect_get_header(skb, sizeof(*eth), in parse_ip_proto()
179 return parse_eth_proto(skb, eth->h_proto); in parse_ip_proto()
181 return parse_eth_proto(skb, gre->proto); in parse_ip_proto()
184 tcp = bpf_flow_dissect_get_header(skb, sizeof(*tcp), &_tcp); in parse_ip_proto()
199 udp = bpf_flow_dissect_get_header(skb, sizeof(*udp), &_udp); in parse_ip_proto()
213 static __always_inline int parse_ipv6_proto(struct __sk_buff *skb, __u8 nexthdr) in parse_ipv6_proto() argument
215 struct bpf_flow_keys *keys = skb->flow_keys; in parse_ipv6_proto()
221 bpf_tail_call(skb, &jmp_table, IPV6OP); in parse_ipv6_proto()
224 bpf_tail_call(skb, &jmp_table, IPV6FR); in parse_ipv6_proto()
227 return parse_ip_proto(skb, nexthdr); in parse_ipv6_proto()
233 PROG(IP)(struct __sk_buff *skb) in PROG()
235 void *data_end = (void *)(long)skb->data_end; in PROG()
236 struct bpf_flow_keys *keys = skb->flow_keys; in PROG()
237 void *data = (void *)(long)skb->data; in PROG()
241 iph = bpf_flow_dissect_get_header(skb, sizeof(*iph), &_iph); in PROG()
271 return parse_ip_proto(skb, iph->protocol); in PROG()
274 PROG(IPV6)(struct __sk_buff *skb) in PROG()
276 struct bpf_flow_keys *keys = skb->flow_keys; in PROG()
279 ip6h = bpf_flow_dissect_get_header(skb, sizeof(*ip6h), &_ip6h); in PROG()
288 return parse_ipv6_proto(skb, ip6h->nexthdr); in PROG()
291 PROG(IPV6OP)(struct __sk_buff *skb) in PROG()
295 ip6h = bpf_flow_dissect_get_header(skb, sizeof(*ip6h), &_ip6h); in PROG()
302 skb->flow_keys->thoff += (1 + ip6h->hdrlen) << 3; in PROG()
304 return parse_ipv6_proto(skb, ip6h->nexthdr); in PROG()
307 PROG(IPV6FR)(struct __sk_buff *skb) in PROG()
309 struct bpf_flow_keys *keys = skb->flow_keys; in PROG()
312 fragh = bpf_flow_dissect_get_header(skb, sizeof(*fragh), &_fragh); in PROG()
321 return parse_ipv6_proto(skb, fragh->nexthdr); in PROG()
324 PROG(MPLS)(struct __sk_buff *skb) in PROG()
328 mpls = bpf_flow_dissect_get_header(skb, sizeof(*mpls), &_mpls); in PROG()
335 PROG(VLAN)(struct __sk_buff *skb) in PROG()
337 struct bpf_flow_keys *keys = skb->flow_keys; in PROG()
342 if (bpf_skb_load_bytes(skb, keys->thoff - sizeof(proto), &proto, in PROG()
348 vlan = bpf_flow_dissect_get_header(skb, sizeof(*vlan), &_vlan); in PROG()
358 vlan = bpf_flow_dissect_get_header(skb, sizeof(*vlan), &_vlan); in PROG()
368 return parse_eth_proto(skb, vlan->h_vlan_encapsulated_proto); in PROG()