Lines Matching full:ipv4
369 struct iphdr *ipv4; member
386 hdr->ipv4 = (void *)hdr->eth + sizeof(*hdr->eth); in tcp_dissect()
387 if (hdr->ipv4 + 1 > data_end) in tcp_dissect()
389 if (hdr->ipv4->ihl * 4 < sizeof(*hdr->ipv4)) in tcp_dissect()
391 if (hdr->ipv4->version != 4) in tcp_dissect()
394 if (hdr->ipv4->protocol != IPPROTO_TCP) in tcp_dissect()
397 hdr->tcp = (void *)hdr->ipv4 + hdr->ipv4->ihl * 4; in tcp_dissect()
400 hdr->ipv4 = NULL; in tcp_dissect()
440 if (hdr->ipv4) { in tcp_lookup()
444 if ((hdr->ipv4->frag_off & bpf_htons(IP_MF | IP_OFFSET)) != 0) in tcp_lookup()
447 tup.ipv4.saddr = hdr->ipv4->saddr; in tcp_lookup()
448 tup.ipv4.daddr = hdr->ipv4->daddr; in tcp_lookup()
449 tup.ipv4.sport = hdr->tcp->source; in tcp_lookup()
450 tup.ipv4.dport = hdr->tcp->dest; in tcp_lookup()
451 tup_size = sizeof(tup.ipv4); in tcp_lookup()
459 /* The verifier can't track that either ipv4 or ipv6 is not in tcp_lookup()
546 swap(hdr->ipv4->saddr, hdr->ipv4->daddr); in tcpv4_gen_synack()
547 hdr->ipv4->check = 0; /* Calculate checksum later. */ in tcpv4_gen_synack()
548 hdr->ipv4->tos = 0; in tcpv4_gen_synack()
549 hdr->ipv4->id = 0; in tcpv4_gen_synack()
550 hdr->ipv4->ttl = ttl; in tcpv4_gen_synack()
555 hdr->ipv4->tot_len = bpf_htons(sizeof(*hdr->ipv4) + hdr->tcp_len); in tcpv4_gen_synack()
619 if (hdr->ipv4) { in syncookie_handle_syn()
620 /* Check the IPv4 and TCP checksums before creating a SYNACK. */ in syncookie_handle_syn()
621 value = bpf_csum_diff(0, 0, (void *)hdr->ipv4, hdr->ipv4->ihl * 4, 0); in syncookie_handle_syn()
625 return XDP_DROP; /* Bad IPv4 checksum. */ in syncookie_handle_syn()
630 if (csum_tcpudp_magic(hdr->ipv4->saddr, hdr->ipv4->daddr, in syncookie_handle_syn()
634 ip_len = sizeof(*hdr->ipv4); in syncookie_handle_syn()
636 value = bpf_tcp_raw_gen_syncookie_ipv4(hdr->ipv4, hdr->tcp, in syncookie_handle_syn()
670 if (hdr->ipv4) { in syncookie_handle_syn()
671 if (hdr->ipv4->ihl * 4 > sizeof(*hdr->ipv4)) { in syncookie_handle_syn()
674 new_tcp_header = data + sizeof(*hdr->eth) + sizeof(*hdr->ipv4); in syncookie_handle_syn()
678 hdr->ipv4->ihl = sizeof(*hdr->ipv4) / 4; in syncookie_handle_syn()
693 if (hdr->ipv4) { in syncookie_handle_syn()
694 hdr->tcp->check = csum_tcpudp_magic(hdr->ipv4->saddr, in syncookie_handle_syn()
695 hdr->ipv4->daddr, in syncookie_handle_syn()
700 hdr->ipv4->check = 0; in syncookie_handle_syn()
701 value = bpf_csum_diff(0, 0, (void *)hdr->ipv4, sizeof(*hdr->ipv4), 0); in syncookie_handle_syn()
704 hdr->ipv4->check = csum_fold(value); in syncookie_handle_syn()
738 if (hdr->ipv4) in syncookie_handle_ack()
739 err = bpf_tcp_raw_check_syncookie_ipv4(hdr->ipv4, hdr->tcp); in syncookie_handle_ack()
790 if (hdr->ipv4) { in syncookie_part2()
792 hdr->ipv4 = (void *)hdr->eth + sizeof(*hdr->eth); in syncookie_part2()
796 if ((void *)hdr->ipv4 + IPV4_MAXLEN > data_end) in syncookie_part2()
798 hdr->tcp = (void *)hdr->ipv4 + hdr->ipv4->ihl * 4; in syncookie_part2()