openflow: Fix endian issues in flow expiration messages
authorJustin Pettit <jpettit@nicira.com>
Thu, 29 Oct 2009 00:15:57 +0000 (17:15 -0700)
committerJustin Pettit <jpettit@nicira.com>
Thu, 29 Oct 2009 00:15:57 +0000 (17:15 -0700)
A few of the fields in the OpenFlow flow expiration message were being
sent in host-byte order.  This properly converts them to network.

Thanks to David Erickson for catching this!

secchan/ofproto.c

index 62a37bf..7fb0c64 100644 (file)
@@ -3206,9 +3206,9 @@ compose_flow_exp(const struct rule *rule, long long int now, uint8_t reason)
     flow_to_match(&rule->cr.flow, rule->cr.wc.wildcards, &ofe->match);
     ofe->priority = htons(rule->cr.priority);
     ofe->reason = reason;
-    ofe->duration = (now - rule->created) / 1000;
-    ofe->packet_count = rule->packet_count;
-    ofe->byte_count = rule->byte_count;
+    ofe->duration = htonl((now - rule->created) / 1000);
+    ofe->packet_count = htonll(rule->packet_count);
+    ofe->byte_count = htonll(rule->byte_count);
 
     return buf;
 }