]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-olsr.c
Fix warnings when building for 32-bit and defining _TIME_BITS=64
[tcpdump] / print-olsr.c
index d6e40927938588f7df26f3a0a8919300dd6c6802..27e8872105f036e95ce78f36715ca9d0d9b9eace 100644 (file)
@@ -294,10 +294,7 @@ olsr_print_neighbor(netdissect_options *ndo,
     neighbor = 1;
 
     while (hello_len >= sizeof(nd_ipv4)) {
-
-        ND_TCHECK_LEN(msg_data, sizeof(nd_ipv4));
         /* print 4 neighbors per line */
-
         ND_PRINT("%s%s", GET_IPADDR_STRING(msg_data),
                neighbor % 4 == 0 ? "\n\t\t" : " ");
 
@@ -305,8 +302,6 @@ olsr_print_neighbor(netdissect_options *ndo,
         hello_len -= sizeof(nd_ipv4);
     }
     return (0);
-trunc:
-    return -1;
 }
 
 
@@ -333,6 +328,9 @@ olsr_print(netdissect_options *ndo,
     ndo->ndo_protocol = "olsr";
     tptr = pptr;
 
+    nd_print_protocol_caps(ndo);
+    ND_PRINT("v%u", (is_ipv6) ? 6 : 4);
+
     if (length < sizeof(struct olsr_common)) {
         goto trunc;
     }
@@ -342,8 +340,7 @@ olsr_print(netdissect_options *ndo,
     ptr.common = (const struct olsr_common *)tptr;
     length = ND_MIN(length, GET_BE_U_2(ptr.common->packet_len));
 
-    ND_PRINT("OLSRv%i, seq 0x%04x, length %u",
-            (is_ipv6 == 0) ? 4 : 6,
+    ND_PRINT(", seq 0x%04x, length %u",
             GET_BE_U_2(ptr.common->packet_seq),
             length);
 
@@ -364,8 +361,7 @@ olsr_print(netdissect_options *ndo,
         } msgptr;
         int msg_len_valid = 0;
 
-        if (is_ipv6)
-        {
+        if (is_ipv6) {
             ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg6));
             msgptr.v6 = (const struct olsr_msg6 *) tptr;
             msg_type = GET_U_1(msgptr.v6->msg_type);
@@ -394,9 +390,7 @@ olsr_print(netdissect_options *ndo,
 
             msg_tlen = msg_len - sizeof(struct olsr_msg6);
             msg_data = tptr + sizeof(struct olsr_msg6);
-        }
-        else /* (!is_ipv6) */
-        {
+        } else {       /* (!is_ipv6) */
             ND_TCHECK_LEN(tptr, sizeof(struct olsr_msg4));
             msgptr.v4 = (const struct olsr_msg4 *) tptr;
             msg_type = GET_U_1(msgptr.v4->msg_type);
@@ -537,8 +531,7 @@ olsr_print(netdissect_options *ndo,
         }
 
         case OLSR_HNA_MSG:
-            if (is_ipv6)
-            {
+            if (is_ipv6) {
                 int i = 0;
 
                 ND_PRINT("\n\t  Advertised networks (total %u)",
@@ -558,9 +551,7 @@ olsr_print(netdissect_options *ndo,
                     msg_data += sizeof(struct olsr_hna6);
                     msg_tlen -= sizeof(struct olsr_hna6);
                 }
-            }
-            else
-            {
+            } else {
                 int col = 0;
 
                 ND_PRINT("\n\t  Advertised networks (total %u)",
@@ -629,7 +620,6 @@ olsr_print(netdissect_options *ndo,
 
             if (msg_tlen < 4)
                 goto trunc;
-            ND_TCHECK_4(msg_data);
 
             name_entries = GET_BE_U_2(msg_data + 2);
             addr_size = 4;
@@ -656,7 +646,6 @@ olsr_print(netdissect_options *ndo,
 
                 if (msg_tlen < 4)
                     break;
-                ND_TCHECK_4(msg_data);
 
                 name_entry_type = GET_BE_U_2(msg_data);
                 name_entry_len = GET_BE_U_2(msg_data + 2);