]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isoclns.c
CI: Add warning exemptions for Sun C (suncc-5.14) on Solaris 10
[tcpdump] / print-isoclns.c
index 44d1aa73709c9da0318d69ec711e5289c95ec094..89598b2d2d3182dc21af085ef5ac68c49744d4af 100644 (file)
@@ -34,9 +34,7 @@
  * IS-IS: ISO 10589
  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include "netdissect-stdinc.h"
 
 #include "gmpls.h"
 #include "oui.h"
 #include "signature.h"
+#include "af.h"
 
 
 /*
  * IS-IS is defined in ISO 10589.  Look there for protocol definitions.
  */
 
-#define SYSTEM_ID_LEN  MAC_ADDR_LEN
+#define SYSTEM_ID_LEN  MAC48_LEN
 #define NODE_ID_LEN     (SYSTEM_ID_LEN+1)
 #define LSP_ID_LEN      (SYSTEM_ID_LEN+2)
 
@@ -207,7 +206,7 @@ static const struct tok esis_option_values[] = {
     { ESIS_OPTION_SECURITY,        "Security" },
     { ESIS_OPTION_ES_CONF_TIME,    "ES Configuration Time" },
     { ESIS_OPTION_PRIORITY,        "Priority" },
-    { ESIS_OPTION_ADDRESS_MASK,    "Addressk Mask" },
+    { ESIS_OPTION_ADDRESS_MASK,    "Address Mask" },
     { ESIS_OPTION_SNPA_MASK,       "SNPA Mask" },
     { 0, NULL }
 };
