]> The Tcpdump Group git mirrors - tcpdump/commitdiff
make minor cleanups to print-decnet.c
authorDenis Ovsienko <[email protected]>
Fri, 7 Oct 2016 20:54:57 +0000 (21:54 +0100)
committerDenis Ovsienko <[email protected]>
Fri, 7 Oct 2016 21:19:36 +0000 (22:19 +0100)
Remove some unused code guarded by PRINT_NSPDATA, which was never
defined.

To resolve a Coverity dead code warning remove the notions of
COS_CRYPTSER as DECnet packet diagrams are pretty much non-existent in
the modern Internet so I could not figure it out what the code point was
meant to do originally.

dead_error_condition: The switch value "services & 0xc" cannot be 16

print-decnet.c

index 864c4a377a1072f077013b350a4d7235d61fc0cf..88aa9e3efe757911b98336c258c806b320a05edb 100644 (file)
@@ -326,7 +326,6 @@ union controlmsg
 #define COS_NONE 0                     /* no flow control */
 #define COS_SEGMENT 04                 /* segment flow control */
 #define COS_MESSAGE 010                        /* message flow control */
-#define COS_CRYPTSER 020               /* cryptographic services requested */
 #define COS_DEFAULT 1                  /* default value for field */
 
 #define COI_MASK 3                     /* mask for version field */
@@ -492,9 +491,6 @@ static void print_i_info(netdissect_options *, int);
 static int print_elist(const char *, u_int);
 static int print_nsp(netdissect_options *, const u_char *, u_int);
 static void print_reason(netdissect_options *, int);
-#ifdef PRINT_NSPDATA
-static void pdata(netdissect_options *, u_char *, u_int);
-#endif
 
 #ifndef HAVE_NETDNET_DNETDB_H_DNET_HTOA
 extern char *dnet_htoa(struct dn_naddr *);
@@ -877,9 +873,6 @@ print_nsp(netdissect_options *ndo,
                {
                    const struct seghdr *shp = (const struct seghdr *)nspp;
                    int ack;
-#ifdef PRINT_NSPDATA
-                   const u_char *dp;
-#endif
                    u_int data_off = sizeof(struct minseghdr);
 
                    if (nsplen < data_off)
@@ -909,13 +902,6 @@ print_nsp(netdissect_options *ndo,
                        }
                    }
                    ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK));
-#ifdef PRINT_NSPDATA
-                   if (nsplen > data_off) {
-                       dp = &(nspp[data_off]);
-                       ND_TCHECK2(*dp, nsplen - data_off);
-                       pdata(ndo, dp, nsplen - data_off);
-                   }
-#endif
                }
                break;
            case MFS_ILS+MFS_INT:
@@ -923,9 +909,6 @@ print_nsp(netdissect_options *ndo,
                {
                    const struct seghdr *shp = (const struct seghdr *)nspp;
                    int ack;
-#ifdef PRINT_NSPDATA
-                   const u_char *dp;
-#endif
                    u_int data_off = sizeof(struct minseghdr);
 
                    if (nsplen < data_off)
@@ -955,13 +938,6 @@ print_nsp(netdissect_options *ndo,
                        }
                    }
                    ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK));
-#ifdef PRINT_NSPDATA
-                   if (nsplen > data_off) {
-                       dp = &(nspp[data_off]);
-                       ND_TCHECK2(*dp, nsplen - data_off);
-                       pdata(ndo, dp, nsplen - data_off);
-                   }
-#endif
                }
                break;
            case MFS_ILS:
@@ -1101,9 +1077,6 @@ print_nsp(netdissect_options *ndo,
                {
                    const struct cimsg *cimp = (const struct cimsg *)nspp;
                    int services, info, segsize;
-#ifdef PRINT_NSPDATA
-                   const u_char *dp;
-#endif
 
                    if (nsplen < sizeof(struct cimsg))
                        goto trunc;
@@ -1121,9 +1094,6 @@ print_nsp(netdissect_options *ndo,
                    case COS_MESSAGE:
                        ND_PRINT((ndo, "msg "));
                        break;
-                   case COS_CRYPTSER:
-                       ND_PRINT((ndo, "crypt "));
-                       break;
                    }
                    switch (info & COI_MASK) {
                    case COI_32:
@@ -1140,13 +1110,6 @@ print_nsp(netdissect_options *ndo,
                        break;
                    }
                    ND_PRINT((ndo, "segsize %d ", segsize));
-#ifdef PRINT_NSPDATA
-                   if (nsplen > sizeof(struct cimsg)) {
-                       dp = &(nspp[sizeof(struct cimsg)]);
-                       ND_TCHECK2(*dp, nsplen - sizeof(struct cimsg));
-                       pdata(ndo, dp, nsplen - sizeof(struct cimsg));
-                   }
-#endif
                }
                break;
            case MFS_CC:
@@ -1155,9 +1118,6 @@ print_nsp(netdissect_options *ndo,
                    const struct ccmsg *ccmp = (const struct ccmsg *)nspp;
                    int services, info;
                    u_int segsize, optlen;
-#ifdef PRINT_NSPDATA
-                   const u_char *dp;
-#endif
 
                    if (nsplen < sizeof(struct ccmsg))
                        goto trunc;
@@ -1176,9 +1136,6 @@ print_nsp(netdissect_options *ndo,
                    case COS_MESSAGE:
                        ND_PRINT((ndo, "msg "));
                        break;
-                   case COS_CRYPTSER:
-                       ND_PRINT((ndo, "crypt "));
-                       break;
                    }
                    switch (info & COI_MASK) {
                    case COI_32:
@@ -1197,13 +1154,6 @@ print_nsp(netdissect_options *ndo,
                    ND_PRINT((ndo, "segsize %d ", segsize));
                    if (optlen) {
                        ND_PRINT((ndo, "optlen %d ", optlen));
-#ifdef PRINT_NSPDATA
-                       if (optlen > nsplen - sizeof(struct ccmsg))
-                           goto trunc;
-                       dp = &(nspp[sizeof(struct ccmsg)]);
-                       ND_TCHECK2(*dp, optlen);
-                       pdata(ndo, dp, optlen);
-#endif
                    }
                }
                break;
@@ -1213,9 +1163,6 @@ print_nsp(netdissect_options *ndo,
                    const struct dimsg *dimp = (const struct dimsg *)nspp;
                    int reason;
                    u_int optlen;
-#ifdef PRINT_NSPDATA
-                   const u_char *dp;
-#endif
 
                    if (nsplen < sizeof(struct dimsg))
                        goto trunc;
@@ -1226,13 +1173,6 @@ print_nsp(netdissect_options *ndo,
                    print_reason(ndo, reason);
                    if (optlen) {
                        ND_PRINT((ndo, "optlen %d ", optlen));
-#ifdef PRINT_NSPDATA
-                       if (optlen > nsplen - sizeof(struct dimsg))
-                           goto trunc;
-                       dp = &(nspp[sizeof(struct dimsg)]);
-                       ND_TCHECK2(*dp, optlen);
-                       pdata(ndo, dp, optlen);
-#endif
                    }
                }
                break;
@@ -1329,18 +1269,3 @@ dnname_string(netdissect_options *ndo, u_short dnaddr)
        return(dnnum_string(ndo, dnaddr));      /* punt */
 #endif
 }
-
-#ifdef PRINT_NSPDATA
-static void
-pdata(netdissect_options *ndo,
-      u_char *dp, u_int maxlen)
-{
-       char c;
-       u_int x = maxlen;
-
-       while (x-- > 0) {
-           c = *dp++;
-           safeputchar(ndo, c);
-       }
-}
-#endif