Lines Matching full:ipv4
370 struct iphdr *ipv4; member
387 hdr->ipv4 = (void *)hdr->eth + sizeof(*hdr->eth); in tcp_dissect()
388 if (hdr->ipv4 + 1 > data_end) in tcp_dissect()
390 if (hdr->ipv4->ihl * 4 < sizeof(*hdr->ipv4)) in tcp_dissect()
392 if (hdr->ipv4->version != 4) in tcp_dissect()
395 if (hdr->ipv4->protocol != IPPROTO_TCP) in tcp_dissect()
398 hdr->tcp = (void *)hdr->ipv4 + hdr->ipv4->ihl * 4; in tcp_dissect()
401 hdr->ipv4 = NULL; in tcp_dissect()
441 if (hdr->ipv4) { in tcp_lookup()
445 if ((hdr->ipv4->frag_off & bpf_htons(IP_DF | IP_MF | IP_OFFSET)) != bpf_htons(IP_DF)) in tcp_lookup()
448 tup.ipv4.saddr = hdr->ipv4->saddr; in tcp_lookup()
449 tup.ipv4.daddr = hdr->ipv4->daddr; in tcp_lookup()
450 tup.ipv4.sport = hdr->tcp->source; in tcp_lookup()
451 tup.ipv4.dport = hdr->tcp->dest; in tcp_lookup()
452 tup_size = sizeof(tup.ipv4); in tcp_lookup()
460 /* The verifier can't track that either ipv4 or ipv6 is not in tcp_lookup()
547 swap(hdr->ipv4->saddr, hdr->ipv4->daddr); in tcpv4_gen_synack()
548 hdr->ipv4->check = 0; /* Calculate checksum later. */ in tcpv4_gen_synack()
549 hdr->ipv4->tos = 0; in tcpv4_gen_synack()
550 hdr->ipv4->id = 0; in tcpv4_gen_synack()
551 hdr->ipv4->ttl = ttl; in tcpv4_gen_synack()
556 hdr->ipv4->tot_len = bpf_htons(sizeof(*hdr->ipv4) + hdr->tcp_len); in tcpv4_gen_synack()
620 if (hdr->ipv4) { in syncookie_handle_syn()
621 /* Check the IPv4 and TCP checksums before creating a SYNACK. */ in syncookie_handle_syn()
622 value = bpf_csum_diff(0, 0, (void *)hdr->ipv4, hdr->ipv4->ihl * 4, 0); in syncookie_handle_syn()
626 return XDP_DROP; /* Bad IPv4 checksum. */ in syncookie_handle_syn()
631 if (csum_tcpudp_magic(hdr->ipv4->saddr, hdr->ipv4->daddr, in syncookie_handle_syn()
635 ip_len = sizeof(*hdr->ipv4); in syncookie_handle_syn()
637 value = bpf_tcp_raw_gen_syncookie_ipv4(hdr->ipv4, hdr->tcp, in syncookie_handle_syn()
671 if (hdr->ipv4) { in syncookie_handle_syn()
672 if (hdr->ipv4->ihl * 4 > sizeof(*hdr->ipv4)) { in syncookie_handle_syn()
675 new_tcp_header = data + sizeof(*hdr->eth) + sizeof(*hdr->ipv4); in syncookie_handle_syn()
679 hdr->ipv4->ihl = sizeof(*hdr->ipv4) / 4; in syncookie_handle_syn()
694 if (hdr->ipv4) { in syncookie_handle_syn()
695 hdr->tcp->check = csum_tcpudp_magic(hdr->ipv4->saddr, in syncookie_handle_syn()
696 hdr->ipv4->daddr, in syncookie_handle_syn()
701 hdr->ipv4->check = 0; in syncookie_handle_syn()
702 value = bpf_csum_diff(0, 0, (void *)hdr->ipv4, sizeof(*hdr->ipv4), 0); in syncookie_handle_syn()
705 hdr->ipv4->check = csum_fold(value); in syncookie_handle_syn()
739 if (hdr->ipv4) in syncookie_handle_ack()
740 err = bpf_tcp_raw_check_syncookie_ipv4(hdr->ipv4, hdr->tcp); in syncookie_handle_ack()
791 if (hdr->ipv4) { in syncookie_part2()
793 hdr->ipv4 = (void *)hdr->eth + sizeof(*hdr->eth); in syncookie_part2()
797 if ((void *)hdr->ipv4 + IPV4_MAXLEN > data_end) in syncookie_part2()
799 hdr->tcp = (void *)hdr->ipv4 + hdr->ipv4->ihl * 4; in syncookie_part2()