From dc5a7ce79de0d746a4f4af1a127249f90b797002 Mon Sep 17 00:00:00 2001 From: Mehak Mahajan Date: Thu, 2 Aug 2012 16:11:58 -0700 Subject: [PATCH] Adding checksum to IP packets created by ovs for testing. OVS provides a utility to create IP packets for the purpose of testing using ovs-appctl netdev-dummy/receive. These packets created by flow_compose() earlier did not have the IP checksum in them. With this commit, the checksum with be added to these test IP packets. Signed-off-by: Mehak Mahajan --- AUTHORS | 1 + lib/flow.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 11ccf8768..c59d50000 100644 --- a/AUTHORS +++ b/AUTHORS @@ -43,6 +43,7 @@ Keith Amidon keith@nicira.com Leo Alterman lalterman@nicira.com Luca Giraudo lgiraudo@nicira.com Martin Casado casado@nicira.com +Mehak Mahajan mmahajan@nicira.com Natasha Gude natasha@nicira.com Neil McKee neil.mckee@inmon.com Paul Fazzone pfazzone@nicira.com diff --git a/lib/flow.c b/lib/flow.c index 59b5fb7d4..1781ed3c1 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -26,6 +26,7 @@ #include #include "byte-order.h" #include "coverage.h" +#include "csum.h" #include "dynamic-string.h" #include "hash.h" #include "ofpbuf.h" @@ -1009,7 +1010,7 @@ flow_set_vlan_pcp(struct flow *flow, uint8_t pcp) * 'flow'. * * (This is useful only for testing, obviously, and the packet isn't really - * valid. It hasn't got any checksums filled in, for one, and lots of fields + * valid. It hasn't got some checksums filled in, for one, and lots of fields * are just zeroed.) */ void flow_compose(struct ofpbuf *b, const struct flow *flow) @@ -1068,6 +1069,7 @@ flow_compose(struct ofpbuf *b, const struct flow *flow) ip = b->l3; ip->ip_tot_len = htons((uint8_t *) b->data + b->size - (uint8_t *) b->l3); + ip->ip_csum = csum(ip, sizeof *ip); } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) { /* XXX */ } else if (flow->dl_type == htons(ETH_TYPE_ARP)) { -- 2.43.0