@@ -612,7 +611,7 @@ static const struct tok isis_lsp_istype_values[] = {
 #define ISIS_PTP_ADJ_INIT 1
 #define ISIS_PTP_ADJ_DOWN 2
 
-static const struct tok isis_ptp_adjancey_values[] = {
+static const struct tok isis_ptp_adjacency_values[] = {
     { ISIS_PTP_ADJ_UP,    "Up" },
     { ISIS_PTP_ADJ_INIT,  "Initializing" },
     { ISIS_PTP_ADJ_DOWN,  "Down" },
@@ -1014,7 +1013,7 @@ clnp_print(netdissect_options *ndo,
                     }
                     tptr+=nsap_offset;
                     tlen-=nsap_offset;
-                    while (tlen > 0) {
+                    while (tlen != 0) {
                             source_address_length=GET_U_1(tptr);
                             if (tlen < source_address_length+1) {
                                     ND_PRINT("\n\t    NSAP address goes past end of option");
@@ -1125,9 +1124,10 @@ clnp_print(netdissect_options *ndo,
 
         default:
             /* dump the PDU specific data */
-            if (length > ND_BYTES_BETWEEN(pptr, optr)) {
+            if (length > ND_BYTES_BETWEEN(optr, pptr)) {
                 ND_PRINT("\n\t  undecoded non-header data, length %u", length-li);
-                print_unknown_data(ndo, pptr, "\n\t  ", length - ND_BYTES_BETWEEN(pptr, optr));
+                print_unknown_data(ndo, pptr, "\n\t  ",
+                                   length - ND_BYTES_BETWEEN(optr, pptr));
             }
         }
 
@@ -1298,10 +1298,10 @@ esis_print(netdissect_options *ndo,
                pptr += netal;
                 li -= netal;
 
-               if (snpal == 6)
+               if (snpal == MAC48_LEN)
                        ND_PRINT("\n\t  SNPA (length: %u): %s",
                               snpal,
-                              GET_ETHERADDR_STRING(snpa));
+                              GET_MAC48_STRING(snpa));
                else
                        ND_PRINT("\n\t  SNPA (length: %u): %s",
                               snpal,
@@ -1325,7 +1325,7 @@ esis_print(netdissect_options *ndo,
 
             ND_PRINT("\n\t  Number of Source Addresses: %u", source_address_number);
 
-            while (source_address_number > 0) {
+            while (source_address_number != 0) {
                 ND_TCHECK_1(pptr);
                if (li < 1) {
                     ND_PRINT(", bad esh/li");
@@ -1418,7 +1418,7 @@ esis_print(netdissect_options *ndo,
                 break;
 
             case ESIS_OPTION_PROTOCOLS:
-                while (opli>0) {
+                while (opli != 0) {
                     ND_PRINT("%s (0x%02x)",
                            tok2str(nlpid_values,
                                    "unknown",
@@ -1465,8 +1465,7 @@ isis_print_mcid(netdissect_options *ndo,
   ND_TCHECK_SIZE(mcid);
   ND_PRINT("ID: %u, Name: ", GET_U_1(mcid->format_id));
 
-  if (nd_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
-      goto trunc;
+  nd_printjnp(ndo, mcid->name, sizeof(mcid->name));
 
   ND_PRINT("\n\t              Lvl: %u", GET_BE_U_2(mcid->revision_lvl));
 
@@ -1488,8 +1487,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
   const struct isis_subtlv_spb_mcid *subtlv_spb_mcid;
   int i;
 
-  while (len > 2)
-  {
+  while (len > 2) {
     stlv_type = GET_U_1(tptr);
     stlv_len  = GET_U_1(tptr + 1);
 
@@ -1509,8 +1507,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
     /* Make sure the entire subTLV is in the captured data */
     ND_TCHECK_LEN(tptr, stlv_len);
 
-    switch (stlv_type)
-    {
+    switch (stlv_type) {
       case ISIS_SUBTLV_SPB_MCID:
       {
        if (stlv_len < ISIS_SUBTLV_SPB_MCID_MIN_LEN)
@@ -1551,8 +1548,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
 
         ND_PRINT("\n\t         Digest: ");
 
-        for(i=1;i<=8; i++)
-        {
+        for(i=1;i<=8; i++) {
             ND_PRINT("%08x ", GET_BE_U_4(tptr));
             if (i%4 == 0 && i != 8)
               ND_PRINT("\n\t                 ");
@@ -1567,8 +1563,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
 
       case ISIS_SUBTLV_SPB_BVID:
       {
-        while (stlv_len != 0)
-        {
+        while (stlv_len != 0) {
           if (stlv_len < 4)
             goto subtlv_too_short;
           ND_PRINT("\n\t           ECT: %08x",
@@ -1620,8 +1615,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
 {
   u_int stlv_type, stlv_len, treecount;
 
-  while (len > 2)
-  {
+  while (len > 2) {
     stlv_type = GET_U_1(tptr);
     stlv_len  = GET_U_1(tptr + 1);
     tptr += 2;
@@ -1639,8 +1633,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
     /* Make sure the entire subTLV is in the captured data */
     ND_TCHECK_LEN(tptr, stlv_len);
 
-    switch (stlv_type)
-    {
+    switch (stlv_type) {
       case ISIS_SUBTLV_SPB_INSTANCE:
           if (stlv_len < ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN)
             goto subtlv_too_short;
@@ -1668,8 +1661,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
           len -= ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN;
           stlv_len -= ISIS_SUBTLV_SPB_INSTANCE_MIN_LEN;
 
-          while (treecount)
-          {
+          while (treecount) {
             if (stlv_len < ISIS_SUBTLV_SPB_INSTANCE_VLAN_TUPLE_LEN)
               goto trunc;
 
@@ -1803,14 +1795,14 @@ isis_print_metric_block(netdissect_options *ndo,
 
 static int
 isis_print_tlv_ip_reach(netdissect_options *ndo,
-                        const uint8_t *cp, const char *ident, u_int length)
+                        const uint8_t *cp, const char *indent, u_int length)
 {
        int prefix_len;
        const struct isis_tlv_ip_reach *tlv_ip_reach;
 
        tlv_ip_reach = (const struct isis_tlv_ip_reach *)cp;
 
-       while (length > 0) {
+       while (length != 0) {
                if ((size_t)length < sizeof(*tlv_ip_reach)) {
                        ND_PRINT("short IPv4 Reachability (%u vs %zu)",
                                length,
@@ -1824,12 +1816,12 @@ isis_print_tlv_ip_reach(netdissect_options *ndo,
 
                if (prefix_len == -1)
                        ND_PRINT("%sIPv4 prefix: %s mask %s",
-                               ident,
+                               indent,
                               GET_IPADDR_STRING(tlv_ip_reach->prefix),
                               GET_IPADDR_STRING(tlv_ip_reach->mask));
                else
                        ND_PRINT("%sIPv4 prefix: %15s/%u",
-                               ident,
+                               indent,
                               GET_IPADDR_STRING(tlv_ip_reach->prefix),
                               prefix_len);
 
@@ -1840,19 +1832,19 @@ isis_print_tlv_ip_reach(netdissect_options *ndo,
 
                if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach->isis_metric_block.metric_delay))
                     ND_PRINT("%s  Delay Metric: %u, %s",
-                           ident,
+                           indent,
                            ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach->isis_metric_block.metric_delay),
                            ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach->isis_metric_block.metric_delay) ? "External" : "Internal");
 
                if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach->isis_metric_block.metric_expense))
                     ND_PRINT("%s  Expense Metric: %u, %s",
-                           ident,
+                           indent,
                            ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach->isis_metric_block.metric_expense),
                            ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach->isis_metric_block.metric_expense) ? "External" : "Internal");
 
                if (!ISIS_LSP_TLV_METRIC_SUPPORTED(tlv_ip_reach->isis_metric_block.metric_error))
                     ND_PRINT("%s  Error Metric: %u, %s",
-                           ident,
+                           indent,
                            ISIS_LSP_TLV_METRIC_VALUE(tlv_ip_reach->isis_metric_block.metric_error),
                            ISIS_LSP_TLV_METRIC_IE(tlv_ip_reach->isis_metric_block.metric_error) ? "External" : "Internal");
 
@@ -1872,11 +1864,11 @@ trunc:
 static int
 isis_print_ip_reach_subtlv(netdissect_options *ndo,
                            const uint8_t *tptr, u_int subt, u_int subl,
-                           const char *ident)
+                           const char *indent)
 {
     /* first lets see if we know the subTLVs name*/
     ND_PRINT("%s%s subTLV #%u, length: %u",
-              ident, tok2str(isis_ext_ip_reach_subtlv_values, "unknown", subt),
+              indent, tok2str(isis_ext_ip_reach_subtlv_values, "unknown", subt),
               subt, subl);
 
     ND_TCHECK_LEN(tptr, subl);
@@ -1949,23 +1941,19 @@ trunc:
 
 static int
 isis_print_ext_is_reach(netdissect_options *ndo,
-                        const uint8_t *tptr, const char *ident, u_int tlv_type,
+                        const uint8_t *tptr, const char *indent, u_int tlv_type,
                         u_int tlv_remaining)
 {
-    char ident_buffer[20];
+    char indent_buffer[20];
     u_int subtlv_type,subtlv_len,subtlv_sum_len;
     int proc_bytes = 0; /* how many bytes did we process ? */
     u_int te_class,priority_level,gmpls_switch_cap;
-    union { /* int to float conversion buffer for several subTLVs */
-        float f;
-        uint32_t i;
-    } bw;
 
     ND_TCHECK_LEN(tptr, NODE_ID_LEN);
     if (tlv_remaining < NODE_ID_LEN)
         return(0);
 
-    ND_PRINT("%sIS Neighbor: %s", ident, isis_print_id(ndo, tptr, NODE_ID_LEN));
+    ND_PRINT("%sIS Neighbor: %s", indent, isis_print_id(ndo, tptr, NODE_ID_LEN));
     tptr+=NODE_ID_LEN;
     tlv_remaining-=NODE_ID_LEN;
     proc_bytes+=NODE_ID_LEN;
@@ -1991,17 +1979,17 @@ isis_print_ext_is_reach(netdissect_options *ndo,
     if (subtlv_sum_len) {
         ND_PRINT(" (%u)", subtlv_sum_len);
         /* prepend the indent string */
-        snprintf(ident_buffer, sizeof(ident_buffer), "%s  ",ident);
-        ident = ident_buffer;
+        snprintf(indent_buffer, sizeof(indent_buffer), "%s  ", indent);
+        indent = indent_buffer;
         while (subtlv_sum_len != 0) {
             ND_TCHECK_2(tptr);
             if (tlv_remaining < 2) {
-                ND_PRINT("%sRemaining data in TLV shorter than a subTLV header",ident);
+                ND_PRINT("%sRemaining data in TLV shorter than a subTLV header", indent);
                 proc_bytes += tlv_remaining;
                 break;
             }
             if (subtlv_sum_len < 2) {
-                ND_PRINT("%sRemaining data in subTLVs shorter than a subTLV header",ident);
+                ND_PRINT("%sRemaining data in subTLVs shorter than a subTLV header", indent);
                 proc_bytes += subtlv_sum_len;
                 break;
             }
@@ -2012,7 +2000,7 @@ isis_print_ext_is_reach(netdissect_options *ndo,
             subtlv_sum_len -= 2;
             proc_bytes += 2;
             ND_PRINT("%s%s subTLV #%u, length: %u",
-                      ident, tok2str(isis_ext_is_reach_subtlv_values, "unknown", subtlv_type),
+                      indent, tok2str(isis_ext_is_reach_subtlv_values, "unknown", subtlv_type),
                       subtlv_type, subtlv_len);
 
             if (subtlv_sum_len < subtlv_len) {
@@ -2046,19 +2034,16 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                 break;
             case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW :
             case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW:
-                if (subtlv_len >= 4) {
-                    bw.i = GET_BE_U_4(tptr);
-                    ND_PRINT(", %.3f Mbps", bw.f * 8 / 1000000);
-                }
+                if (subtlv_len >= 4)
+                    ND_PRINT(", %.3f Mbps", GET_BE_F_4(tptr) * 8 / 1000000);
                 break;
             case ISIS_SUBTLV_EXT_IS_REACH_UNRESERVED_BW :
                 if (subtlv_len >= 32) {
                     for (te_class = 0; te_class < 8; te_class++) {
-                        bw.i = GET_BE_U_4(tptr);
                         ND_PRINT("%s  TE-Class %u: %.3f Mbps",
-                                  ident,
+                                  indent,
                                   te_class,
-                                  bw.f * 8 / 1000000);
+                                  GET_BE_F_4(tptr) * 8 / 1000000);
                         tptr += 4;
                         subtlv_len -= 4;
                         subtlv_sum_len -= 4;
@@ -2071,7 +2056,7 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                 if (subtlv_len == 0)
                     break;
                 ND_PRINT("%sBandwidth Constraints Model ID: %s (%u)",
-                          ident,
+                          indent,
                           tok2str(diffserv_te_bc_values, "unknown", GET_U_1(tptr)),
                           GET_U_1(tptr));
                 tptr++;
@@ -2082,11 +2067,10 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                 for (te_class = 0; subtlv_len != 0; te_class++) {
                     if (subtlv_len < 4)
                         break;
-                    bw.i = GET_BE_U_4(tptr);
                     ND_PRINT("%s  Bandwidth constraint CT%u: %.3f Mbps",
-                              ident,
+                              indent,
                               te_class,
-                              bw.f * 8 / 1000000);
+                              GET_BE_F_4(tptr) * 8 / 1000000);
                     tptr += 4;
                     subtlv_len -= 4;
                     subtlv_sum_len -= 4;
@@ -2132,7 +2116,7 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                 if (subtlv_len >= 36) {
                     gmpls_switch_cap = GET_U_1(tptr);
                     ND_PRINT("%s  Interface Switching Capability:%s",
-                              ident,
+                              indent,
                               tok2str(gmpls_switch_cap_values, "Unknown", gmpls_switch_cap));
                     ND_PRINT(", LSP Encoding: %s",
                               tok2str(gmpls_encoding_values, "Unknown", GET_U_1((tptr + 1))));
@@ -2140,13 +2124,12 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                     subtlv_len -= 4;
                     subtlv_sum_len -= 4;
                     proc_bytes += 4;
-                    ND_PRINT("%s  Max LSP Bandwidth:", ident);
+                    ND_PRINT("%s  Max LSP Bandwidth:", indent);
                     for (priority_level = 0; priority_level < 8; priority_level++) {
-                        bw.i = GET_BE_U_4(tptr);
                         ND_PRINT("%s    priority level %u: %.3f Mbps",
-                                  ident,
+                                  indent,
                                   priority_level,
-                                  bw.f * 8 / 1000000);
+                                  GET_BE_F_4(tptr) * 8 / 1000000);
                         tptr += 4;
                         subtlv_len -= 4;
                         subtlv_sum_len -= 4;
@@ -2159,17 +2142,18 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                     case GMPLS_PSC4:
                         if (subtlv_len < 6)
                             break;
-                        bw.i = GET_BE_U_4(tptr);
-                        ND_PRINT("%s  Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000);
-                        ND_PRINT("%s  Interface MTU: %u", ident,
+                        ND_PRINT("%s  Min LSP Bandwidth: %.3f Mbps",
+                                 indent,
+                                 GET_BE_F_4(tptr) * 8 / 1000000);
+                        ND_PRINT("%s  Interface MTU: %u", indent,
                                  GET_BE_U_2(tptr + 4));
                         break;
                     case GMPLS_TSC:
                         if (subtlv_len < 8)
                             break;
-                        bw.i = GET_BE_U_4(tptr);
-                        ND_PRINT("%s  Min LSP Bandwidth: %.3f Mbps", ident, bw.f * 8 / 1000000);
-                        ND_PRINT("%s  Indication %s", ident,
+                        ND_PRINT("%s  Min LSP Bandwidth: %.3f Mbps", indent,
+                                  GET_BE_F_4(tptr) * 8 / 1000000);
+                        ND_PRINT("%s  Indication %s", indent,
                                   tok2str(gmpls_switch_cap_tsc_indication_values, "Unknown (%u)", GET_U_1((tptr + 4))));
                         break;
                     default:
@@ -2184,7 +2168,7 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                 break;
             case ISIS_SUBTLV_EXT_IS_REACH_LAN_ADJ_SEGMENT_ID:
                 if (subtlv_len >= 8) {
-                    ND_PRINT("%s  Flags: [%s]", ident,
+                    ND_PRINT("%s  Flags: [%s]", indent,
                               bittok2str(isis_lan_adj_sid_flag_values,
                                          "none",
                                          GET_U_1(tptr)));
@@ -2194,14 +2178,14 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                     subtlv_len--;
                     subtlv_sum_len--;
                     proc_bytes++;
-                    ND_PRINT("%s  Weight: %u", ident, GET_U_1(tptr));
+                    ND_PRINT("%s  Weight: %u", indent, GET_U_1(tptr));
                     tptr++;
                     subtlv_len--;
                     subtlv_sum_len--;
                     proc_bytes++;
                     if(subtlv_len>=SYSTEM_ID_LEN) {
                         ND_TCHECK_LEN(tptr, SYSTEM_ID_LEN);
-                        ND_PRINT("%s  Neighbor System-ID: %s", ident,
+                        ND_PRINT("%s  Neighbor System-ID: %s", indent,
                             isis_print_id(ndo, tptr, SYSTEM_ID_LEN));
                     }
                     /* RFC 8667 section 2.2.2 */
@@ -2209,10 +2193,10 @@ isis_print_ext_is_reach(netdissect_options *ndo,
                     /* if V-flag is set to 0 and L-flag is set to 0 ==> 4 octet index */
                     if (vflag && lflag) {
                         ND_PRINT("%s  Label: %u",
-                                  ident, GET_BE_U_3(tptr+SYSTEM_ID_LEN));
+                                  indent, GET_BE_U_3(tptr+SYSTEM_ID_LEN));
                     } else if ((!vflag) && (!lflag)) {
                         ND_PRINT("%s  Index: %u",
-                                  ident, GET_BE_U_4(tptr+SYSTEM_ID_LEN));
+                                  indent, GET_BE_U_4(tptr+SYSTEM_ID_LEN));
                     } else
                         nd_print_invalid(ndo);
                 }
@@ -2242,13 +2226,13 @@ trunc:
 
 static uint8_t
 isis_print_mtid(netdissect_options *ndo,
-                const uint8_t *tptr, const char *ident, u_int tlv_remaining)
+                const uint8_t *tptr, const char *indent, u_int tlv_remaining)
 {
     if (tlv_remaining < 2)
         goto trunc;
 
     ND_PRINT("%s%s",
-           ident,
+           indent,
            tok2str(isis_mt_values,
                    "Reserved for IETF Consensus",
                    ISIS_MASK_MTID(GET_BE_U_2(tptr))));
@@ -2271,9 +2255,9 @@ trunc:
 
 static u_int
 isis_print_extd_ip_reach(netdissect_options *ndo,
-                         const uint8_t *tptr, const char *ident, uint16_t afi)
+                         const uint8_t *tptr, const char *indent, uint16_t afi)
 {
-    char ident_buffer[20];
+    char indent_buffer[20];
     uint8_t prefix[sizeof(nd_ipv6)]; /* shared copy buffer for IPv4 and IPv6 prefixes */
     u_int metric, status_byte, bit_length, byte_length, sublen, processed, subtlvtype, subtlvlen;
 
@@ -2281,23 +2265,23 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
     processed=4;
     tptr+=4;
 
-    if (afi == AF_INET) {
+    if (afi == AFNUM_IP) {
         status_byte=GET_U_1(tptr);
         tptr++;
         bit_length = status_byte&0x3f;
         if (bit_length > 32) {
             ND_PRINT("%sIPv4 prefix: bad bit length %u",
-                   ident,
+                   indent,
                    bit_length);
             return (0);
         }
         processed++;
-    } else if (afi == AF_INET6) {
+    } else if (afi == AFNUM_IP6) {
         status_byte=GET_U_1(tptr);
         bit_length=GET_U_1(tptr + 1);
         if (bit_length > 128) {
             ND_PRINT("%sIPv6 prefix: bad bit length %u",
-                   ident,
+                   indent,
                    bit_length);
             return (0);
         }
@@ -2308,20 +2292,19 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
 
     byte_length = (bit_length + 7) / 8; /* prefix has variable length encoding */
 
-    ND_TCHECK_LEN(tptr, byte_length);
     memset(prefix, 0, sizeof(prefix));   /* clear the copy buffer */
-    memcpy(prefix,tptr,byte_length);    /* copy as much as is stored in the TLV */
+    GET_CPY_BYTES(prefix,tptr,byte_length);    /* copy as much as is stored in the TLV */
     tptr+=byte_length;
     processed+=byte_length;
 
-    if (afi == AF_INET)
+    if (afi == AFNUM_IP)
         ND_PRINT("%sIPv4 prefix: %15s/%u",
-               ident,
+               indent,
                ipaddr_string(ndo, prefix), /* local buffer, not packet data; don't use GET_IPADDR_STRING() */
                bit_length);
-    else if (afi == AF_INET6)
+    else if (afi == AFNUM_IP6)
         ND_PRINT("%sIPv6 prefix: %s/%u",
-               ident,
+               indent,
                ip6addr_string(ndo, prefix), /* local buffer, not packet data; don't use GET_IP6ADDR_STRING() */
                bit_length);
 
@@ -2329,15 +2312,15 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
            ISIS_MASK_TLV_EXTD_IP_UPDOWN(status_byte) ? "down" : "up",
            metric);
 
-    if (afi == AF_INET && ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte))
+    if (afi == AFNUM_IP && ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte))
         ND_PRINT(", sub-TLVs present");
-    else if (afi == AF_INET6)
+    else if (afi == AFNUM_IP6)
         ND_PRINT(", %s%s",
                ISIS_MASK_TLV_EXTD_IP6_IE(status_byte) ? "External" : "Internal",
                ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte) ? ", sub-TLVs present" : "");
 
-    if ((afi == AF_INET  && ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte))
-     || (afi == AF_INET6 && ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte))
+    if ((afi == AFNUM_IP  && ISIS_MASK_TLV_EXTD_IP_SUBTLV(status_byte))
+     || (afi == AFNUM_IP6 && ISIS_MASK_TLV_EXTD_IP6_SUBTLV(status_byte))
             ) {
         /* assume that one prefix can hold more
            than one subTLV - therefore the first byte must reflect
@@ -2348,21 +2331,19 @@ isis_print_extd_ip_reach(netdissect_options *ndo,
         processed+=sublen+1;
         ND_PRINT(" (%u)", sublen);   /* print out subTLV length */
 
-        while (sublen>0) {
+        while (sublen != 0) {
             subtlvtype=GET_U_1(tptr);
             subtlvlen=GET_U_1(tptr + 1);
             tptr+=2;
             /* prepend the indent string */
-            snprintf(ident_buffer, sizeof(ident_buffer), "%s  ",ident);
-            if (!isis_print_ip_reach_subtlv(ndo, tptr, subtlvtype, subtlvlen, ident_buffer))
+            snprintf(indent_buffer, sizeof(indent_buffer), "%s  ", indent);
+            if (!isis_print_ip_reach_subtlv(ndo, tptr, subtlvtype, subtlvlen, indent_buffer))
                 return(0);
             tptr+=subtlvlen;
             sublen-=(subtlvlen+2);
         }
     }
     return (processed);
-trunc:
-    return 0;
 }
 
 static void
@@ -2858,7 +2839,7 @@ isis_print(netdissect_options *ndo,
      * Now print the TLV's.
      */
 
-    while (packet_len > 0) {
+    while (packet_len != 0) {
        ND_TCHECK_2(pptr);
        if (packet_len < 2)
            goto trunc;
@@ -2898,12 +2879,12 @@ isis_print(netdissect_options *ndo,
            break;
        case ISIS_TLV_ISNEIGH:
            while (tlen != 0) {
-               if (tlen < MAC_ADDR_LEN)
+               if (tlen < MAC48_LEN)
                    goto tlv_trunc;
-                ND_TCHECK_LEN(tptr, MAC_ADDR_LEN);
-                ND_PRINT("\n\t      SNPA: %s", isis_print_id(ndo, tptr, MAC_ADDR_LEN));
-                tlen -= MAC_ADDR_LEN;
-                tptr += MAC_ADDR_LEN;
+                ND_TCHECK_LEN(tptr, MAC48_LEN);
+                ND_PRINT("\n\t      SNPA: %s", isis_print_id(ndo, tptr, MAC48_LEN));
+                tlen -= MAC48_LEN;
+                tptr += MAC48_LEN;
            }
            break;
 
@@ -3023,7 +3004,7 @@ isis_print(netdissect_options *ndo,
 
        case ISIS_TLV_EXTD_IP_REACH:
            while (tlen != 0) {
-                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET);
+                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AFNUM_IP);
                 if (ext_ip_len == 0) /* did something go wrong ? */
                     goto trunc;
                 if (tlen < ext_ip_len) {
@@ -3045,7 +3026,7 @@ isis_print(netdissect_options *ndo,
             tlen-=mt_len;
 
             while (tlen != 0) {
-                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET);
+                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AFNUM_IP);
                 if (ext_ip_len == 0) /* did something go wrong ? */
                     goto trunc;
                 if (tlen < ext_ip_len) {
@@ -3060,7 +3041,7 @@ isis_print(netdissect_options *ndo,
 
        case ISIS_TLV_IP6_REACH:
             while (tlen != 0) {
-                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET6);
+                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AFNUM_IP6);
                 if (ext_ip_len == 0) /* did something go wrong ? */
                     goto trunc;
                 if (tlen < ext_ip_len) {
@@ -3082,7 +3063,7 @@ isis_print(netdissect_options *ndo,
             tlen-=mt_len;
 
             while (tlen != 0) {
-                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET6);
+                ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AFNUM_IP6);
                 if (ext_ip_len == 0) /* did something go wrong ? */
                     goto trunc;
                 if (tlen < ext_ip_len) {
@@ -3120,8 +3101,7 @@ isis_print(netdissect_options *ndo,
 
            switch (auth_type) {
            case ISIS_SUBTLV_AUTH_SIMPLE:
-               if (nd_printzp(ndo, tptr, tlen, ndo->ndo_snapend))
-                   goto trunc;
+               nd_printjnp(ndo, tptr, tlen);
                break;
            case ISIS_SUBTLV_AUTH_MD5:
                for(i=0;i<tlen;i++) {
@@ -3159,7 +3139,7 @@ isis_print(netdissect_options *ndo,
            tlv_ptp_adj = (const struct isis_tlv_ptp_adj *)tptr;
            if(tlen>=1) {
                ND_PRINT("\n\t      Adjacency State: %s (%u)",
-                      tok2str(isis_ptp_adjancey_values, "unknown", GET_U_1(tptr)),
+                      tok2str(isis_ptp_adjacency_values, "unknown", GET_U_1(tptr)),
                       GET_U_1(tptr));
                tlen--;
            }
@@ -3248,8 +3228,7 @@ isis_print(netdissect_options *ndo,
 
        case ISIS_TLV_HOSTNAME:
            ND_PRINT("\n\t      Hostname: ");
-           if (nd_printzp(ndo, tptr, tlen, ndo->ndo_snapend))
-               goto trunc;
+           nd_printjnp(ndo, tptr, tlen);
            break;
 
        case ISIS_TLV_SHARED_RISK_GROUP: