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 <[email protected]> --- AUTHORS | 1 + lib/flow.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 11ccf87..c59d500 100644 --- a/AUTHORS +++ b/AUTHORS @@ -43,6 +43,7 @@ Keith Amidon [email protected] Leo Alterman [email protected] Luca Giraudo [email protected] Martin Casado [email protected] +Mehak Mahajan [email protected] Natasha Gude [email protected] Neil McKee [email protected] Paul Fazzone [email protected] diff --git a/lib/flow.c b/lib/flow.c index 6129703..bc88718 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -33,6 +33,7 @@ #include "packets.h" #include "unaligned.h" #include "vlog.h" +#include "csum.h" VLOG_DEFINE_THIS_MODULE(flow); @@ -1009,8 +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 - * are just zeroed.) */ + * valid. There are lots of fields that are just zeroed. */ void flow_compose(struct ofpbuf *b, const struct flow *flow) { @@ -1067,6 +1067,7 @@ flow_compose(struct ofpbuf *b, const struct flow *flow) ip->ip_tot_len = htons((uint8_t *) b->data + b->size - (uint8_t *) b->l3); + ip->ip_csum = csum(ip, IP_IHL(ip->ip_ihl_ver) * 4); } else if (flow->dl_type == htons(ETH_TYPE_IPV6)) { /* XXX */ } else if (flow->dl_type == htons(ETH_TYPE_ARP)) { -- 1.7.2.5 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
