Lines Matching refs:pckt

233 	       bool is_ipv6, struct packet_description *pckt)  in parse_udp()  argument
236 bool is_icmp = !((pckt->flags & (1 << 0)) == 0); in parse_udp()
244 pckt->flow.port16[0] = udp->source; in parse_udp()
245 pckt->flow.port16[1] = udp->dest; in parse_udp()
247 pckt->flow.port16[0] = udp->dest; in parse_udp()
248 pckt->flow.port16[1] = udp->source; in parse_udp()
255 bool is_ipv6, struct packet_description *pckt) in parse_tcp() argument
258 bool is_icmp = !((pckt->flags & (1 << 0)) == 0); in parse_tcp()
266 pckt->flags |= (1 << 1); in parse_tcp()
268 pckt->flow.port16[0] = tcp->source; in parse_tcp()
269 pckt->flow.port16[1] = tcp->dest; in parse_tcp()
271 pckt->flow.port16[0] = tcp->dest; in parse_tcp()
272 pckt->flow.port16[1] = tcp->source; in parse_tcp()
279 struct packet_description *pckt, in encap_v6() argument
307 ip_suffix = pckt->flow.srcv6[3] ^ pckt->flow.port16[0]; in encap_v6()
322 struct packet_description *pckt, in encap_v4() argument
326 __u32 ip_suffix = bpf_ntohs(pckt->flow.port16[0]); in encap_v4()
336 ip_suffix ^= pckt->flow.src; in encap_v4()
445 struct packet_description *pckt) in parse_icmpv6() argument
461 pckt->flow.proto = ip6h->nexthdr; in parse_icmpv6()
462 pckt->flags |= (1 << 0); in parse_icmpv6()
463 memcpy(pckt->flow.srcv6, ip6h->daddr.in6_u.u6_addr32, 16); in parse_icmpv6()
464 memcpy(pckt->flow.dstv6, ip6h->saddr.in6_u.u6_addr32, 16); in parse_icmpv6()
470 struct packet_description *pckt) in parse_icmp() argument
488 pckt->flow.proto = iph->protocol; in parse_icmp()
489 pckt->flags |= (1 << 0); in parse_icmp()
490 pckt->flow.src = iph->daddr; in parse_icmp()
491 pckt->flow.dst = iph->saddr; in parse_icmp()
496 __u32 get_packet_hash(struct packet_description *pckt, in get_packet_hash() argument
500 return jhash_2words(jhash(pckt->flow.srcv6, 16, 12), in get_packet_hash()
501 pckt->flow.ports, 24); in get_packet_hash()
503 return jhash_2words(pckt->flow.src, pckt->flow.ports, in get_packet_hash()
509 struct packet_description *pckt, in get_packet_dst() argument
521 pckt->flow.port16[0] = pckt->flow.port16[1]; in get_packet_dst()
522 memset(pckt->flow.srcv6, 0, 16); in get_packet_dst()
524 hash = get_packet_hash(pckt, hash_16bytes); in get_packet_dst()
552 if (pckt->flow.proto == IPPROTO_UDP) in get_packet_dst()
555 bpf_map_update_elem(lru_map, &pckt->flow, &new_dst_lru, 0); in get_packet_dst()
562 struct packet_description *pckt, in connection_table_lookup() argument
570 dst_lru = bpf_map_lookup_elem(lru_map, &pckt->flow); in connection_table_lookup()
573 if (pckt->flow.proto == IPPROTO_UDP) { in connection_table_lookup()
588 static int process_l3_headers_v6(struct packet_description *pckt, in process_l3_headers_v6() argument
602 pckt->flow.proto = *protocol; in process_l3_headers_v6()
608 action = parse_icmpv6(data, data_end, off, pckt); in process_l3_headers_v6()
612 memcpy(pckt->flow.srcv6, ip6h->saddr.in6_u.u6_addr32, 16); in process_l3_headers_v6()
613 memcpy(pckt->flow.dstv6, ip6h->daddr.in6_u.u6_addr32, 16); in process_l3_headers_v6()
619 static int process_l3_headers_v4(struct packet_description *pckt, in process_l3_headers_v4() argument
633 pckt->flow.proto = *protocol; in process_l3_headers_v4()
639 action = parse_icmp(data, data_end, off, pckt); in process_l3_headers_v4()
643 pckt->flow.src = iph->saddr; in process_l3_headers_v4()
644 pckt->flow.dst = iph->daddr; in process_l3_headers_v4()
655 struct packet_description pckt = { }; in process_packet() local
670 action = process_l3_headers_v6(&pckt, &protocol, off, in process_packet()
673 action = process_l3_headers_v4(&pckt, &protocol, off, in process_packet()
677 protocol = pckt.flow.proto; in process_packet()
679 if (!parse_tcp(data, data_end, is_ipv6, &pckt)) in process_packet()
682 if (!parse_udp(data, data_end, is_ipv6, &pckt)) in process_packet()
689 memcpy(vip.vipv6, pckt.flow.dstv6, 16); in process_packet()
691 vip.vip = pckt.flow.dst; in process_packet()
692 vip.port = pckt.flow.port16[1]; in process_packet()
693 vip.proto = pckt.flow.proto; in process_packet()
701 pckt.flow.port16[1] = 0; in process_packet()
711 pckt.flow.port16[0] = 0; in process_packet()
712 if (!(pckt.flags & (1 << 1)) && !(vip_info->flags & (1 << 1))) in process_packet()
713 connection_table_lookup(&dst, &pckt, lru_map); in process_packet()
716 if (pckt.flow.proto == IPPROTO_TCP) { in process_packet()
722 if (pckt.flags & (1 << 1)) in process_packet()
727 if (!get_packet_dst(&dst, &pckt, vip_info, is_ipv6, lru_map)) in process_packet()
736 if (!encap_v6(xdp, cval, &pckt, dst, pkt_bytes)) in process_packet()
739 if (!encap_v4(xdp, cval, &pckt, dst, pkt_bytes)) in process_packet()