Lines Matching +full:key +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0
6 * modify it under the terms of version 2 of the GNU General Public
53 __type(key, __u32);
61 struct bpf_tunnel_key key; in gre_set_tunnel() local
63 __builtin_memset(&key, 0x0, sizeof(key)); in gre_set_tunnel()
64 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in gre_set_tunnel()
65 key.tunnel_id = 2; in gre_set_tunnel()
66 key.tunnel_tos = 0; in gre_set_tunnel()
67 key.tunnel_ttl = 64; in gre_set_tunnel()
69 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in gre_set_tunnel()
83 struct bpf_tunnel_key key; in gre_set_tunnel_no_key() local
85 __builtin_memset(&key, 0x0, sizeof(key)); in gre_set_tunnel_no_key()
86 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in gre_set_tunnel_no_key()
87 key.tunnel_ttl = 64; in gre_set_tunnel_no_key()
89 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in gre_set_tunnel_no_key()
104 struct bpf_tunnel_key key; in gre_get_tunnel() local
106 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); in gre_get_tunnel()
112 bpf_printk("key %d remote ip 0x%x\n", key.tunnel_id, key.remote_ipv4); in gre_get_tunnel()
119 struct bpf_tunnel_key key; in ip6gretap_set_tunnel() local
122 __builtin_memset(&key, 0x0, sizeof(key)); in ip6gretap_set_tunnel()
123 key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ in ip6gretap_set_tunnel()
124 key.tunnel_id = 2; in ip6gretap_set_tunnel()
125 key.tunnel_tos = 0; in ip6gretap_set_tunnel()
126 key.tunnel_ttl = 64; in ip6gretap_set_tunnel()
127 key.tunnel_label = 0xabcde; in ip6gretap_set_tunnel()
129 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in ip6gretap_set_tunnel()
143 struct bpf_tunnel_key key; in ip6gretap_get_tunnel() local
146 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in ip6gretap_get_tunnel()
153 bpf_printk("key %d remote ip6 ::%x label %x\n", in ip6gretap_get_tunnel()
154 key.tunnel_id, key.remote_ipv6[3], key.tunnel_label); in ip6gretap_get_tunnel()
162 struct bpf_tunnel_key key; in erspan_set_tunnel() local
166 __builtin_memset(&key, 0x0, sizeof(key)); in erspan_set_tunnel()
167 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in erspan_set_tunnel()
168 key.tunnel_id = 2; in erspan_set_tunnel()
169 key.tunnel_tos = 0; in erspan_set_tunnel()
170 key.tunnel_ttl = 64; in erspan_set_tunnel()
172 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in erspan_set_tunnel()
187 md.version = 2; in erspan_set_tunnel()
205 struct bpf_tunnel_key key; in erspan_get_tunnel() local
209 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); in erspan_get_tunnel()
221 bpf_printk("key %d remote ip 0x%x erspan version %d\n", in erspan_get_tunnel()
222 key.tunnel_id, key.remote_ipv4, md.version); in erspan_get_tunnel()
241 struct bpf_tunnel_key key; in ip4ip6erspan_set_tunnel() local
245 __builtin_memset(&key, 0x0, sizeof(key)); in ip4ip6erspan_set_tunnel()
246 key.remote_ipv6[3] = bpf_htonl(0x11); in ip4ip6erspan_set_tunnel()
247 key.tunnel_id = 2; in ip4ip6erspan_set_tunnel()
248 key.tunnel_tos = 0; in ip4ip6erspan_set_tunnel()
249 key.tunnel_ttl = 64; in ip4ip6erspan_set_tunnel()
251 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in ip4ip6erspan_set_tunnel()
267 md.version = 2; in ip4ip6erspan_set_tunnel()
285 struct bpf_tunnel_key key; in ip4ip6erspan_get_tunnel() local
289 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in ip4ip6erspan_get_tunnel()
302 bpf_printk("ip6erspan get key %d remote ip6 ::%x erspan version %d\n", in ip4ip6erspan_get_tunnel()
303 key.tunnel_id, key.remote_ipv4, md.version); in ip4ip6erspan_get_tunnel()
322 struct bpf_tunnel_key key; in vxlan_set_tunnel_dst() local
334 __builtin_memset(&key, 0x0, sizeof(key)); in vxlan_set_tunnel_dst()
335 key.local_ipv4 = 0xac100164; /* 172.16.1.100 */ in vxlan_set_tunnel_dst()
336 key.remote_ipv4 = *local_ip; in vxlan_set_tunnel_dst()
337 key.tunnel_id = 2; in vxlan_set_tunnel_dst()
338 key.tunnel_tos = 0; in vxlan_set_tunnel_dst()
339 key.tunnel_ttl = 64; in vxlan_set_tunnel_dst()
341 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in vxlan_set_tunnel_dst()
361 struct bpf_tunnel_key key; in vxlan_set_tunnel_src() local
373 __builtin_memset(&key, 0x0, sizeof(key)); in vxlan_set_tunnel_src()
374 key.local_ipv4 = *local_ip; in vxlan_set_tunnel_src()
375 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in vxlan_set_tunnel_src()
376 key.tunnel_id = 2; in vxlan_set_tunnel_src()
377 key.tunnel_tos = 0; in vxlan_set_tunnel_src()
378 key.tunnel_ttl = 64; in vxlan_set_tunnel_src()
380 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in vxlan_set_tunnel_src()
401 struct bpf_tunnel_key key; in vxlan_get_tunnel_src() local
404 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in vxlan_get_tunnel_src()
417 if (key.local_ipv4 != ASSIGNED_ADDR_VETH1 || md.gbp != 0x800FF || in vxlan_get_tunnel_src()
418 !(key.tunnel_flags & TUNNEL_KEY) || in vxlan_get_tunnel_src()
419 (key.tunnel_flags & TUNNEL_CSUM)) { in vxlan_get_tunnel_src()
420 bpf_printk("vxlan key %d local ip 0x%x remote ip 0x%x gbp 0x%x flags 0x%x\n", in vxlan_get_tunnel_src()
421 key.tunnel_id, key.local_ipv4, in vxlan_get_tunnel_src()
422 key.remote_ipv4, md.gbp, in vxlan_get_tunnel_src()
423 bpf_ntohs(key.tunnel_flags)); in vxlan_get_tunnel_src()
434 struct ethhdr *eth = (struct ethhdr *)(long)skb->data; in veth_set_outer_dst()
436 void *data_end = (void *)(long)skb->data_end; in veth_set_outer_dst()
447 if (eth->h_proto != bpf_htons(ETH_P_IP)) in veth_set_outer_dst()
455 if (iph->protocol != IPPROTO_UDP) in veth_set_outer_dst()
463 if (udph->dest != bpf_htons(VXLAN_UDP_PORT)) in veth_set_outer_dst()
466 if (iph->daddr != assigned_ip) { in veth_set_outer_dst()
467 csum = bpf_csum_diff(&iph->daddr, sizeof(__u32), &assigned_ip, in veth_set_outer_dst()
487 struct bpf_tunnel_key key; in ip6vxlan_set_tunnel_dst() local
498 __builtin_memset(&key, 0x0, sizeof(key)); in ip6vxlan_set_tunnel_dst()
499 key.local_ipv6[3] = bpf_htonl(0x11); /* ::11 */ in ip6vxlan_set_tunnel_dst()
500 key.remote_ipv6[3] = bpf_htonl(*local_ip); in ip6vxlan_set_tunnel_dst()
501 key.tunnel_id = 22; in ip6vxlan_set_tunnel_dst()
502 key.tunnel_tos = 0; in ip6vxlan_set_tunnel_dst()
503 key.tunnel_ttl = 64; in ip6vxlan_set_tunnel_dst()
505 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in ip6vxlan_set_tunnel_dst()
518 struct bpf_tunnel_key key; in ip6vxlan_set_tunnel_src() local
529 __builtin_memset(&key, 0x0, sizeof(key)); in ip6vxlan_set_tunnel_src()
530 key.local_ipv6[3] = bpf_htonl(*local_ip); in ip6vxlan_set_tunnel_src()
531 key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ in ip6vxlan_set_tunnel_src()
532 key.tunnel_id = 22; in ip6vxlan_set_tunnel_src()
533 key.tunnel_tos = 0; in ip6vxlan_set_tunnel_src()
534 key.tunnel_ttl = 64; in ip6vxlan_set_tunnel_src()
536 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in ip6vxlan_set_tunnel_src()
549 struct bpf_tunnel_key key; in ip6vxlan_get_tunnel_src() local
560 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in ip6vxlan_get_tunnel_src()
567 if (bpf_ntohl(key.local_ipv6[3]) != *local_ip || in ip6vxlan_get_tunnel_src()
568 !(key.tunnel_flags & TUNNEL_KEY) || in ip6vxlan_get_tunnel_src()
569 !(key.tunnel_flags & TUNNEL_CSUM)) { in ip6vxlan_get_tunnel_src()
570 bpf_printk("ip6vxlan key %d local ip6 ::%x remote ip6 ::%x label 0x%x flags 0x%x\n", in ip6vxlan_get_tunnel_src()
571 key.tunnel_id, bpf_ntohl(key.local_ipv6[3]), in ip6vxlan_get_tunnel_src()
572 bpf_ntohl(key.remote_ipv6[3]), key.tunnel_label, in ip6vxlan_get_tunnel_src()
573 bpf_ntohs(key.tunnel_flags)); in ip6vxlan_get_tunnel_src()
591 struct bpf_tunnel_key key; in geneve_set_tunnel() local
595 __builtin_memset(&key, 0x0, sizeof(key)); in geneve_set_tunnel()
596 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in geneve_set_tunnel()
597 key.tunnel_id = 2; in geneve_set_tunnel()
598 key.tunnel_tos = 0; in geneve_set_tunnel()
599 key.tunnel_ttl = 64; in geneve_set_tunnel()
602 gopt->opt_class = bpf_htons(0x102); /* Open Virtual Networking (OVN) */ in geneve_set_tunnel()
603 gopt->type = 0x08; in geneve_set_tunnel()
604 gopt->r1 = 0; in geneve_set_tunnel()
605 gopt->r2 = 0; in geneve_set_tunnel()
606 gopt->r3 = 0; in geneve_set_tunnel()
607 gopt->length = 2; /* 4-byte multiple */ in geneve_set_tunnel()
608 *(int *) &gopt->opt_data = bpf_htonl(0xdeadbeef); in geneve_set_tunnel()
610 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in geneve_set_tunnel()
630 struct bpf_tunnel_key key; in geneve_get_tunnel() local
633 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); in geneve_get_tunnel()
643 bpf_printk("key %d remote ip 0x%x geneve class 0x%x\n", in geneve_get_tunnel()
644 key.tunnel_id, key.remote_ipv4, gopt.opt_class); in geneve_get_tunnel()
651 struct bpf_tunnel_key key; in ip6geneve_set_tunnel() local
656 __builtin_memset(&key, 0x0, sizeof(key)); in ip6geneve_set_tunnel()
657 key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ in ip6geneve_set_tunnel()
658 key.tunnel_id = 22; in ip6geneve_set_tunnel()
659 key.tunnel_tos = 0; in ip6geneve_set_tunnel()
660 key.tunnel_ttl = 64; in ip6geneve_set_tunnel()
662 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in ip6geneve_set_tunnel()
670 gopt->opt_class = bpf_htons(0x102); /* Open Virtual Networking (OVN) */ in ip6geneve_set_tunnel()
671 gopt->type = 0x08; in ip6geneve_set_tunnel()
672 gopt->r1 = 0; in ip6geneve_set_tunnel()
673 gopt->r2 = 0; in ip6geneve_set_tunnel()
674 gopt->r3 = 0; in ip6geneve_set_tunnel()
675 gopt->length = 2; /* 4-byte multiple */ in ip6geneve_set_tunnel()
676 *(int *) &gopt->opt_data = bpf_htonl(0xfeedbeef); in ip6geneve_set_tunnel()
690 struct bpf_tunnel_key key; in ip6geneve_get_tunnel() local
694 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in ip6geneve_get_tunnel()
705 bpf_printk("key %d remote ip 0x%x geneve class 0x%x\n", in ip6geneve_get_tunnel()
706 key.tunnel_id, key.remote_ipv4, gopt.opt_class); in ip6geneve_get_tunnel()
714 struct bpf_tunnel_key key = {}; in ipip_set_tunnel() local
715 void *data = (void *)(long)skb->data; in ipip_set_tunnel()
717 void *data_end = (void *)(long)skb->data_end; in ipip_set_tunnel()
726 key.tunnel_ttl = 64; in ipip_set_tunnel()
727 if (iph->protocol == IPPROTO_ICMP) { in ipip_set_tunnel()
728 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in ipip_set_tunnel()
731 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0); in ipip_set_tunnel()
744 struct bpf_tunnel_key key; in ipip_get_tunnel() local
746 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); in ipip_get_tunnel()
752 bpf_printk("remote ip 0x%x\n", key.remote_ipv4); in ipip_get_tunnel()
759 struct bpf_tunnel_key key = {}; in ipip_gue_set_tunnel() local
761 void *data = (void *)(long)skb->data; in ipip_gue_set_tunnel()
763 void *data_end = (void *)(long)skb->data_end; in ipip_gue_set_tunnel()
771 key.tunnel_ttl = 64; in ipip_gue_set_tunnel()
772 if (iph->protocol == IPPROTO_ICMP) in ipip_gue_set_tunnel()
773 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in ipip_gue_set_tunnel()
775 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0); in ipip_gue_set_tunnel()
798 struct bpf_tunnel_key key = {}; in ipip_fou_set_tunnel() local
800 void *data = (void *)(long)skb->data; in ipip_fou_set_tunnel()
802 void *data_end = (void *)(long)skb->data_end; in ipip_fou_set_tunnel()
810 key.tunnel_ttl = 64; in ipip_fou_set_tunnel()
811 if (iph->protocol == IPPROTO_ICMP) in ipip_fou_set_tunnel()
812 key.remote_ipv4 = 0xac100164; /* 172.16.1.100 */ in ipip_fou_set_tunnel()
814 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), 0); in ipip_fou_set_tunnel()
837 struct bpf_tunnel_key key = {}; in ipip_encap_get_tunnel() local
840 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); in ipip_encap_get_tunnel()
856 key.remote_ipv4, bpf_ntohs(encap.sport), in ipip_encap_get_tunnel()
864 struct bpf_tunnel_key key = {}; in ipip6_set_tunnel() local
865 void *data = (void *)(long)skb->data; in ipip6_set_tunnel()
867 void *data_end = (void *)(long)skb->data_end; in ipip6_set_tunnel()
876 __builtin_memset(&key, 0x0, sizeof(key)); in ipip6_set_tunnel()
877 key.tunnel_ttl = 64; in ipip6_set_tunnel()
878 if (iph->protocol == IPPROTO_ICMP) { in ipip6_set_tunnel()
879 key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ in ipip6_set_tunnel()
882 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in ipip6_set_tunnel()
896 struct bpf_tunnel_key key; in ipip6_get_tunnel() local
898 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in ipip6_get_tunnel()
905 bpf_printk("remote ip6 %x::%x\n", bpf_htonl(key.remote_ipv6[0]), in ipip6_get_tunnel()
906 bpf_htonl(key.remote_ipv6[3])); in ipip6_get_tunnel()
913 struct bpf_tunnel_key key = {}; in ip6ip6_set_tunnel() local
914 void *data = (void *)(long)skb->data; in ip6ip6_set_tunnel()
916 void *data_end = (void *)(long)skb->data_end; in ip6ip6_set_tunnel()
925 key.tunnel_ttl = 64; in ip6ip6_set_tunnel()
926 if (iph->nexthdr == 58 /* NEXTHDR_ICMP */) { in ip6ip6_set_tunnel()
927 key.remote_ipv6[3] = bpf_htonl(0x11); /* ::11 */ in ip6ip6_set_tunnel()
930 ret = bpf_skb_set_tunnel_key(skb, &key, sizeof(key), in ip6ip6_set_tunnel()
944 struct bpf_tunnel_key key; in ip6ip6_get_tunnel() local
946 ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), in ip6ip6_get_tunnel()
953 bpf_printk("remote ip6 %x::%x\n", bpf_htonl(key.remote_ipv6[0]), in ip6ip6_get_tunnel()
954 bpf_htonl(key.remote_ipv6[3])); in ip6ip6_get_tunnel()
998 if (!iph || iph->protocol != IPPROTO_ESP) in xfrm_get_state_xdp()
1007 opts.daddr.a4 = iph->daddr; in xfrm_get_state_xdp()
1008 opts.spi = esph->spi; in xfrm_get_state_xdp()
1016 if (!x->replay_esn) in xfrm_get_state_xdp()
1019 xfrm_replay_window = x->replay_esn->replay_window; in xfrm_get_state_xdp()