X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/2b753f80585fd13b547c3b6797806301d9cef5d6..a7a76012a129ffefb64f102948db63fbc715e45e:/print-decnet.c?ds=sidebyside diff --git a/print-decnet.c b/print-decnet.c index a555571c..ad0b478f 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -19,12 +19,13 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#define NETDISSECT_REWORKED +/* \summary: DECnet printer */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include struct mbuf; struct rtentry; @@ -38,31 +39,31 @@ struct rtentry; #include #include "extract.h" -#include "interface.h" +#include "netdissect.h" #include "addrtoname.h" static const char tstr[] = "[|decnet]"; -#ifndef WIN32 -typedef u_int8_t byte[1]; /* single byte field */ +#ifndef _WIN32 +typedef uint8_t byte[1]; /* single byte field */ #else /* * the keyword 'byte' generates conflicts in Windows */ typedef unsigned char Byte[1]; /* single byte field */ #define byte Byte -#endif /* WIN32 */ -typedef u_int8_t word[2]; /* 2 byte field */ -typedef u_int8_t longword[4]; /* 4 bytes field */ +#endif /* _WIN32 */ +typedef uint8_t word[2]; /* 2 byte field */ +typedef uint8_t longword[4]; /* 4 bytes field */ /* * Definitions for DECNET Phase IV protocol headers */ union etheraddress { - u_int8_t dne_addr[6]; /* full ethernet address */ + uint8_t dne_addr[6]; /* full ethernet address */ struct { - u_int8_t dne_hiord[4]; /* DECnet HIORD prefix */ - u_int8_t dne_nodeaddr[2]; /* DECnet node address */ + uint8_t dne_hiord[4]; /* DECnet HIORD prefix */ + uint8_t dne_nodeaddr[2]; /* DECnet node address */ } dne_remote; }; @@ -76,8 +77,8 @@ typedef union etheraddress etheraddr; /* Ethernet address */ #define DN_MAXADDL 20 /* max size of DECnet address */ struct dn_naddr { - u_int16_t a_len; /* length of address */ - u_int8_t a_addr[DN_MAXADDL]; /* address as bytes */ + uint16_t a_len; /* length of address */ + uint8_t a_addr[DN_MAXADDL]; /* address as bytes */ }; /* @@ -271,7 +272,7 @@ union controlmsg /* Macros for decoding routing-info fields */ #define RI_COST(x) ((x)&0777) #define RI_HOPS(x) (((x)>>10)&037) - + /* * NSP protocol fields and values. */ @@ -325,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 */ @@ -491,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 *); @@ -529,7 +526,7 @@ decnet_print(netdissect_options *ndo, rhp = (const union routehdr *)&(ap[sizeof(short)]); ND_TCHECK(rhp->rh_short.sh_flags); - mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags); + mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags); if (mflags & RMF_PAD) { /* pad bytes of some sort in front of message */ @@ -545,12 +542,13 @@ decnet_print(netdissect_options *ndo, length -= padlen; caplen -= padlen; rhp = (const union routehdr *)&(ap[sizeof(short)]); - mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags); + ND_TCHECK(rhp->rh_short.sh_flags); + mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags); } if (mflags & RMF_FVER) { ND_PRINT((ndo, "future-version-decnet")); - default_print(ap, min(length, caplen)); + ND_DEFAULTPRINT(ap, min(length, caplen)); return; } @@ -572,7 +570,7 @@ decnet_print(netdissect_options *ndo, EXTRACT_LE_16BITS(rhp->rh_long.lg_dst.dne_remote.dne_nodeaddr); src = EXTRACT_LE_16BITS(rhp->rh_long.lg_src.dne_remote.dne_nodeaddr); - hops = EXTRACT_LE_8BITS(rhp->rh_long.lg_visits); + hops = EXTRACT_8BITS(rhp->rh_long.lg_visits); nspp = &(ap[sizeof(short) + sizeof(struct longhdr)]); nsplen = length - sizeof(struct longhdr); break; @@ -580,18 +578,18 @@ decnet_print(netdissect_options *ndo, ND_TCHECK(rhp->rh_short); dst = EXTRACT_LE_16BITS(rhp->rh_short.sh_dst); src = EXTRACT_LE_16BITS(rhp->rh_short.sh_src); - hops = (EXTRACT_LE_8BITS(rhp->rh_short.sh_visits) & VIS_MASK)+1; + hops = (EXTRACT_8BITS(rhp->rh_short.sh_visits) & VIS_MASK)+1; nspp = &(ap[sizeof(short) + sizeof(struct shorthdr)]); nsplen = length - sizeof(struct shorthdr); break; default: ND_PRINT((ndo, "unknown message flags under mask")); - default_print((u_char *)ap, min(length, caplen)); + ND_DEFAULTPRINT((const u_char *)ap, min(length, caplen)); return; } ND_PRINT((ndo, "%s > %s %d ", - dnaddr_string(src), dnaddr_string(dst), pktlen)); + dnaddr_string(ndo, src), dnaddr_string(ndo, dst), pktlen)); if (ndo->ndo_vflag) { if (mflags & RMF_RQR) ND_PRINT((ndo, "RQR ")); @@ -616,12 +614,13 @@ print_decnet_ctlmsg(netdissect_options *ndo, register const union routehdr *rhp, u_int length, u_int caplen) { - int mflags = EXTRACT_LE_8BITS(rhp->rh_short.sh_flags); - register union controlmsg *cmp = (union controlmsg *)rhp; + /* Our caller has already checked for mflags */ + int mflags = EXTRACT_8BITS(rhp->rh_short.sh_flags); + register const union controlmsg *cmp = (const union controlmsg *)rhp; int src, dst, info, blksize, eco, ueco, hello, other, vers; etheraddr srcea, rtea; int priority; - char *rhpx = (char *)rhp; + const char *rhpx = (const char *)rhp; int ret; switch (mflags & RMF_CTLMASK) { @@ -631,16 +630,16 @@ print_decnet_ctlmsg(netdissect_options *ndo, goto trunc; ND_TCHECK(cmp->cm_init); src = EXTRACT_LE_16BITS(cmp->cm_init.in_src); - info = EXTRACT_LE_8BITS(cmp->cm_init.in_info); + info = EXTRACT_8BITS(cmp->cm_init.in_info); blksize = EXTRACT_LE_16BITS(cmp->cm_init.in_blksize); - vers = EXTRACT_LE_8BITS(cmp->cm_init.in_vers); - eco = EXTRACT_LE_8BITS(cmp->cm_init.in_eco); - ueco = EXTRACT_LE_8BITS(cmp->cm_init.in_ueco); + vers = EXTRACT_8BITS(cmp->cm_init.in_vers); + eco = EXTRACT_8BITS(cmp->cm_init.in_eco); + ueco = EXTRACT_8BITS(cmp->cm_init.in_ueco); hello = EXTRACT_LE_16BITS(cmp->cm_init.in_hello); print_t_info(ndo, info); ND_PRINT((ndo, "src %sblksize %d vers %d eco %d ueco %d hello %d", - dnaddr_string(src), blksize, vers, eco, ueco, + dnaddr_string(ndo, src), blksize, vers, eco, ueco, hello)); ret = 1; break; @@ -650,8 +649,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, goto trunc; ND_TCHECK(cmp->cm_ver); src = EXTRACT_LE_16BITS(cmp->cm_ver.ve_src); - other = EXTRACT_LE_8BITS(cmp->cm_ver.ve_fcnval); - ND_PRINT((ndo, "src %s fcnval %o", dnaddr_string(src), other)); + other = EXTRACT_8BITS(cmp->cm_ver.ve_fcnval); + ND_PRINT((ndo, "src %s fcnval %o", dnaddr_string(ndo, src), other)); ret = 1; break; case RMF_TEST: @@ -660,8 +659,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, goto trunc; ND_TCHECK(cmp->cm_test); src = EXTRACT_LE_16BITS(cmp->cm_test.te_src); - other = EXTRACT_LE_8BITS(cmp->cm_test.te_data); - ND_PRINT((ndo, "src %s data %o", dnaddr_string(src), other)); + other = EXTRACT_8BITS(cmp->cm_test.te_data); + ND_PRINT((ndo, "src %s data %o", dnaddr_string(ndo, src), other)); ret = 1; break; case RMF_L1ROUT: @@ -670,7 +669,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, goto trunc; ND_TCHECK(cmp->cm_l1rou); src = EXTRACT_LE_16BITS(cmp->cm_l1rou.r1_src); - ND_PRINT((ndo, "src %s ", dnaddr_string(src))); + ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l1_routes(ndo, &(rhpx[sizeof(struct l1rout)]), length - sizeof(struct l1rout)); break; @@ -680,7 +679,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, goto trunc; ND_TCHECK(cmp->cm_l2rout); src = EXTRACT_LE_16BITS(cmp->cm_l2rout.r2_src); - ND_PRINT((ndo, "src %s ", dnaddr_string(src))); + ND_PRINT((ndo, "src %s ", dnaddr_string(ndo, src))); ret = print_l2_routes(ndo, &(rhpx[sizeof(struct l2rout)]), length - sizeof(struct l2rout)); break; @@ -689,20 +688,20 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct rhellomsg)) goto trunc; ND_TCHECK(cmp->cm_rhello); - vers = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_vers); - eco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_eco); - ueco = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_ueco); - memcpy((char *)&srcea, (char *)&(cmp->cm_rhello.rh_src), + vers = EXTRACT_8BITS(cmp->cm_rhello.rh_vers); + eco = EXTRACT_8BITS(cmp->cm_rhello.rh_eco); + ueco = EXTRACT_8BITS(cmp->cm_rhello.rh_ueco); + memcpy((char *)&srcea, (const char *)&(cmp->cm_rhello.rh_src), sizeof(srcea)); src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); - info = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_info); + info = EXTRACT_8BITS(cmp->cm_rhello.rh_info); blksize = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_blksize); - priority = EXTRACT_LE_8BITS(cmp->cm_rhello.rh_priority); + priority = EXTRACT_8BITS(cmp->cm_rhello.rh_priority); hello = EXTRACT_LE_16BITS(cmp->cm_rhello.rh_hello); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d pri %d hello %d", - vers, eco, ueco, dnaddr_string(src), + vers, eco, ueco, dnaddr_string(ndo, src), blksize, priority, hello)); ret = print_elist(&(rhpx[sizeof(struct rhellomsg)]), length - sizeof(struct rhellomsg)); @@ -712,31 +711,31 @@ print_decnet_ctlmsg(netdissect_options *ndo, if (length < sizeof(struct ehellomsg)) goto trunc; ND_TCHECK(cmp->cm_ehello); - vers = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_vers); - eco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_eco); - ueco = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_ueco); - memcpy((char *)&srcea, (char *)&(cmp->cm_ehello.eh_src), + vers = EXTRACT_8BITS(cmp->cm_ehello.eh_vers); + eco = EXTRACT_8BITS(cmp->cm_ehello.eh_eco); + ueco = EXTRACT_8BITS(cmp->cm_ehello.eh_ueco); + memcpy((char *)&srcea, (const char *)&(cmp->cm_ehello.eh_src), sizeof(srcea)); src = EXTRACT_LE_16BITS(srcea.dne_remote.dne_nodeaddr); - info = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_info); + info = EXTRACT_8BITS(cmp->cm_ehello.eh_info); blksize = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_blksize); /*seed*/ - memcpy((char *)&rtea, (char *)&(cmp->cm_ehello.eh_router), + memcpy((char *)&rtea, (const char *)&(cmp->cm_ehello.eh_router), sizeof(rtea)); dst = EXTRACT_LE_16BITS(rtea.dne_remote.dne_nodeaddr); hello = EXTRACT_LE_16BITS(cmp->cm_ehello.eh_hello); - other = EXTRACT_LE_8BITS(cmp->cm_ehello.eh_data); + other = EXTRACT_8BITS(cmp->cm_ehello.eh_data); print_i_info(ndo, info); ND_PRINT((ndo, "vers %d eco %d ueco %d src %s blksize %d rtr %s hello %d data %o", - vers, eco, ueco, dnaddr_string(src), - blksize, dnaddr_string(dst), hello, other)); + vers, eco, ueco, dnaddr_string(ndo, src), + blksize, dnaddr_string(ndo, dst), hello, other)); ret = 1; break; default: ND_PRINT((ndo, "unknown control message")); - default_print((u_char *)rhp, min(length, caplen)); + ND_DEFAULTPRINT((const u_char *)rhp, min(length, caplen)); ret = 1; break; } @@ -855,13 +854,13 @@ static int print_nsp(netdissect_options *ndo, const u_char *nspp, u_int nsplen) { - const struct nsphdr *nsphp = (struct nsphdr *)nspp; + const struct nsphdr *nsphp = (const struct nsphdr *)nspp; int dst, src, flags; if (nsplen < sizeof(struct nsphdr)) goto trunc; ND_TCHECK(*nsphp); - flags = EXTRACT_LE_8BITS(nsphp->nh_flags); + flags = EXTRACT_8BITS(nsphp->nh_flags); dst = EXTRACT_LE_16BITS(nsphp->nh_dst); src = EXTRACT_LE_16BITS(nsphp->nh_src); @@ -874,11 +873,8 @@ print_nsp(netdissect_options *ndo, case MFS_BOM+MFS_EOM: ND_PRINT((ndo, "data %d>%d ", src, dst)); { - struct seghdr *shp = (struct seghdr *)nspp; + const struct seghdr *shp = (const struct seghdr *)nspp; int ack; -#ifdef PRINT_NSPDATA - u_char *dp; -#endif u_int data_off = sizeof(struct minseghdr); if (nsplen < data_off) @@ -908,23 +904,13 @@ 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: ND_PRINT((ndo, "intr ")); { - struct seghdr *shp = (struct seghdr *)nspp; + const struct seghdr *shp = (const struct seghdr *)nspp; int ack; -#ifdef PRINT_NSPDATA - u_char *dp; -#endif u_int data_off = sizeof(struct minseghdr); if (nsplen < data_off) @@ -954,21 +940,14 @@ 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: ND_PRINT((ndo, "link-service %d>%d ", src, dst)); { - struct seghdr *shp = (struct seghdr *)nspp; - struct lsmsg *lsmp = - (struct lsmsg *)&(nspp[sizeof(struct seghdr)]); + const struct seghdr *shp = (const struct seghdr *)nspp; + const struct lsmsg *lsmp = + (const struct lsmsg *)&(nspp[sizeof(struct seghdr)]); int ack; int lsflags, fcval; @@ -994,8 +973,8 @@ print_nsp(netdissect_options *ndo, } ND_PRINT((ndo, "seg %d ", ack & SGQ_MASK)); ND_TCHECK(*lsmp); - lsflags = EXTRACT_LE_8BITS(lsmp->ls_lsflags); - fcval = EXTRACT_LE_8BITS(lsmp->ls_fcval); + lsflags = EXTRACT_8BITS(lsmp->ls_lsflags); + fcval = EXTRACT_8BITS(lsmp->ls_fcval); switch (lsflags & LSI_MASK) { case LSI_DATA: ND_PRINT((ndo, "dat seg count %d ", fcval)); @@ -1032,7 +1011,7 @@ print_nsp(netdissect_options *ndo, case MFS_DACK: ND_PRINT((ndo, "data-ack %d>%d ", src, dst)); { - struct ackmsg *amp = (struct ackmsg *)nspp; + const struct ackmsg *amp = (const struct ackmsg *)nspp; int ack; if (nsplen < sizeof(struct ackmsg)) @@ -1057,7 +1036,7 @@ print_nsp(netdissect_options *ndo, case MFS_IACK: ND_PRINT((ndo, "ils-ack %d>%d ", src, dst)); { - struct ackmsg *amp = (struct ackmsg *)nspp; + const struct ackmsg *amp = (const struct ackmsg *)nspp; int ack; if (nsplen < sizeof(struct ackmsg)) @@ -1098,17 +1077,14 @@ print_nsp(netdissect_options *ndo, ND_PRINT((ndo, "retrans-conn-initiate ")); ND_PRINT((ndo, "%d>%d ", src, dst)); { - struct cimsg *cimp = (struct cimsg *)nspp; + const struct cimsg *cimp = (const struct cimsg *)nspp; int services, info, segsize; -#ifdef PRINT_NSPDATA - u_char *dp; -#endif if (nsplen < sizeof(struct cimsg)) goto trunc; ND_TCHECK(*cimp); - services = EXTRACT_LE_8BITS(cimp->ci_services); - info = EXTRACT_LE_8BITS(cimp->ci_info); + services = EXTRACT_8BITS(cimp->ci_services); + info = EXTRACT_8BITS(cimp->ci_info); segsize = EXTRACT_LE_16BITS(cimp->ci_segsize); switch (services & COS_MASK) { @@ -1120,9 +1096,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: @@ -1139,32 +1112,22 @@ 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: ND_PRINT((ndo, "conn-confirm %d>%d ", src, dst)); { - struct ccmsg *ccmp = (struct ccmsg *)nspp; + const struct ccmsg *ccmp = (const struct ccmsg *)nspp; int services, info; u_int segsize, optlen; -#ifdef PRINT_NSPDATA - u_char *dp; -#endif if (nsplen < sizeof(struct ccmsg)) goto trunc; ND_TCHECK(*ccmp); - services = EXTRACT_LE_8BITS(ccmp->cc_services); - info = EXTRACT_LE_8BITS(ccmp->cc_info); + services = EXTRACT_8BITS(ccmp->cc_services); + info = EXTRACT_8BITS(ccmp->cc_info); segsize = EXTRACT_LE_16BITS(ccmp->cc_segsize); - optlen = EXTRACT_LE_8BITS(ccmp->cc_optlen); + optlen = EXTRACT_8BITS(ccmp->cc_optlen); switch (services & COS_MASK) { case COS_NONE: @@ -1175,9 +1138,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: @@ -1196,49 +1156,32 @@ 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; case MFS_DI: ND_PRINT((ndo, "disconn-initiate %d>%d ", src, dst)); { - struct dimsg *dimp = (struct dimsg *)nspp; + const struct dimsg *dimp = (const struct dimsg *)nspp; int reason; u_int optlen; -#ifdef PRINT_NSPDATA - u_char *dp; -#endif if (nsplen < sizeof(struct dimsg)) goto trunc; ND_TCHECK(*dimp); reason = EXTRACT_LE_16BITS(dimp->di_reason); - optlen = EXTRACT_LE_8BITS(dimp->di_optlen); + optlen = EXTRACT_8BITS(dimp->di_optlen); 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; case MFS_DC: ND_PRINT((ndo, "disconn-confirm %d>%d ", src, dst)); { - struct dcmsg *dcmp = (struct dcmsg *)nspp; + const struct dcmsg *dcmp = (const struct dcmsg *)nspp; int reason; ND_TCHECK(*dcmp); @@ -1296,7 +1239,7 @@ print_reason(netdissect_options *ndo, } const char * -dnnum_string(u_short dnaddr) +dnnum_string(netdissect_options *ndo, u_short dnaddr) { char *str; size_t siz; @@ -1305,36 +1248,26 @@ dnnum_string(u_short dnaddr) str = (char *)malloc(siz = sizeof("00.0000")); if (str == NULL) - error("dnnum_string: malloc"); + (*ndo->ndo_error)(ndo, "dnnum_string: malloc"); snprintf(str, siz, "%d.%d", area, node); return(str); } const char * -dnname_string(u_short dnaddr) +dnname_string(netdissect_options *ndo, u_short dnaddr) { #ifdef HAVE_DNET_HTOA struct dn_naddr dna; + char *dnname; dna.a_len = sizeof(short); memcpy((char *)dna.a_addr, (char *)&dnaddr, sizeof(short)); - return (strdup(dnet_htoa(&dna))); + dnname = dnet_htoa(&dna); + if(dnname != NULL) + return (strdup(dnname)); + else + return(dnnum_string(ndo, dnaddr)); #else - return(dnnum_string(dnaddr)); /* punt */ + 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