Closed bigclouds closed 4 months ago
@tohojo Hi, length parameter of bpf_csum_diff must be a multiple of 4. this patch is a hint to tell all things people have to do to make it work and verify. But It is easier to verify udp(nc -l -u) than tcp,because reply packets are not handled, for tcp nothing can be seen.
ylg @.***> writes:
@tohojo Hi, length parameter of bpf_csum_diff must be a multiple of 4, so in this case it does not matter much.
No, my point was that you don't need to use bpf_csum_diff() at all, you can just directly update the checksum value (see RFC1071).
Something like:
udphdr->check += bpf_htons(1); if (!udphdr->check) udphdr->check += bpf_htons(1); / overflow, add carry /
this patch is a hint to tell all things people have to do to make it work and verify. But It is easier to verify udp(nc -l -u) than tcp,because reply packets are not handled.
Right, so the end-to-end connection is not going to work anyway for TCP, you mean? Doesn't mean we can't still add the checksum update, it's literally the same code :)
-Toke
ylg @.**> writes: @tohojo Hi, length parameter of bpf_csum_diff must be a multiple of 4, so in this case it does not matter much. No, my point was that you don't need to use bpf_csum_diff() at all, you can just directly update the checksum value (see RFC1071). Something like: udphdr->check += bpf_htons(1); if (!udphdr->check) udphdr->check += bpf_htons(1); / overflow, add carry */ clever code. I keep old codes as commits because bpf_csum_diff is normally used.
this patch is a hint to tell all things people have to do to make it work and verify. But It is easier to verify udp(nc -l -u) than tcp,because reply packets are not handled. Right, so the end-to-end connection is not going to work anyway for TCP, you mean? Doesn't mean we can't still add the checksum update, it's literally the same code :) … -Toke Right. Done.
ylg @.**> writes: @tohojo Hi, length parameter of bpf_csum_diff must be a multiple of 4, so in this case it does not matter much. No, my point was that you don't need to use bpf_csum_diff() at all, you can just directly update the checksum value (see RFC1071). Something like: udphdr->check += bpf_htons(1); if (!udphdr->check) udphdr->check += bpf_htons(1); / overflow, add carry */ clever code. I keep old codes as commits because bpf_csum_diff is normally used.
this patch is a hint to tell all things people have to do to make it work and verify. But It is easier to verify udp(nc -l -u) than tcp,because reply packets are not handled. Right, so the end-to-end connection is not going to work anyway for TCP, you mean? Doesn't mean we can't still add the checksum update, it's literally the same code :) … -Toke Right. Done.
complete udp checksum so as for udp server to receive packets.