Skip to content

Commit

Permalink
flow: fix udp checksum
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
lrq-max authored and blp committed Jan 25, 2019
1 parent 2525148 commit 7a17a07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 7a17a07

Please sign in to comment.