]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isoclns.c
UDP: Add two missing return
[tcpdump] / print-isoclns.c
index 15d6cd7cd8908fd2147848823d4de382eba87f35..246b681b0ea3b3d375d2837ac154adf06bba27a1 100644 (file)
@@ -50,7 +50,6 @@
 #include "oui.h"
 #include "signature.h"
 
-static const char tstr[] = " [|isis]";
 
 /*
  * IS-IS is defined in ISO 10589.  Look there for protocol definitions.
@@ -679,10 +678,8 @@ struct isis_tlv_lsp {
 void
 isoclns_print(netdissect_options *ndo, const u_char *p, u_int length)
 {
-       if (!ND_TTEST_1(p)) { /* enough bytes on the wire ? */
-               ND_PRINT("|OSI");
-               return;
-       }
+       ndo->ndo_protocol = "isoclns";
+       ND_TCHECK_1(p); /* enough bytes on the wire ? */
 
        if (ndo->ndo_eflag)
                ND_PRINT("OSI NLPID %s (0x%02x): ", tok2str(nlpid_values, "Unknown", EXTRACT_U_1(p)), EXTRACT_U_1(p));
@@ -731,6 +728,9 @@ isoclns_print(netdissect_options *ndo, const u_char *p, u_int length)
                        print_unknown_data(ndo, p, "\n\t", length);
                break;
        }
+       return;
+trunc:
+       nd_print_trunc(ndo);
 }
 
 #define        CLNP_PDU_ER      1
