Lines Matching full:ipv4
347 struct iphdr *ipv4; member
364 hdr->ipv4 = (void *)hdr->eth + sizeof(*hdr->eth); in tcp_dissect()
365 if (hdr->ipv4 + 1 > data_end) in tcp_dissect()
367 if (hdr->ipv4->ihl * 4 < sizeof(*hdr->ipv4)) in tcp_dissect()
369 if (hdr->ipv4->version != 4) in tcp_dissect()
372 if (hdr->ipv4->protocol != IPPROTO_TCP) in tcp_dissect()
375 hdr->tcp = (void *)hdr->ipv4 + hdr->ipv4->ihl * 4; in tcp_dissect()
378 hdr->ipv4 = NULL; in tcp_dissect()
418 if (hdr->ipv4) { in tcp_lookup()
422 if ((hdr->ipv4->frag_off & bpf_htons(IP_DF | IP_MF | IP_OFFSET)) != bpf_htons(IP_DF)) in tcp_lookup()
425 tup.ipv4.saddr = hdr->ipv4->saddr; in tcp_lookup()
426 tup.ipv4.daddr = hdr->ipv4->daddr; in tcp_lookup()
427 tup.ipv4.sport = hdr->tcp->source; in tcp_lookup()
428 tup.ipv4.dport = hdr->tcp->dest; in tcp_lookup()
429 tup_size = sizeof(tup.ipv4); in tcp_lookup()
437 /* The verifier can't track that either ipv4 or ipv6 is not in tcp_lookup()
524 swap(hdr->ipv4->saddr, hdr->ipv4->daddr); in tcpv4_gen_synack()
525 hdr->ipv4->check = 0; /* Calculate checksum later. */ in tcpv4_gen_synack()
526 hdr->ipv4->tos = 0; in tcpv4_gen_synack()
527 hdr->ipv4->id = 0; in tcpv4_gen_synack()
528 hdr->ipv4->ttl = ttl; in tcpv4_gen_synack()
533 hdr->ipv4->tot_len = bpf_htons(sizeof(*hdr->ipv4) + hdr->tcp_len); in tcpv4_gen_synack()
597 if (hdr->ipv4) { in syncookie_handle_syn()
598 /* Check the IPv4 and TCP checksums before creating a SYNACK. */ in syncookie_handle_syn()
599 value = bpf_csum_diff(0, 0, (void *)hdr->ipv4, hdr->ipv4->ihl * 4, 0); in syncookie_handle_syn()
603 return XDP_DROP; /* Bad IPv4 checksum. */ in syncookie_handle_syn()
608 if (csum_tcpudp_magic(hdr->ipv4->saddr, hdr->ipv4->daddr, in syncookie_handle_syn()
612 ip_len = sizeof(*hdr->ipv4); in syncookie_handle_syn()
614 value = bpf_tcp_raw_gen_syncookie_ipv4(hdr->ipv4, hdr->tcp, in syncookie_handle_syn()
648 if (hdr->ipv4) { in syncookie_handle_syn()
649 if (hdr->ipv4->ihl * 4 > sizeof(*hdr->ipv4)) { in syncookie_handle_syn()
652 new_tcp_header = data + sizeof(*hdr->eth) + sizeof(*hdr->ipv4); in syncookie_handle_syn()
656 hdr->ipv4->ihl = sizeof(*hdr->ipv4) / 4; in syncookie_handle_syn()
671 if (hdr->ipv4) { in syncookie_handle_syn()
672 hdr->tcp->check = csum_tcpudp_magic(hdr->ipv4->saddr, in syncookie_handle_syn()
673 hdr->ipv4->daddr, in syncookie_handle_syn()
678 hdr->ipv4->check = 0; in syncookie_handle_syn()
679 value = bpf_csum_diff(0, 0, (void *)hdr->ipv4, sizeof(*hdr->ipv4), 0); in syncookie_handle_syn()
682 hdr->ipv4->check = csum_fold(value); in syncookie_handle_syn()
716 if (hdr->ipv4) in syncookie_handle_ack()
717 err = bpf_tcp_raw_check_syncookie_ipv4(hdr->ipv4, hdr->tcp); in syncookie_handle_ack()
768 if (hdr->ipv4) { in syncookie_part2()
770 hdr->ipv4 = (void *)hdr->eth + sizeof(*hdr->eth); in syncookie_part2()
774 if ((void *)hdr->ipv4 + IPV4_MAXLEN > data_end) in syncookie_part2()
776 hdr->tcp = (void *)hdr->ipv4 + hdr->ipv4->ihl * 4; in syncookie_part2()