]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-olsr.c
DNS: Sync types with IANA
[tcpdump] / print-olsr.c
index e640ee18192d16b607ea2d3ee53c093087e86e25..8f049237167b98f2f1643d40011beea17823171f 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;
     }
@@ -340,10 +338,9 @@ olsr_print(netdissect_options *ndo,
     ND_TCHECK_LEN(tptr, sizeof(struct olsr_common));
 
     ptr.common = (const struct olsr_common *)tptr;
-    length = min(length, GET_BE_U_2(ptr.common->packet_len));
+    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);
 
@@ -629,7 +626,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 +652,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);