PUD: the downlink port is in network byte order
[olsrd.git] / lib / pud / wireformat-java / src / main / c / org_olsr_plugin_pud_ClusterLeader.c
index ed449bf..6d6924f 100644 (file)
@@ -1,5 +1,6 @@
 #include "org_olsr_plugin_pud_ClusterLeader.h"
 #include "util.h"
+#include <arpa/inet.h>
 
 /*
  * Class:     org_olsr_plugin_pud_ClusterLeader
@@ -53,8 +54,8 @@ JNIEXPORT jint JNICALL Java_org_olsr_plugin_pud_ClusterLeader_getClusterLeaderDo
        UplinkMessage * uplinkMessage = getUplinkMessage(env, this, &dataObject,
                        &isCopy);
 
-       unsigned short downlinkPort = getClusterLeaderDownlinkPort(
-                       getClusterLeaderMessage(uplinkMessage));
+       unsigned short downlinkPort = ntohs(getClusterLeaderDownlinkPort(
+                       getClusterLeaderMessage(uplinkMessage)));
 
        releaseUplinkMessage(env, uplinkMessage, dataObject, isCopy, JNI_ABORT);