• Home
  • Raw
  • Download

Lines Matching refs:keys

74 static __always_inline int export_flow_keys(struct bpf_flow_keys *keys,  in export_flow_keys()  argument
77 __u32 key = (__u32)(keys->sport) << 16 | keys->dport; in export_flow_keys()
80 memcpy(&val, keys, sizeof(val)); in export_flow_keys()
117 struct bpf_flow_keys *keys = skb->flow_keys; in parse_eth_proto() local
136 return export_flow_keys(keys, BPF_DROP); in parse_eth_proto()
139 return export_flow_keys(keys, BPF_DROP); in parse_eth_proto()
145 struct bpf_flow_keys *keys = skb->flow_keys; in _dissect() local
147 return parse_eth_proto(skb, keys->n_proto); in _dissect()
153 struct bpf_flow_keys *keys = skb->flow_keys; in parse_ip_proto() local
165 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
166 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
168 keys->is_encap = true; in parse_ip_proto()
169 if (keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP) in parse_ip_proto()
170 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
174 keys->is_encap = true; in parse_ip_proto()
175 if (keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP) in parse_ip_proto()
176 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
182 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
186 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
188 keys->thoff += sizeof(*gre); /* Step over GRE Flags and Proto */ in parse_ip_proto()
190 keys->thoff += 4; /* Step over chksum and Padding */ in parse_ip_proto()
192 keys->thoff += 4; /* Step over key */ in parse_ip_proto()
194 keys->thoff += 4; /* Step over sequence number */ in parse_ip_proto()
196 keys->is_encap = true; in parse_ip_proto()
197 if (keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP) in parse_ip_proto()
198 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
204 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
206 keys->thoff += sizeof(*eth); in parse_ip_proto()
215 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
218 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
221 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
223 keys->sport = tcp->source; in parse_ip_proto()
224 keys->dport = tcp->dest; in parse_ip_proto()
225 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
230 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
232 keys->sport = udp->source; in parse_ip_proto()
233 keys->dport = udp->dest; in parse_ip_proto()
234 return export_flow_keys(keys, BPF_OK); in parse_ip_proto()
236 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
239 return export_flow_keys(keys, BPF_DROP); in parse_ip_proto()
244 struct bpf_flow_keys *keys = skb->flow_keys; in parse_ipv6_proto() local
258 return export_flow_keys(keys, BPF_DROP); in parse_ipv6_proto()
264 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
271 return export_flow_keys(keys, BPF_DROP); in PROG()
275 return export_flow_keys(keys, BPF_DROP); in PROG()
277 keys->addr_proto = ETH_P_IP; in PROG()
278 keys->ipv4_src = iph->saddr; in PROG()
279 keys->ipv4_dst = iph->daddr; in PROG()
280 keys->ip_proto = iph->protocol; in PROG()
282 keys->thoff += iph->ihl << 2; in PROG()
283 if (data + keys->thoff > data_end) in PROG()
284 return export_flow_keys(keys, BPF_DROP); in PROG()
287 keys->is_frag = true; in PROG()
294 keys->is_first_frag = true; in PROG()
298 if (!(keys->flags & in PROG()
305 return export_flow_keys(keys, BPF_OK); in PROG()
312 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
317 return export_flow_keys(keys, BPF_DROP); in PROG()
319 keys->addr_proto = ETH_P_IPV6; in PROG()
320 memcpy(&keys->ipv6_src, &ip6h->saddr, 2*sizeof(ip6h->saddr)); in PROG()
322 keys->thoff += sizeof(struct ipv6hdr); in PROG()
323 keys->ip_proto = ip6h->nexthdr; in PROG()
324 keys->flow_label = ip6_flowlabel(ip6h); in PROG()
326 if (keys->flags & BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL) in PROG()
327 return export_flow_keys(keys, BPF_OK); in PROG()
334 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
339 return export_flow_keys(keys, BPF_DROP); in PROG()
344 keys->thoff += (1 + ip6h->hdrlen) << 3; in PROG()
345 keys->ip_proto = ip6h->nexthdr; in PROG()
352 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
357 return export_flow_keys(keys, BPF_DROP); in PROG()
359 keys->thoff += sizeof(*fragh); in PROG()
360 keys->is_frag = true; in PROG()
361 keys->ip_proto = fragh->nexthdr; in PROG()
364 keys->is_first_frag = true; in PROG()
369 if (!(keys->flags & BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG)) in PROG()
370 return export_flow_keys(keys, BPF_OK); in PROG()
378 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
383 return export_flow_keys(keys, BPF_DROP); in PROG()
385 return export_flow_keys(keys, BPF_OK); in PROG()
390 struct bpf_flow_keys *keys = skb->flow_keys; in PROG() local
394 if (keys->n_proto == bpf_htons(ETH_P_8021AD)) { in PROG()
397 return export_flow_keys(keys, BPF_DROP); in PROG()
400 return export_flow_keys(keys, BPF_DROP); in PROG()
402 keys->nhoff += sizeof(*vlan); in PROG()
403 keys->thoff += sizeof(*vlan); in PROG()
408 return export_flow_keys(keys, BPF_DROP); in PROG()
410 keys->nhoff += sizeof(*vlan); in PROG()
411 keys->thoff += sizeof(*vlan); in PROG()
415 return export_flow_keys(keys, BPF_DROP); in PROG()
417 keys->n_proto = vlan->h_vlan_encapsulated_proto; in PROG()