PUD: compile fixes for debug defines
authorFerry Huberts <f.huberts@mindef.nl>
Wed, 28 Sep 2011 12:17:49 +0000 (14:17 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Tue, 18 Oct 2011 10:08:27 +0000 (12:08 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/receiver.c
lib/pud/wireformat/include/OlsrdPudWireFormat/wireFormat.h

index dcbaec0..d93fdb8 100644 (file)
@@ -302,9 +302,7 @@ static void txToAllOlsrInterfaces(TimedTxInterface interfaces) {
                                else {
                                        olsr_printf(0, "%s: packet sent to uplink (%d bytes)\n",
                                                        PUD_PLUGIN_ABBR, aligned_size);
-                                       dump_packet((unsigned char *)&txBuffer,
-                                                       (sizeof(txBuffer) -
-                                                        sizeof(txBuffer.msg)) + aligned_size);
+                                       dump_packet((unsigned char *)&txBuffer, txBufferSpaceTaken);
                                }
 #endif
                        }
index 4b1722b..95ce526 100644 (file)
@@ -404,6 +404,26 @@ static inline void setUplinkMessagePadding(UplinkHeader * uplinkHeader,
  * OLSR header
  */
 
+
+/**
+ Determine the size of an OLSR message
+
+ @param ipVersion
+ The IP version
+ @param olsrMessage
+ A pointer to the OLSR message
+ @return
+ The size of the OLSR message
+ */
+static inline unsigned short getOlsrMessageSize(int ipVersion,
+               union olsr_message * olsrMessage) {
+       if (ipVersion == AF_INET) {
+               return ntohs(olsrMessage->v4.olsr_msgsize);
+       }
+
+       return ntohs(olsrMessage->v6.olsr_msgsize);
+}
+
 /**
  Get the originator of an OLSR message