Lines Matching full:ipv4

61 	struct iphdr *ipv4;  member
84 ctx->ipv4 = (struct iphdr *)(ctx->eth + 1); in tcp_load_headers()
86 if (ctx->ipv4 + 1 > ctx->data_end) in tcp_load_headers()
89 if (ctx->ipv4->ihl != sizeof(*ctx->ipv4) / 4) in tcp_load_headers()
92 if (ctx->ipv4->version != 4) in tcp_load_headers()
95 if (ctx->ipv4->protocol != IPPROTO_TCP) in tcp_load_headers()
98 ctx->tcp = (struct tcphdr *)(ctx->ipv4 + 1); in tcp_load_headers()
143 if (ctx->ipv4) { in tcp_reload_headers()
144 ctx->ipv4 = (struct iphdr *)(ctx->eth + 1); in tcp_reload_headers()
146 ctx->tcp = (struct tcphdr *)(ctx->ipv4 + 1); in tcp_reload_headers()
148 ctx->ipv4 = NULL; in tcp_reload_headers()
163 return csum_tcpudp_magic(ctx->ipv4->saddr, ctx->ipv4->daddr, in tcp_v4_csum()
184 if (ctx->ipv4) { in tcp_validate_header()
187 csum = bpf_csum_diff(0, 0, (void *)ctx->ipv4, ctx->ipv4->ihl * 4, 0); in tcp_validate_header()
293 if ((ctx->ipv4 && ctx->attrs.mss != MSS_LOCAL_IPV4) || in tcp_validate_sysctl()
321 if (ctx->ipv4) { in tcp_prepare_cookie()
328 first = (u64)ctx->ipv4->saddr << 32 | ctx->ipv4->daddr; in tcp_prepare_cookie()
428 if (ctx->ipv4) { in tcp_handle_syn()
429 swap(ctx->ipv4->saddr, ctx->ipv4->daddr); in tcp_handle_syn()
432 ctx->ipv4->check = 0; in tcp_handle_syn()
433 ctx->ipv4->tos = 0; in tcp_handle_syn()
434 ctx->ipv4->tot_len = bpf_htons((long)ctx->ptr32 - (long)ctx->ipv4); in tcp_handle_syn()
435 ctx->ipv4->id = 0; in tcp_handle_syn()
436 ctx->ipv4->ttl = 64; in tcp_handle_syn()
438 csum = bpf_csum_diff(0, 0, (void *)ctx->ipv4, sizeof(*ctx->ipv4), 0); in tcp_handle_syn()
442 ctx->ipv4->check = csum_fold(csum); in tcp_handle_syn()
470 if (ctx->ipv4) in tcp_validate_cookie()
471 first = (u64)ctx->ipv4->saddr << 32 | ctx->ipv4->daddr; in tcp_validate_cookie()
489 if (ctx->ipv4) in tcp_validate_cookie()
513 if (ctx->ipv4) { in tcp_handle_ack()
514 tuple.ipv4.saddr = ctx->ipv4->saddr; in tcp_handle_ack()
515 tuple.ipv4.daddr = ctx->ipv4->daddr; in tcp_handle_ack()
516 tuple.ipv4.sport = ctx->tcp->source; in tcp_handle_ack()
517 tuple.ipv4.dport = ctx->tcp->dest; in tcp_handle_ack()
518 tuple_size = sizeof(tuple.ipv4); in tcp_handle_ack()