Adding checksum to ICMP packets created by OVS for testing.
authorMehak Mahajan <mmahajan@nicira.com>
Tue, 7 Aug 2012 19:40:23 +0000 (12:40 -0700)
committerMehak Mahajan <mmahajan@nicira.com>
Tue, 7 Aug 2012 19:40:23 +0000 (12:40 -0700)
OVS provides a utility to create ICMP packets for the purpose of
testing using ovs-appctl netdev-dummy/receive.  These packets created
by flow_compose() earlier did not have the ICMP checksum in them.
With this commit, the checksum will be added to these test ICMP
packets.

Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
lib/flow.c

index 59158ac08430736d2d59c12b1e30318e922b38b0..5d2f33ca6ce0c01fe3d271a5ba5d9c55100d230c 100644 (file)
@@ -1066,6 +1066,7 @@ flow_compose(struct ofpbuf *b, const struct flow *flow)
                 b->l4 = icmp = ofpbuf_put_zeros(b, sizeof *icmp);
                 icmp->icmp_type = ntohs(flow->tp_src);
                 icmp->icmp_code = ntohs(flow->tp_dst);
+                icmp->icmp_csum = csum(icmp, ICMP_HEADER_LEN);
             }
         }