Lines Matching full:csum
136 /* Needed to calculate csum and parse TCP options. */ in tcp_reload_headers()
161 static __sum16 tcp_v4_csum(struct tcp_syncookie *ctx, __wsum csum) in tcp_v4_csum() argument
164 ctx->tcp->doff * 4, IPPROTO_TCP, csum); in tcp_v4_csum()
167 static __sum16 tcp_v6_csum(struct tcp_syncookie *ctx, __wsum csum) in tcp_v6_csum() argument
170 ctx->tcp->doff * 4, IPPROTO_TCP, csum); in tcp_v6_csum()
175 s64 csum; in tcp_validate_header() local
180 csum = bpf_csum_diff(0, 0, (void *)ctx->tcp, ctx->tcp->doff * 4, 0); in tcp_validate_header()
181 if (csum < 0) in tcp_validate_header()
185 /* check tcp_v4_csum(csum) is 0 if not on lo. */ in tcp_validate_header()
187 csum = bpf_csum_diff(0, 0, (void *)ctx->ipv4, ctx->ipv4->ihl * 4, 0); in tcp_validate_header()
188 if (csum < 0) in tcp_validate_header()
191 if (csum_fold(csum) != 0) in tcp_validate_header()
194 /* check tcp_v6_csum(csum) is 0 if not on lo. */ in tcp_validate_header()
401 s64 csum; in tcp_handle_syn() local
424 csum = bpf_csum_diff(0, 0, (void *)ctx->tcp, ctx->tcp->doff * 4, 0); in tcp_handle_syn()
425 if (csum < 0) in tcp_handle_syn()
430 ctx->tcp->check = tcp_v4_csum(ctx, csum); in tcp_handle_syn()
438 csum = bpf_csum_diff(0, 0, (void *)ctx->ipv4, sizeof(*ctx->ipv4), 0); in tcp_handle_syn()
439 if (csum < 0) in tcp_handle_syn()
442 ctx->ipv4->check = csum_fold(csum); in tcp_handle_syn()
445 ctx->tcp->check = tcp_v6_csum(ctx, csum); in tcp_handle_syn()