Lines Matching refs:keys

75 static __always_inline int export_flow_keys(struct bpf_flow_keys *keys,  in export_flow_keys()  argument
78 __u32 key = (__u32)(keys->sport) << 16 | keys->dport; in export_flow_keys()
81 memcpy(&val, keys, sizeof(val)); in export_flow_keys()
118 struct bpf_flow_keys *keys = skb->flow_keys; in parse_eth_proto() local
137 return export_flow_keys(keys, BPF_DROP); in parse_eth_proto()
140 return export_flow_keys(keys, BPF_DROP); in parse_eth_proto()
146 struct bpf_flow_keys *keys = skb->flow_keys; in _dissect() local
148 if (keys->n_proto == bpf_htons(ETH_P_IP)) { in _dissect()
161 return parse_eth_proto(skb, keys->n_proto); in _dissect()
167 struct bpf_flow_keys *keys = skb->flow_keys; in parse_ip_proto() local
179 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
180 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
182 keys->is_encap = true; in parse_ip_proto()
183 if (keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP) in parse_ip_proto()
184 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
188 keys->is_encap = true; in parse_ip_proto()
189 if (keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP) in parse_ip_proto()
190 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
196 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
200 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
202 keys->thoff += sizeof(*gre); /* Step over GRE Flags and Proto */ in parse_ip_proto()
204 keys->thoff += 4; /* Step over chksum and Padding */ in parse_ip_proto()
206 keys->thoff += 4; /* Step over key */ in parse_ip_proto()
208 keys->thoff += 4; /* Step over sequence number */ in parse_ip_proto()
210 keys->is_encap = true; in parse_ip_proto()
211 if (keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP) in parse_ip_proto()
212 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
218 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
220 keys->thoff += sizeof(*eth); in parse_ip_proto()
229 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
232 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
235 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
237 keys->sport = tcp->source; in parse_ip_proto()
238 keys->dport = tcp->dest; in parse_ip_proto()
239 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
244 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
246 keys->sport = udp->source; in parse_ip_proto()
247 keys->dport = udp->dest; in parse_ip_proto()
248 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
250 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
253 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
258 struct bpf_flow_keys *keys = skb->flow_keys; in parse_ipv6_proto() local
272 return export_flow_keys(keys, BPF_DROP); in parse_ipv6_proto()
278 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
285 return export_flow_keys(keys, BPF_DROP); in PROG()
289 return export_flow_keys(keys, BPF_DROP); in PROG()
291 keys->addr_proto = ETH_P_IP; in PROG()
292 keys->ipv4_src = iph->saddr; in PROG()
293 keys->ipv4_dst = iph->daddr; in PROG()
294 keys->ip_proto = iph->protocol; in PROG()
296 keys->thoff += iph->ihl << 2; in PROG()
297 if (data + keys->thoff > data_end) in PROG()
298 return export_flow_keys(keys, BPF_DROP); in PROG()
301 keys->is_frag = true; in PROG()
308 keys->is_first_frag = true; in PROG()
312 if (!(keys->flags & in PROG()
319 return export_flow_keys(keys, BPF_OK); in PROG()
326 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
331 return export_flow_keys(keys, BPF_DROP); in PROG()
333 keys->addr_proto = ETH_P_IPV6; in PROG()
334 memcpy(&keys->ipv6_src, &ip6h->saddr, 2*sizeof(ip6h->saddr)); in PROG()
336 keys->thoff += sizeof(struct ipv6hdr); in PROG()
337 keys->ip_proto = ip6h->nexthdr; in PROG()
338 keys->flow_label = ip6_flowlabel(ip6h); in PROG()
340 if (keys->flow_label && keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL) in PROG()
341 return export_flow_keys(keys, BPF_OK); in PROG()
348 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
353 return export_flow_keys(keys, BPF_DROP); in PROG()
358 keys->thoff += (1 + ip6h->hdrlen) << 3; in PROG()
359 keys->ip_proto = ip6h->nexthdr; in PROG()
366 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
371 return export_flow_keys(keys, BPF_DROP); in PROG()
373 keys->thoff += sizeof(*fragh); in PROG()
374 keys->is_frag = true; in PROG()
375 keys->ip_proto = fragh->nexthdr; in PROG()
378 keys->is_first_frag = true; in PROG()
383 if (!(keys->flags & BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG)) in PROG()
384 return export_flow_keys(keys, BPF_OK); in PROG()
386 return export_flow_keys(keys, BPF_OK); in PROG()
394 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
399 return export_flow_keys(keys, BPF_DROP); in PROG()
401 return export_flow_keys(keys, BPF_OK); in PROG()
406 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
410 if (keys->n_proto == bpf_htons(ETH_P_8021AD)) { in PROG()
413 return export_flow_keys(keys, BPF_DROP); in PROG()
416 return export_flow_keys(keys, BPF_DROP); in PROG()
418 keys->nhoff += sizeof(*vlan); in PROG()
419 keys->thoff += sizeof(*vlan); in PROG()
424 return export_flow_keys(keys, BPF_DROP); in PROG()
426 keys->nhoff += sizeof(*vlan); in PROG()
427 keys->thoff += sizeof(*vlan); in PROG()
431 return export_flow_keys(keys, BPF_DROP); in PROG()
433 keys->n_proto = vlan->h_vlan_encapsulated_proto; in PROG()