| Message ID | 1548414513-4416-1-git-send-email-lirongqing@baidu.com |
|---|---|
| State | Accepted |
| Headers | show |
| Series | [ovs-dev] flow: fix udp checksum | expand |
On Fri, Jan 25, 2019 at 07:08:33PM +0800, Li RongQing wrote: > As per RFC 768, if the calculated UDP checksum is 0, it should be > instead set as 0xFFFF in the frame. A value of 0 in the checksum > field indicates to the receiver that no checksum was calculated > and hence it should not verify the checksum. > > Signed-off-by: Li RongQing <lirongqing@baidu.com> Thanks, applied to master.
diff --git a/lib/flow.c b/lib/flow.c index c60446ff4..c6e47781b 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -3023,6 +3023,9 @@ flow_compose_l4_csum(struct dp_packet *p, const struct flow *flow, udp->udp_csum = 0; udp->udp_csum = csum_finish(csum_continue(pseudo_hdr_csum, udp, l4_len)); + if (!udp->udp_csum) { + udp->udp_csum = htons(0xffff); + } } else if (flow->nw_proto == IPPROTO_ICMP) { struct icmp_header *icmp = dp_packet_l4(p);
As per RFC 768, if the calculated UDP checksum is 0, it should be instead set as 0xFFFF in the frame. A value of 0 in the checksum field indicates to the receiver that no checksum was calculated and hence it should not verify the checksum. Signed-off-by: Li RongQing <lirongqing@baidu.com> --- lib/flow.c | 3 +++ 1 file changed, 3 insertions(+)