@@ -779,6 +779,7 @@ clnp_print(netdissect_options *ndo,
        const struct clnp_segment_header_t *clnp_segment_header;
         uint8_t rfd_error,rfd_error_major,rfd_error_minor;
 
+       ndo->ndo_protocol = "clnp";
        clnp_header = (const struct clnp_header_t *) pptr;
         ND_TCHECK_SIZE(clnp_header);
 
@@ -1072,7 +1073,7 @@ clnp_print(netdissect_options *ndo,
         return (1);
 
  trunc:
-    ND_PRINT("[|clnp]");
+    nd_print_trunc(ndo);
     return (1);
 
 }
@@ -1107,6 +1108,7 @@ esis_print(netdissect_options *ndo,
        u_int li, version, esis_pdu_type, source_address_length, source_address_number;
        const struct esis_header_t *esis_header;
 
+       ndo->ndo_protocol = "esis";
        if (!ndo->ndo_eflag)
                ND_PRINT("ES-IS");
 
@@ -1385,7 +1387,7 @@ esis_print(netdissect_options *ndo,
             pptr += opli;
         }
 trunc:
-        ND_PRINT("[|esis]");
+       nd_print_trunc(ndo);
 }
 
 static void
@@ -1397,7 +1399,7 @@ isis_print_mcid(netdissect_options *ndo,
   ND_TCHECK_SIZE(mcid);
   ND_PRINT("ID: %u, Name: ", EXTRACT_U_1(mcid->format_id));
 
-  if (fn_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
+  if (nd_printzp(ndo, mcid->name, 32, ndo->ndo_snapend))
     goto trunc;
 
   ND_PRINT("\n\t              Lvl: %u", EXTRACT_BE_U_2(mcid->revision_lvl));
@@ -1408,7 +1410,7 @@ isis_print_mcid(netdissect_options *ndo,
     ND_PRINT("%.2x ", mcid->digest[i]);
 
 trunc:
-  ND_PRINT("%s", tstr);
+  nd_print_trunc(ndo);
 }
 
 static int
@@ -1529,8 +1531,7 @@ isis_print_mt_port_cap_subtlv(netdissect_options *ndo,
   return 0;
 
   trunc:
-    ND_PRINT("\n\t\t");
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
     return(1);
 }
 
@@ -1658,8 +1659,7 @@ isis_print_mt_capability_subtlv(netdissect_options *ndo,
   return 0;
 
   trunc:
-    ND_PRINT("\n\t\t");
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
     return(1);
 }
 
@@ -1823,8 +1823,7 @@ isis_print_ip_reach_subtlv(netdissect_options *ndo,
     return(1);
 
 trunc:
-    ND_PRINT("%s", ident);
-    ND_PRINT("%s", tstr);
+    nd_print_trunc(ndo);
     return(0);
 }
 
@@ -2269,6 +2268,7 @@ isis_print(netdissect_options *ndo,
     u_int i,vendor_id;
     int sigcheck;
 
+    ndo->ndo_protocol = "isis";
     packet_len=length;
     optr = p; /* initialize the _o_riginal pointer to the packet start -
                  need it for parsing the checksum TLV and authentication
@@ -2678,7 +2678,7 @@ isis_print(netdissect_options *ndo,
 
         case ISIS_TLV_ISNEIGH_VARLEN:
             if (!ND_TTEST_1(tptr) || tmp < 3) /* min. TLV length */
-               goto trunctlv;
+               goto trunc;
            lan_alen = EXTRACT_U_1(tptr); /* LAN address length */
            tptr++;
            if (lan_alen == 0) {
@@ -2701,13 +2701,13 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_MT_IS_REACH:
             mt_len = isis_print_mtid(ndo, tptr, "\n\t      ");
             if (mt_len == 0) /* did something go wrong ? */
-                goto trunctlv;
+                goto trunc;
             tptr+=mt_len;
             tmp-=mt_len;
             while (tmp >= 2+NODE_ID_LEN+3+1) {
                 ext_is_len = isis_print_ext_is_reach(ndo, tptr, "\n\t      ", tlv_type, tmp);
                 if (ext_is_len == 0) /* did something go wrong ? */
-                    goto trunctlv;
+                    goto trunc;
 
                 tmp-=ext_is_len;
                 tptr+=ext_is_len;
@@ -2718,7 +2718,7 @@ isis_print(netdissect_options *ndo,
            while (tmp >= NODE_ID_LEN+1) { /* is it worth attempting a decode ? */
                ext_is_len = isis_print_ext_is_reach(ndo, tptr, "\n\t      ", tlv_type, tmp);
                if (ext_is_len == 0) /* did something go wrong ? */
-                   goto trunctlv;
+                   goto trunc;
                tmp-=ext_is_len;
                tptr+=ext_is_len;
            }
@@ -2728,7 +2728,7 @@ isis_print(netdissect_options *ndo,
             while (tmp >= NODE_ID_LEN+3+1) { /* is it worth attempting a decode ? */
                 ext_is_len = isis_print_ext_is_reach(ndo, tptr, "\n\t      ", tlv_type, tmp);
                 if (ext_is_len == 0) /* did something go wrong ? */
-                    goto trunctlv;
+                    goto trunc;
                 tmp-=ext_is_len;
                 tptr+=ext_is_len;
             }
@@ -2774,7 +2774,7 @@ isis_print(netdissect_options *ndo,
            while (tmp>0) {
                 ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET);
                 if (ext_ip_len == 0) /* did something go wrong ? */
-                    goto trunctlv;
+                    goto trunc;
                 tptr+=ext_ip_len;
                tmp-=ext_ip_len;
            }
@@ -2783,7 +2783,7 @@ isis_print(netdissect_options *ndo,
         case ISIS_TLV_MT_IP_REACH:
             mt_len = isis_print_mtid(ndo, tptr, "\n\t      ");
             if (mt_len == 0) { /* did something go wrong ? */
-                goto trunctlv;
+                goto trunc;
             }
             tptr+=mt_len;
             tmp-=mt_len;
@@ -2791,7 +2791,7 @@ isis_print(netdissect_options *ndo,
             while (tmp>0) {
                 ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET);
                 if (ext_ip_len == 0) /* did something go wrong ? */
-                    goto trunctlv;
+                    goto trunc;
                 tptr+=ext_ip_len;
                tmp-=ext_ip_len;
            }
@@ -2801,7 +2801,7 @@ isis_print(netdissect_options *ndo,
            while (tmp>0) {
                 ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET6);
                 if (ext_ip_len == 0) /* did something go wrong ? */
-                    goto trunctlv;
+                    goto trunc;
                 tptr+=ext_ip_len;
                tmp-=ext_ip_len;
            }
@@ -2810,7 +2810,7 @@ isis_print(netdissect_options *ndo,
        case ISIS_TLV_MT_IP6_REACH:
             mt_len = isis_print_mtid(ndo, tptr, "\n\t      ");
             if (mt_len == 0) { /* did something go wrong ? */
-                goto trunctlv;
+                goto trunc;
             }
             tptr+=mt_len;
             tmp-=mt_len;
@@ -2818,7 +2818,7 @@ isis_print(netdissect_options *ndo,
            while (tmp>0) {
                 ext_ip_len = isis_print_extd_ip_reach(ndo, tptr, "\n\t      ", AF_INET6);
                 if (ext_ip_len == 0) /* did something go wrong ? */
-                    goto trunctlv;
+                    goto trunc;
                 tptr+=ext_ip_len;
                tmp-=ext_ip_len;
            }
@@ -2845,8 +2845,8 @@ isis_print(netdissect_options *ndo,
 
            switch (EXTRACT_U_1(tptr)) {
            case ISIS_SUBTLV_AUTH_SIMPLE:
-               if (fn_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend))
-                   goto trunctlv;
+               if (nd_printzp(ndo, tptr + 1, tlv_len - 1, ndo->ndo_snapend))
+                   goto trunc;
                break;
            case ISIS_SUBTLV_AUTH_MD5:
                for(i=1;i<tlv_len;i++) {
@@ -2973,8 +2973,8 @@ isis_print(netdissect_options *ndo,
 
        case ISIS_TLV_HOSTNAME:
            ND_PRINT("\n\t      Hostname: ");
-           if (fn_printzp(ndo, tptr, tmp, ndo->ndo_snapend))
-               goto trunctlv;
+           if (nd_printzp(ndo, tptr, tmp, ndo->ndo_snapend))
+               goto trunc;
            break;
 
        case ISIS_TLV_SHARED_RISK_GROUP:
@@ -3068,7 +3068,7 @@ isis_print(netdissect_options *ndo,
                if (tmp!=1) {
                     mt_len = isis_print_mtid(ndo, tptr, "\n\t      ");
                     if (mt_len == 0) /* did something go wrong ? */
-                        goto trunctlv;
+                        goto trunc;
                     tptr+=mt_len;
                     tmp-=mt_len;
                } else {
@@ -3229,14 +3229,9 @@ isis_print(netdissect_options *ndo,
     }
     return (1);
 
- trunc:
-    ND_PRINT("%s", tstr);
+trunc:
+    nd_print_trunc(ndo);
     return (1);
-
- trunctlv:
-    ND_PRINT("\n\t\t");
-    ND_PRINT("%s", tstr);
-    return(1);
 }
 
 static void
@@ -3267,10 +3262,3 @@ osi_print_cksum(netdissect_options *ndo, const uint8_t *pptr,
                 }
         }
 }
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */