mirror of
https://github.com/openvswitch/ovs
synced 2025-09-02 07:15:17 +00:00
flow: fix udp checksum
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> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -3023,6 +3023,9 @@ flow_compose_l4_csum(struct dp_packet *p, const struct flow *flow,
|
|||||||
udp->udp_csum = 0;
|
udp->udp_csum = 0;
|
||||||
udp->udp_csum = csum_finish(csum_continue(pseudo_hdr_csum,
|
udp->udp_csum = csum_finish(csum_continue(pseudo_hdr_csum,
|
||||||
udp, l4_len));
|
udp, l4_len));
|
||||||
|
if (!udp->udp_csum) {
|
||||||
|
udp->udp_csum = htons(0xffff);
|
||||||
|
}
|
||||||
} else if (flow->nw_proto == IPPROTO_ICMP) {
|
} else if (flow->nw_proto == IPPROTO_ICMP) {
|
||||||
struct icmp_header *icmp = dp_packet_l4(p);
|
struct icmp_header *icmp = dp_packet_l4(p);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user