sflow: Fix byte order problem.
authorBen Pfaff <blp@nicira.com>
Mon, 11 Jan 2010 19:10:24 +0000 (11:10 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 11 Jan 2010 19:11:40 +0000 (11:11 -0800)
Reported by Justin Pettit.

ofproto/ofproto-sflow.c

index 208ad8c765762831108ba8fbfbec1aa1ce768201..1ad252302ef9745a4ef372194472cdacc55c7f3e 100644 (file)
@@ -519,7 +519,7 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg)
     /* Add extended switch element. */
     memset(&switchElem, 0, sizeof(switchElem));
     switchElem.tag = SFLFLOW_EX_SWITCH;
-    switchElem.flowType.sw.src_vlan = flow.dl_vlan;
+    switchElem.flowType.sw.src_vlan = ntohs(flow.dl_vlan);
     switchElem.flowType.sw.src_priority = -1; /* XXX */
     switchElem.flowType.sw.dst_vlan = -1;     /* Filled in correctly below. */
     switchElem.flowType.sw.dst_priority = switchElem.flowType.sw.src_priority;
@@ -542,7 +542,7 @@ ofproto_sflow_received(struct ofproto_sflow *os, struct odp_msg *msg)
             break;
 
         case ODPAT_SET_VLAN_VID:
-            switchElem.flowType.sw.dst_vlan = a->vlan_vid.vlan_vid;
+            switchElem.flowType.sw.dst_vlan = ntohs(a->vlan_vid.vlan_vid);
             break;
 
         case ODPAT_SET_VLAN_PCP: