Bugzilla – Bug 1556
Error uses of htonl making OpenFlow‘s match field error.
Last modified: 2013-03-06 09:46:20 EST
Created attachment 1488 [details] path file,see this file for detail In function OpenFlowSwitchNetDevice::BufferFromPacket() of file openflow-switch-netdevice.cc, udp_h->udp_src = htonl (udp_hd.GetSourcePort ()) uses htonl to convert source port from network order to host order, the field udp_src is defined as uint16_t, however. Using htonl will always make the value of udp_h->udp_src to be zero in little-endian machine. The correct function should be htons().
+1, however... A few lines above there is the very same error about TCP: tcp_h->tcp_src = htonl (tcp_hd.GetSourcePort ()); // Source Port tcp_h->tcp_dst = htonl (tcp_hd.GetDestinationPort ()); // Destination Port I can't be sure if the same issue isn't elsewhere as well. T.
yeah, the same process should be done for the tcp lines tcp_h->tcp_src = htonl (tcp_hd.GetSourcePort ()); // Source Port tcp_h->tcp_dst = htonl (tcp_hd.GetDestinationPort ()); // Destination Apologize for forgetting it.
Created attachment 1493 [details] Patch fixing htons for TCP and UDP ports This patch fixes both TCP and UDP ports wrong htonl calls.
+1
I believe that once the openflow repo is updated, this patch can be applied to it. See bug 1456.
Fixed in changeset 9249 - 93d61b00eb6f