From: Guy Harris Date: Fri, 4 Apr 2014 07:43:46 +0000 (-0700) Subject: Netdissectify the to-name resolution routines. X-Git-Tag: tcpdump-4.6.0~100^2~3 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/1cde6435df23876fb88998e38739def0dc7dca47 Netdissectify the to-name resolution routines. Have them take a netdissect_options * argument, and get the "no name resolution" flag from it. Move the declaration of dnaddr_string to addrtoname.h, along with the other XXX-to-string routines. --- diff --git a/addrtoname.c b/addrtoname.c index 1d7e60f9..ba0397c2 100644 --- a/addrtoname.c +++ b/addrtoname.c @@ -218,7 +218,7 @@ static u_int32_t f_localnet; * also needs to check whether they're present in the packet buffer. */ const char * -getname(const u_char *ap) +getname(netdissect_options *ndo, const u_char *ap) { register struct hostent *hp; u_int32_t addr; @@ -240,7 +240,7 @@ getname(const u_char *ap) * given, f_netmask and f_localnet are 0 and the test * evaluates to true) */ - if (!nflag && + if (!ndo->ndo_nflag && (addr & f_netmask) == f_localnet) { hp = gethostbyaddr((char *)&addr, 4, AF_INET); if (hp) { @@ -266,7 +266,7 @@ getname(const u_char *ap) * is assumed to be in network byte order. */ const char * -getname6(const u_char *ap) +getname6(netdissect_options *ndo, const u_char *ap) { register struct hostent *hp; union { @@ -292,7 +292,7 @@ getname6(const u_char *ap) /* * Do not print names if -n was given. */ - if (!nflag) { + if (!ndo->ndo_nflag) { hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6); if (hp) { char *dotp; @@ -466,7 +466,7 @@ lookup_protoid(const u_char *pi) } const char * -etheraddr_string(register const u_char *ep) +etheraddr_string(netdissect_options *ndo, register const u_char *ep) { register int i; register char *cp; @@ -478,7 +478,7 @@ etheraddr_string(register const u_char *ep) if (tp->e_name) return (tp->e_name); #ifdef USE_ETHER_NTOHOST - if (!nflag) { + if (!ndo->ndo_nflag) { char buf2[BUFSIZE]; /* @@ -503,7 +503,7 @@ etheraddr_string(register const u_char *ep) *cp++ = hex[*ep++ & 0xf]; } - if (!nflag) { + if (!ndo->ndo_nflag) { snprintf(cp, BUFSIZE - (2 + 5*3), " (oui %s)", tok2str(oui_values, "Unknown", oui)); } else @@ -541,7 +541,7 @@ le64addr_string(const u_char *ep) } const char * -linkaddr_string(const u_char *ep, const unsigned int type, const unsigned int len) +linkaddr_string(netdissect_options *ndo, const u_char *ep, const unsigned int type, const unsigned int len) { register u_int i; register char *cp; @@ -551,7 +551,7 @@ linkaddr_string(const u_char *ep, const unsigned int type, const unsigned int le return (""); if (type == LINKADDR_ETHER && len == ETHER_ADDR_LEN) - return (etheraddr_string(ep)); + return (etheraddr_string(ndo, ep)); if (type == LINKADDR_FRELAY) return (q922_string(ep)); @@ -723,7 +723,7 @@ ipxsap_string(u_short port) } static void -init_servarray(void) +init_servarray(netdissect_options *ndo) { struct servent *sv; register struct hnamemem *table; @@ -742,7 +742,7 @@ init_servarray(void) while (table->name) table = table->nxt; - if (nflag) { + if (ndo->ndo_nflag) { (void)snprintf(buf, sizeof(buf), "%d", port); table->name = strdup(buf); } else @@ -1136,27 +1136,27 @@ init_ipxsaparray(void) * of the local network. mask is its subnet mask. */ void -init_addrtoname(u_int32_t localnet, u_int32_t mask) +init_addrtoname(netdissect_options *ndo, u_int32_t localnet, u_int32_t mask) { if (fflag) { f_localnet = localnet; f_netmask = mask; } - if (nflag) + if (ndo->ndo_nflag) /* * Simplest way to suppress names. */ return; init_etherarray(); - init_servarray(); + init_servarray(ndo); init_eprotoarray(); init_protoidarray(); init_ipxsaparray(); } const char * -dnaddr_string(u_short dnaddr) +dnaddr_string(netdissect_options *ndo, u_short dnaddr) { register struct hnamemem *tp; @@ -1167,7 +1167,7 @@ dnaddr_string(u_short dnaddr) tp->addr = dnaddr; tp->nxt = newhnamemem(); - if (nflag) + if (ndo->ndo_nflag) tp->name = dnnum_string(dnaddr); else tp->name = dnname_string(dnaddr); diff --git a/addrtoname.h b/addrtoname.h index 533a7864..bdbcf369 100644 --- a/addrtoname.h +++ b/addrtoname.h @@ -30,28 +30,29 @@ enum { #define BUFSIZE 128 -extern const char *linkaddr_string(const u_char *, const unsigned int, const unsigned int); -extern const char *etheraddr_string(const u_char *); +extern const char *linkaddr_string(netdissect_options *, const u_char *, const unsigned int, const unsigned int); +extern const char *etheraddr_string(netdissect_options *, const u_char *); extern const char *le64addr_string(const u_char *); extern const char *etherproto_string(u_short); extern const char *tcpport_string(u_short); extern const char *udpport_string(u_short); extern const char *isonsap_string(const u_char *, register u_int); +extern const char *dnaddr_string(netdissect_options *, u_short); extern const char *protoid_string(const u_char *); extern const char *ipxsap_string(u_short); -extern const char *getname(const u_char *); +extern const char *getname(netdissect_options *, const u_char *); #ifdef INET6 -extern const char *getname6(const u_char *); +extern const char *getname6(netdissect_options *, const u_char *); #endif extern const char *intoa(u_int32_t); -extern void init_addrtoname(u_int32_t, u_int32_t); +extern void init_addrtoname(netdissect_options *, u_int32_t, u_int32_t); extern struct hnamemem *newhnamemem(void); #ifdef INET6 extern struct h6namemem *newh6namemem(void); #endif -#define ipaddr_string(p) getname((const u_char *)(p)) +#define ipaddr_string(ndo, p) getname(ndo, (const u_char *)(p)) #ifdef INET6 -#define ip6addr_string(p) getname6((const u_char *)(p)) +#define ip6addr_string(ndo, p) getname6(ndo, (const u_char *)(p)) #endif diff --git a/interface.h b/interface.h index d08f9880..2b68c409 100644 --- a/interface.h +++ b/interface.h @@ -124,8 +124,6 @@ extern int mask2plen(u_int32_t); extern const char *tok2strary_internal(const char **, int, const char *, int); #define tok2strary(a,f,i) tok2strary_internal(a, sizeof(a)/sizeof(a[0]),f,i) -extern const char *dnaddr_string(u_short); - extern void error(const char *, ...) __attribute__((noreturn)) #ifdef __ATTRIBUTE___FORMAT_OK diff --git a/print-802_11.c b/print-802_11.c index 796f3489..8b734b43 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -1637,7 +1637,7 @@ handle_reassoc_request(netdissect_options *ndo, ret = parse_elements(ndo, &pbody, p, offset, length); PRINT_SSID(pbody); - ND_PRINT((ndo, " AP : %s", etheraddr_string( pbody.ap ))); + ND_PRINT((ndo, " AP : %s", etheraddr_string(ndo, pbody.ap ))); return ret; } @@ -1808,7 +1808,7 @@ handle_deauth(netdissect_options *ndo, if (ndo->ndo_eflag) { ND_PRINT((ndo, ": %s", reason)); } else { - ND_PRINT((ndo, " (%s): %s", etheraddr_string(pmh->sa), reason)); + ND_PRINT((ndo, " (%s): %s", etheraddr_string(ndo, pmh->sa), reason)); } return 1; } @@ -1882,7 +1882,7 @@ handle_action(netdissect_options *ndo, if (ndo->ndo_eflag) { ND_PRINT((ndo, ": ")); } else { - ND_PRINT((ndo, " (%s): ", etheraddr_string(pmh->sa))); + ND_PRINT((ndo, " (%s): ", etheraddr_string(ndo, pmh->sa))); } switch (p[0]) { case 0: ND_PRINT((ndo, "Spectrum Management Act#%d", p[1])); break; @@ -1988,8 +1988,8 @@ ctrl_body_print(netdissect_options *ndo, return 0; if (!ndo->ndo_eflag) ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ", - etheraddr_string(((const struct ctrl_bar_t *)p)->ra), - etheraddr_string(((const struct ctrl_bar_t *)p)->ta), + etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ra), + etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ta), EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->ctl)), EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->seq)))); break; @@ -1999,7 +1999,7 @@ ctrl_body_print(netdissect_options *ndo, return 0; if (!ndo->ndo_eflag) ND_PRINT((ndo, " RA:%s ", - etheraddr_string(((const struct ctrl_ba_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_ba_t *)p)->ra))); break; case CTRL_PS_POLL: ND_PRINT((ndo, "Power Save-Poll")); @@ -2014,7 +2014,7 @@ ctrl_body_print(netdissect_options *ndo, return 0; if (!ndo->ndo_eflag) ND_PRINT((ndo, " TA:%s ", - etheraddr_string(((const struct ctrl_rts_t *)p)->ta))); + etheraddr_string(ndo, ((const struct ctrl_rts_t *)p)->ta))); break; case CTRL_CTS: ND_PRINT((ndo, "Clear-To-Send")); @@ -2022,7 +2022,7 @@ ctrl_body_print(netdissect_options *ndo, return 0; if (!ndo->ndo_eflag) ND_PRINT((ndo, " RA:%s ", - etheraddr_string(((const struct ctrl_cts_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_cts_t *)p)->ra))); break; case CTRL_ACK: ND_PRINT((ndo, "Acknowledgment")); @@ -2030,7 +2030,7 @@ ctrl_body_print(netdissect_options *ndo, return 0; if (!ndo->ndo_eflag) ND_PRINT((ndo, " RA:%s ", - etheraddr_string(((const struct ctrl_ack_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_ack_t *)p)->ra))); break; case CTRL_CF_END: ND_PRINT((ndo, "CF-End")); @@ -2038,7 +2038,7 @@ ctrl_body_print(netdissect_options *ndo, return 0; if (!ndo->ndo_eflag) ND_PRINT((ndo, " RA:%s ", - etheraddr_string(((const struct ctrl_end_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_end_t *)p)->ra))); break; case CTRL_END_ACK: ND_PRINT((ndo, "CF-End+CF-Ack")); @@ -2046,7 +2046,7 @@ ctrl_body_print(netdissect_options *ndo, return 0; if (!ndo->ndo_eflag) ND_PRINT((ndo, " RA:%s ", - etheraddr_string(((const struct ctrl_end_ack_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_end_ack_t *)p)->ra))); break; default: ND_PRINT((ndo, "Unknown Ctrl Subtype")); @@ -2105,8 +2105,8 @@ data_header_print(netdissect_options *ndo, if (!ndo->ndo_eflag) return; ND_PRINT((ndo, "DA:%s SA:%s BSSID:%s ", - etheraddr_string(ADDR1), etheraddr_string(ADDR2), - etheraddr_string(ADDR3))); + etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2), + etheraddr_string(ndo, ADDR3))); } else if (!FC_TO_DS(fc) && FC_FROM_DS(fc)) { if (srcp != NULL) *srcp = ADDR3; @@ -2115,8 +2115,8 @@ data_header_print(netdissect_options *ndo, if (!ndo->ndo_eflag) return; ND_PRINT((ndo, "DA:%s BSSID:%s SA:%s ", - etheraddr_string(ADDR1), etheraddr_string(ADDR2), - etheraddr_string(ADDR3))); + etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2), + etheraddr_string(ndo, ADDR3))); } else if (FC_TO_DS(fc) && !FC_FROM_DS(fc)) { if (srcp != NULL) *srcp = ADDR2; @@ -2125,8 +2125,8 @@ data_header_print(netdissect_options *ndo, if (!ndo->ndo_eflag) return; ND_PRINT((ndo, "BSSID:%s SA:%s DA:%s ", - etheraddr_string(ADDR1), etheraddr_string(ADDR2), - etheraddr_string(ADDR3))); + etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2), + etheraddr_string(ndo, ADDR3))); } else if (FC_TO_DS(fc) && FC_FROM_DS(fc)) { if (srcp != NULL) *srcp = ADDR4; @@ -2135,8 +2135,8 @@ data_header_print(netdissect_options *ndo, if (!ndo->ndo_eflag) return; ND_PRINT((ndo, "RA:%s TA:%s DA:%s SA:%s ", - etheraddr_string(ADDR1), etheraddr_string(ADDR2), - etheraddr_string(ADDR3), etheraddr_string(ADDR4))); + etheraddr_string(ndo, ADDR1), etheraddr_string(ndo, ADDR2), + etheraddr_string(ndo, ADDR3), etheraddr_string(ndo, ADDR4))); } #undef ADDR1 @@ -2159,8 +2159,8 @@ mgmt_header_print(netdissect_options *ndo, return; ND_PRINT((ndo, "BSSID:%s DA:%s SA:%s ", - etheraddr_string((hp)->bssid), etheraddr_string((hp)->da), - etheraddr_string((hp)->sa))); + etheraddr_string(ndo, (hp)->bssid), etheraddr_string(ndo, (hp)->da), + etheraddr_string(ndo, (hp)->sa))); } static void @@ -2178,42 +2178,42 @@ ctrl_header_print(netdissect_options *ndo, switch (FC_SUBTYPE(fc)) { case CTRL_BAR: ND_PRINT((ndo, " RA:%s TA:%s CTL(%x) SEQ(%u) ", - etheraddr_string(((const struct ctrl_bar_t *)p)->ra), - etheraddr_string(((const struct ctrl_bar_t *)p)->ta), + etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ra), + etheraddr_string(ndo, ((const struct ctrl_bar_t *)p)->ta), EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->ctl)), EXTRACT_LE_16BITS(&(((const struct ctrl_bar_t *)p)->seq)))); break; case CTRL_BA: ND_PRINT((ndo, "RA:%s ", - etheraddr_string(((const struct ctrl_ba_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_ba_t *)p)->ra))); break; case CTRL_PS_POLL: ND_PRINT((ndo, "BSSID:%s TA:%s ", - etheraddr_string(((const struct ctrl_ps_poll_t *)p)->bssid), - etheraddr_string(((const struct ctrl_ps_poll_t *)p)->ta))); + etheraddr_string(ndo, ((const struct ctrl_ps_poll_t *)p)->bssid), + etheraddr_string(ndo, ((const struct ctrl_ps_poll_t *)p)->ta))); break; case CTRL_RTS: ND_PRINT((ndo, "RA:%s TA:%s ", - etheraddr_string(((const struct ctrl_rts_t *)p)->ra), - etheraddr_string(((const struct ctrl_rts_t *)p)->ta))); + etheraddr_string(ndo, ((const struct ctrl_rts_t *)p)->ra), + etheraddr_string(ndo, ((const struct ctrl_rts_t *)p)->ta))); break; case CTRL_CTS: ND_PRINT((ndo, "RA:%s ", - etheraddr_string(((const struct ctrl_cts_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_cts_t *)p)->ra))); break; case CTRL_ACK: ND_PRINT((ndo, "RA:%s ", - etheraddr_string(((const struct ctrl_ack_t *)p)->ra))); + etheraddr_string(ndo, ((const struct ctrl_ack_t *)p)->ra))); break; case CTRL_CF_END: ND_PRINT((ndo, "RA:%s BSSID:%s ", - etheraddr_string(((const struct ctrl_end_t *)p)->ra), - etheraddr_string(((const struct ctrl_end_t *)p)->bssid))); + etheraddr_string(ndo, ((const struct ctrl_end_t *)p)->ra), + etheraddr_string(ndo, ((const struct ctrl_end_t *)p)->bssid))); break; case CTRL_END_ACK: ND_PRINT((ndo, "RA:%s BSSID:%s ", - etheraddr_string(((const struct ctrl_end_ack_t *)p)->ra), - etheraddr_string(((const struct ctrl_end_ack_t *)p)->bssid))); + etheraddr_string(ndo, ((const struct ctrl_end_ack_t *)p)->ra), + etheraddr_string(ndo, ((const struct ctrl_end_ack_t *)p)->bssid))); break; default: ND_PRINT((ndo, "(H) Unknown Ctrl Subtype")); @@ -2303,11 +2303,11 @@ ieee_802_11_hdr_print(netdissect_options *ndo, ND_PRINT((ndo, "MeshData (AE %d TTL %u seq %u", ae, mc->ttl, EXTRACT_LE_32BITS(mc->seq))); if (ae > 0) - ND_PRINT((ndo, " A4:%s", etheraddr_string(mc->addr4))); + ND_PRINT((ndo, " A4:%s", etheraddr_string(ndo, mc->addr4))); if (ae > 1) - ND_PRINT((ndo, " A5:%s", etheraddr_string(mc->addr5))); + ND_PRINT((ndo, " A5:%s", etheraddr_string(ndo, mc->addr5))); if (ae > 2) - ND_PRINT((ndo, " A6:%s", etheraddr_string(mc->addr6))); + ND_PRINT((ndo, " A6:%s", etheraddr_string(ndo, mc->addr6))); ND_PRINT((ndo, ") ")); } diff --git a/print-802_15_4.c b/print-802_15_4.c index 0e10e68d..d60503da 100644 --- a/print-802_15_4.c +++ b/print-802_15_4.c @@ -87,7 +87,7 @@ extract_header_length(u_int16_t fc) u_int -ieee802_15_4_if_print(struct netdissect_options *ndo, +ieee802_15_4_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { u_int caplen = h->caplen; diff --git a/print-ahcp.c b/print-ahcp.c index 5400ab44..280372da 100644 --- a/print-ahcp.c +++ b/print-ahcp.c @@ -152,7 +152,7 @@ ahcp_ipv6_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha goto corrupt; ND_TCHECK2(*cp, 16); #ifdef INET6 - ND_PRINT((ndo, "%s%s", sep, ip6addr_string(cp))); + ND_PRINT((ndo, "%s%s", sep, ip6addr_string(ndo, cp))); #else ND_PRINT((ndo, "%s(compiled w/o IPv6)", sep)); #endif /* INET6 */ @@ -178,7 +178,7 @@ ahcp_ipv4_addresses_print(netdissect_options *ndo, const u_char *cp, const u_cha if (cp + 4 > ep) goto corrupt; ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, "%s%s", sep, ipaddr_string(cp))); + ND_PRINT((ndo, "%s%s", sep, ipaddr_string(ndo, cp))); cp += 4; sep = ", "; } @@ -202,7 +202,7 @@ ahcp_ipv6_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char goto corrupt; ND_TCHECK2(*cp, 17); #ifdef INET6 - ND_PRINT((ndo, "%s%s/%u", sep, ip6addr_string(cp), *(cp + 16))); + ND_PRINT((ndo, "%s%s/%u", sep, ip6addr_string(ndo, cp), *(cp + 16))); #else ND_PRINT((ndo, "%s(compiled w/o IPv6)/%u", sep, *(cp + 16))); #endif /* INET6 */ @@ -228,7 +228,7 @@ ahcp_ipv4_prefixes_print(netdissect_options *ndo, const u_char *cp, const u_char if (cp + 5 > ep) goto corrupt; ND_TCHECK2(*cp, 5); - ND_PRINT((ndo, "%s%s/%u", sep, ipaddr_string(cp), *(cp + 4))); + ND_PRINT((ndo, "%s%s/%u", sep, ipaddr_string(ndo, cp), *(cp + 4))); cp += 5; sep = ", "; } @@ -386,11 +386,11 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) { cp += 4; /* Source Id */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", Source Id %s", linkaddr_string(cp, 0, 8))); + ND_PRINT((ndo, ", Source Id %s", linkaddr_string(ndo, cp, 0, 8))); cp += 8; /* Destination Id */ ND_TCHECK2(*cp, 8); - ND_PRINT((ndo, ", Destination Id %s", linkaddr_string(cp, 0, 8))); + ND_PRINT((ndo, ", Destination Id %s", linkaddr_string(ndo, cp, 0, 8))); cp += 8; } /* Body */ diff --git a/print-aodv.c b/print-aodv.c index e8ab1ca2..3d7ba36b 100644 --- a/print-aodv.c +++ b/print-aodv.c @@ -255,9 +255,9 @@ aodv_rreq(netdissect_options *ndo, ap->rreq.rreq_type & RREQ_UNKNOWN ? "[U] " : " ", ap->rreq.rreq_hops, (unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_id), - ipaddr_string(&ap->rreq.rreq_da), + ipaddr_string(ndo, &ap->rreq.rreq_da), (unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_ds), - ipaddr_string(&ap->rreq.rreq_oa), + ipaddr_string(ndo, &ap->rreq.rreq_oa), (unsigned long)EXTRACT_32BITS(&ap->rreq.rreq_os))); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (void *)(&ap->rreq + 1), i); @@ -285,9 +285,9 @@ aodv_rrep(netdissect_options *ndo, ap->rrep.rrep_type & RREP_ACK ? "[A] " : " ", ap->rrep.rrep_ps & RREP_PREFIX_MASK, ap->rrep.rrep_hops, - ipaddr_string(&ap->rrep.rrep_da), + ipaddr_string(ndo, &ap->rrep.rrep_da), (unsigned long)EXTRACT_32BITS(&ap->rrep.rrep_ds), - ipaddr_string(&ap->rrep.rrep_oa), + ipaddr_string(ndo, &ap->rrep.rrep_oa), (unsigned long)EXTRACT_32BITS(&ap->rrep.rrep_life))); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (void *)(&ap->rrep + 1), i); @@ -319,7 +319,7 @@ aodv_rerr(netdissect_options *ndo, trunc = n - (i/sizeof(ap->rerr.r.dest[0])); for (; i >= sizeof(ap->rerr.r.dest[0]); ++dp, i -= sizeof(ap->rerr.r.dest[0])) { - ND_PRINT((ndo, " {%s}(%ld)", ipaddr_string(&dp->u_da), + ND_PRINT((ndo, " {%s}(%ld)", ipaddr_string(ndo, &dp->u_da), (unsigned long)EXTRACT_32BITS(&dp->u_ds))); } if (trunc) @@ -357,9 +357,9 @@ aodv_v6_rreq(netdissect_options *ndo, ap->rreq6.rreq_type & RREQ_UNKNOWN ? "[U] " : " ", ap->rreq6.rreq_hops, (unsigned long)EXTRACT_32BITS(&ap->rreq6.rreq_id), - ip6addr_string(&ap->rreq6.rreq_da), + ip6addr_string(ndo, &ap->rreq6.rreq_da), (unsigned long)EXTRACT_32BITS(&ap->rreq6.rreq_ds), - ip6addr_string(&ap->rreq6.rreq_oa), + ip6addr_string(ndo, &ap->rreq6.rreq_oa), (unsigned long)EXTRACT_32BITS(&ap->rreq6.rreq_os))); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (void *)(&ap->rreq6 + 1), i); @@ -396,9 +396,9 @@ aodv_v6_rrep(netdissect_options *ndo, ap->rrep6.rrep_type & RREP_ACK ? "[A] " : " ", ap->rrep6.rrep_ps & RREP_PREFIX_MASK, ap->rrep6.rrep_hops, - ip6addr_string(&ap->rrep6.rrep_da), + ip6addr_string(ndo, &ap->rrep6.rrep_da), (unsigned long)EXTRACT_32BITS(&ap->rrep6.rrep_ds), - ip6addr_string(&ap->rrep6.rrep_oa), + ip6addr_string(ndo, &ap->rrep6.rrep_oa), (unsigned long)EXTRACT_32BITS(&ap->rrep6.rrep_life))); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (void *)(&ap->rrep6 + 1), i); @@ -429,7 +429,7 @@ aodv_v6_rerr(netdissect_options *ndo, ap->rerr.rerr_dc, length)); trunc = n - (i/j); for (; i -= j >= 0; ++dp6) { - ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(&dp6->u_da), + ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da), (unsigned long)EXTRACT_32BITS(&dp6->u_ds))); } if (trunc) @@ -471,9 +471,9 @@ aodv_v6_draft_01_rreq(netdissect_options *ndo, ap->rreq6_draft_01.rreq_type & RREQ_UNKNOWN ? "[U] " : " ", ap->rreq6_draft_01.rreq_hops, (unsigned long)EXTRACT_32BITS(&ap->rreq6_draft_01.rreq_id), - ip6addr_string(&ap->rreq6_draft_01.rreq_da), + ip6addr_string(ndo, &ap->rreq6_draft_01.rreq_da), (unsigned long)EXTRACT_32BITS(&ap->rreq6_draft_01.rreq_ds), - ip6addr_string(&ap->rreq6_draft_01.rreq_oa), + ip6addr_string(ndo, &ap->rreq6_draft_01.rreq_oa), (unsigned long)EXTRACT_32BITS(&ap->rreq6_draft_01.rreq_os))); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (void *)(&ap->rreq6_draft_01 + 1), i); @@ -511,9 +511,9 @@ aodv_v6_draft_01_rrep(netdissect_options *ndo, ap->rrep6_draft_01.rrep_type & RREP_ACK ? "[A] " : " ", ap->rrep6_draft_01.rrep_ps & RREP_PREFIX_MASK, ap->rrep6_draft_01.rrep_hops, - ip6addr_string(&ap->rrep6_draft_01.rrep_da), + ip6addr_string(ndo, &ap->rrep6_draft_01.rrep_da), (unsigned long)EXTRACT_32BITS(&ap->rrep6_draft_01.rrep_ds), - ip6addr_string(&ap->rrep6_draft_01.rrep_oa), + ip6addr_string(ndo, &ap->rrep6_draft_01.rrep_oa), (unsigned long)EXTRACT_32BITS(&ap->rrep6_draft_01.rrep_life))); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (void *)(&ap->rrep6_draft_01 + 1), i); @@ -544,7 +544,7 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, ap->rerr.rerr_dc, length)); trunc = n - (i/j); for (; i -= j >= 0; ++dp6) { - ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(&dp6->u_da), + ND_PRINT((ndo, " {%s}(%ld)", ip6addr_string(ndo, &dp6->u_da), (unsigned long)EXTRACT_32BITS(&dp6->u_ds))); } if (trunc) diff --git a/print-ap1394.c b/print-ap1394.c index 3ce31b1c..39600811 100644 --- a/print-ap1394.c +++ b/print-ap1394.c @@ -57,8 +57,8 @@ ap1394_hdr_print(netdissect_options *ndo, register const u_char *bp, u_int lengt fp = (const struct firewire_header *)bp; ND_PRINT((ndo, "%s > %s", - linkaddr_string(fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN), - linkaddr_string(fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN))); + linkaddr_string(ndo, fp->firewire_dhost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN), + linkaddr_string(ndo, fp->firewire_shost, LINKADDR_IEEE1394, FIREWIRE_EUI64_LEN))); firewire_type = EXTRACT_16BITS(&fp->firewire_type); if (!ndo->ndo_qflag) { diff --git a/print-arp.c b/print-arp.c index d9a6535a..b1cc7fc7 100644 --- a/print-arp.c +++ b/print-arp.c @@ -186,10 +186,10 @@ atmarp_addr_print(netdissect_options *ndo, if (ha_len == 0) ND_PRINT((ndo, "")); else { - ND_PRINT((ndo, "%s", linkaddr_string(ha, LINKADDR_ATM, ha_len))); + ND_PRINT((ndo, "%s", linkaddr_string(ndo, ha, LINKADDR_ATM, ha_len))); if (srca_len != 0) ND_PRINT((ndo, ",%s", - linkaddr_string(srca, LINKADDR_ATM, srca_len))); + linkaddr_string(ndo, srca, LINKADDR_ATM, srca_len))); } } @@ -241,18 +241,18 @@ atmarp_print(netdissect_options *ndo, switch (op) { case ARPOP_REQUEST: - ND_PRINT((ndo, "who-has %s", ipaddr_string(ATMTPA(ap)))); + ND_PRINT((ndo, "who-has %s", ipaddr_string(ndo, ATMTPA(ap)))); if (ATMTHRD_LEN(ap) != 0) { ND_PRINT((ndo, " (")); atmarp_addr_print(ndo, ATMTHA(ap), ATMTHRD_LEN(ap), ATMTSA(ap), ATMTSLN(ap)); ND_PRINT((ndo, ")")); } - ND_PRINT((ndo, "tell %s", ipaddr_string(ATMSPA(ap)))); + ND_PRINT((ndo, "tell %s", ipaddr_string(ndo, ATMSPA(ap)))); break; case ARPOP_REPLY: - ND_PRINT((ndo, "%s is-at ", ipaddr_string(ATMSPA(ap)))); + ND_PRINT((ndo, "%s is-at ", ipaddr_string(ndo, ATMSPA(ap)))); atmarp_addr_print(ndo, ATMSHA(ap), ATMSHRD_LEN(ap), ATMSSA(ap), ATMSSLN(ap)); break; @@ -269,11 +269,11 @@ atmarp_print(netdissect_options *ndo, case ARPOP_INVREPLY: atmarp_addr_print(ndo, ATMSHA(ap), ATMSHRD_LEN(ap), ATMSSA(ap), ATMSSLN(ap)); - ND_PRINT((ndo, "at %s", ipaddr_string(ATMSPA(ap)))); + ND_PRINT((ndo, "at %s", ipaddr_string(ndo, ATMSPA(ap)))); break; case ARPOP_NAK: - ND_PRINT((ndo, "for %s", ipaddr_string(ATMSPA(ap)))); + ND_PRINT((ndo, "for %s", ipaddr_string(ndo, ATMSPA(ap)))); break; default: @@ -307,7 +307,7 @@ arp_print(netdissect_options *ndo, /* if its ATM then call the ATM ARP printer for Frame-relay ARP most of the fields are similar to Ethernet so overload the Ethernet Printer - and set the linkaddr type for linkaddr_string() accordingly */ + and set the linkaddr type for linkaddr_string(ndo, ) accordingly */ switch(hrd) { case ARPHRD_ATM2225: @@ -356,41 +356,41 @@ arp_print(netdissect_options *ndo, switch (op) { case ARPOP_REQUEST: - ND_PRINT((ndo, "who-has %s", ipaddr_string(TPA(ap)))); + ND_PRINT((ndo, "who-has %s", ipaddr_string(ndo, TPA(ap)))); if (memcmp((const char *)ezero, (const char *)THA(ap), HRD_LEN(ap)) != 0) ND_PRINT((ndo, " (%s)", - linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)))); - ND_PRINT((ndo, " tell %s", ipaddr_string(SPA(ap)))); + linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap)))); + ND_PRINT((ndo, " tell %s", ipaddr_string(ndo, SPA(ap)))); break; case ARPOP_REPLY: ND_PRINT((ndo, "%s is-at %s", - ipaddr_string(SPA(ap)), - linkaddr_string(SHA(ap), linkaddr, HRD_LEN(ap)))); + ipaddr_string(ndo, SPA(ap)), + linkaddr_string(ndo, SHA(ap), linkaddr, HRD_LEN(ap)))); break; case ARPOP_REVREQUEST: ND_PRINT((ndo, "who-is %s tell %s", - linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)), - linkaddr_string(SHA(ap), linkaddr, HRD_LEN(ap)))); + linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap)), + linkaddr_string(ndo, SHA(ap), linkaddr, HRD_LEN(ap)))); break; case ARPOP_REVREPLY: ND_PRINT((ndo, "%s at %s", - linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)), - ipaddr_string(TPA(ap)))); + linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap)), + ipaddr_string(ndo, TPA(ap)))); break; case ARPOP_INVREQUEST: ND_PRINT((ndo, "who-is %s tell %s", - linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)), - linkaddr_string(SHA(ap), linkaddr, HRD_LEN(ap)))); + linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap)), + linkaddr_string(ndo, SHA(ap), linkaddr, HRD_LEN(ap)))); break; case ARPOP_INVREPLY: ND_PRINT((ndo,"%s at %s", - linkaddr_string(THA(ap), linkaddr, HRD_LEN(ap)), - ipaddr_string(TPA(ap)))); + linkaddr_string(ndo, THA(ap), linkaddr, HRD_LEN(ap)), + ipaddr_string(ndo, TPA(ap)))); break; default: diff --git a/print-atalk.c b/print-atalk.c index 732e6112..9be3d079 100644 --- a/print-atalk.c +++ b/print-atalk.c @@ -204,7 +204,7 @@ aarp_print(netdissect_options *ndo, return; case 2: /* response */ - ND_PRINT((ndo, "reply %s is-at %s", AT(psaddr), etheraddr_string(ap->hsaddr))); + ND_PRINT((ndo, "reply %s is-at %s", AT(psaddr), etheraddr_string(ndo, ap->hsaddr))); return; case 3: /* probe (oy!) */ diff --git a/print-babel.c b/print-babel.c index 6b037328..1e2f7e82 100644 --- a/print-babel.c +++ b/print-babel.c @@ -36,8 +36,8 @@ #include #include -#include "addrtoname.h" #include "interface.h" +#include "addrtoname.h" #include "extract.h" static const char tstr[] = "[|babel]"; @@ -115,14 +115,14 @@ static const unsigned char v4prefix[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 0 }; static const char * -format_prefix(const u_char *prefix, unsigned char plen) +format_prefix(netdissect_options *ndo, const u_char *prefix, unsigned char plen) { static char buf[50]; if(plen >= 96 && memcmp(prefix, v4prefix, 12) == 0) - snprintf(buf, 50, "%s/%u", ipaddr_string(prefix + 12), plen - 96); + snprintf(buf, 50, "%s/%u", ipaddr_string(ndo, prefix + 12), plen - 96); else #ifdef INET6 - snprintf(buf, 50, "%s/%u", ip6addr_string(prefix), plen); + snprintf(buf, 50, "%s/%u", ip6addr_string(ndo, prefix), plen); #else snprintf(buf, 50, "IPv6 addresses not supported"); #endif @@ -131,13 +131,13 @@ format_prefix(const u_char *prefix, unsigned char plen) } static const char * -format_address(const u_char *prefix) +format_address(netdissect_options *ndo, const u_char *prefix) { if(memcmp(prefix, v4prefix, 12) == 0) - return ipaddr_string(prefix + 12); + return ipaddr_string(ndo, prefix + 12); else #ifdef INET6 - return ip6addr_string(prefix); + return ip6addr_string(ndo, prefix); #else return "IPv6 addresses not supported"; #endif @@ -404,7 +404,7 @@ babel_print_v2(netdissect_options *ndo, rc = network_address(message[2], message + 8, len - 6, address); if(rc < 0) { ND_PRINT((ndo, "%s", tstr)); break; } ND_PRINT((ndo, "%s txcost %u interval %s", - format_address(address), txcost, format_interval(interval))); + format_address(ndo, address), txcost, format_interval(interval))); } } break; @@ -430,7 +430,7 @@ babel_print_v2(netdissect_options *ndo, if(len < 2) goto corrupt; rc = network_address(message[2], message + 4, len - 2, nh); if(rc < 0) goto corrupt; - ND_PRINT((ndo, " %s", format_address(nh))); + ND_PRINT((ndo, " %s", format_address(ndo, nh))); } } break; @@ -465,7 +465,7 @@ babel_print_v2(netdissect_options *ndo, (message[3] & 0x80) ? "/prefix": "", (message[3] & 0x40) ? "/id" : "", (message[3] & 0x3f) ? "/unknown" : "", - format_prefix(prefix, plen), + format_prefix(ndo, prefix, plen), metric, seqno, format_interval_update(interval))); if(message[3] & 0x80) { if(message[2] == 1) @@ -493,7 +493,7 @@ babel_print_v2(netdissect_options *ndo, message + 4, NULL, len - 2, prefix); if(rc < 0) goto corrupt; ND_PRINT((ndo, "for %s", - message[2] == 0 ? "any" : format_prefix(prefix, plen))); + message[2] == 0 ? "any" : format_prefix(ndo, prefix, plen))); } } break; @@ -513,7 +513,7 @@ babel_print_v2(netdissect_options *ndo, if(rc < 0) goto corrupt; plen = message[3] + (message[2] == 1 ? 96 : 0); ND_PRINT((ndo, "(%u hops) for %s seqno %u id %s", - message[6], format_prefix(prefix, plen), + message[6], format_prefix(ndo, prefix, plen), seqno, format_id(message + 8))); } } diff --git a/print-bgp.c b/print-bgp.c index eab6747d..283a2d58 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -503,7 +503,7 @@ decode_prefix4(netdissect_options *ndo, ((u_char *)&addr)[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } - snprintf(buf, buflen, "%s/%d", getname((u_char *)&addr), plen); + snprintf(buf, buflen, "%s/%d", getname(ndo, (u_char *)&addr), plen); return 1 + plenbytes; trunc: @@ -553,7 +553,7 @@ decode_labeled_prefix4(netdissect_options *ndo, } /* the label may get offsetted by 4 bits so lets shift it right */ snprintf(buf, buflen, "%s/%d, label:%u %s", - getname((u_char *)&addr), + getname(ndo, (u_char *)&addr), plen, EXTRACT_24BITS(pptr+1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -583,12 +583,12 @@ bgp_vpn_ip_print(netdissect_options *ndo, switch(addr_length) { case (sizeof(struct in_addr) << 3): /* 32 */ ND_TCHECK2(pptr[0], sizeof(struct in_addr)); - snprintf(pos, sizeof(addr), "%s", ipaddr_string(pptr)); + snprintf(pos, sizeof(addr), "%s", ipaddr_string(ndo, pptr)); break; #ifdef INET6 case (sizeof(struct in6_addr) << 3): /* 128 */ ND_TCHECK2(pptr[0], sizeof(struct in6_addr)); - snprintf(pos, sizeof(addr), "%s", ip6addr_string(pptr)); + snprintf(pos, sizeof(addr), "%s", ip6addr_string(ndo, pptr)); break; #endif default: @@ -772,7 +772,7 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo, /* the label may get offsetted by 4 bits so lets shift it right */ snprintf(buf, buflen, "RD: %s, %s/%d, label:%u %s", bgp_vpn_rd_print(ndo, pptr+4), - getname((u_char *)&addr), + getname(ndo, (u_char *)&addr), plen, EXTRACT_24BITS(pptr+1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -824,7 +824,7 @@ decode_mdt_vpn_nlri(netdissect_options *ndo, ND_TCHECK2(pptr[0], sizeof(struct in_addr)); snprintf(buf, buflen, "RD: %s, VPN IP Address: %s, MC Group Address: %s", - bgp_vpn_rd_print(ndo, rd), ipaddr_string(vpn_ip), ipaddr_string(pptr)); + bgp_vpn_rd_print(ndo, rd), ipaddr_string(ndo, vpn_ip), ipaddr_string(ndo, pptr)); return MDT_VPN_NLRI_LEN + 1; @@ -978,8 +978,8 @@ decode_labeled_vpn_l2(netdissect_options *ndo, buf[0]='\0'; strlen=snprintf(buf, buflen, "RD: %s, BGPNH: %s", bgp_vpn_rd_print(ndo, pptr), - /* need something like getname() here */ - getname(pptr+8) + /* need something like getname(ndo, ) here */ + getname(ndo, pptr+8) ); UPDATE_BUF_BUFLEN(buf, buflen, strlen); pptr+=12; @@ -1075,7 +1075,7 @@ decode_prefix6(netdissect_options *ndo, addr.s6_addr[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } - snprintf(buf, buflen, "%s/%d", getname6((u_char *)&addr), plen); + snprintf(buf, buflen, "%s/%d", getname6(ndo, (u_char *)&addr), plen); return 1 + plenbytes; trunc: @@ -1116,7 +1116,7 @@ decode_labeled_prefix6(netdissect_options *ndo, } /* the label may get offsetted by 4 bits so lets shift it right */ snprintf(buf, buflen, "%s/%d, label:%u %s", - getname6((u_char *)&addr), + getname6(ndo, (u_char *)&addr), plen, EXTRACT_24BITS(pptr+1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -1158,7 +1158,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo, /* the label may get offsetted by 4 bits so lets shift it right */ snprintf(buf, buflen, "RD: %s, %s/%d, label:%u %s", bgp_vpn_rd_print(ndo, pptr+4), - getname6((u_char *)&addr), + getname6(ndo, (u_char *)&addr), plen, EXTRACT_24BITS(pptr+1)>>4, ((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -1382,7 +1382,7 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, "invalid len")); else { ND_TCHECK2(tptr[0], 4); - ND_PRINT((ndo, "%s", getname(tptr))); + ND_PRINT((ndo, "%s", getname(ndo, tptr))); } break; case BGPTYPE_MULTI_EXIT_DISC: @@ -1412,11 +1412,11 @@ bgp_attr_print(netdissect_options *ndo, if (len == 6) { ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_16BITS(tptr)), - getname(tptr + 2))); + getname(ndo, tptr + 2))); } else { ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), - EXTRACT_32BITS(tptr)), getname(tptr + 4))); + EXTRACT_32BITS(tptr)), getname(ndo, tptr + 4))); } break; case BGPTYPE_AGGREGATOR4: @@ -1427,7 +1427,7 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, " AS #%s, origin %s", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(tptr)), - getname(tptr + 4))); + getname(ndo, tptr + 4))); break; case BGPTYPE_COMMUNITIES: if (len % 4) { @@ -1465,7 +1465,7 @@ bgp_attr_print(netdissect_options *ndo, break; } ND_TCHECK2(tptr[0], 4); - ND_PRINT((ndo, "%s",getname(tptr))); + ND_PRINT((ndo, "%s",getname(ndo, tptr))); break; case BGPTYPE_CLUSTER_LIST: if (len % 4) { @@ -1475,7 +1475,7 @@ bgp_attr_print(netdissect_options *ndo, while (tlen>0) { ND_TCHECK2(tptr[0], 4); ND_PRINT((ndo, "%s%s", - getname(tptr), + getname(ndo, tptr), (tlen>4) ? ", " : "")); tlen -=4; tptr +=4; @@ -1562,7 +1562,7 @@ bgp_attr_print(netdissect_options *ndo, tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in_addr)); - ND_PRINT((ndo, "%s",getname(tptr))); + ND_PRINT((ndo, "%s",getname(ndo, tptr))); tlen -= sizeof(struct in_addr); tptr += sizeof(struct in_addr); } @@ -1577,7 +1577,7 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], sizeof(struct in_addr)+BGP_VPN_RD_LEN); ND_PRINT((ndo, "RD: %s, %s", bgp_vpn_rd_print(ndo, tptr), - getname(tptr+BGP_VPN_RD_LEN))); + getname(ndo, tptr+BGP_VPN_RD_LEN))); tlen -= (sizeof(struct in_addr)+BGP_VPN_RD_LEN); tptr += (sizeof(struct in_addr)+BGP_VPN_RD_LEN); } @@ -1592,7 +1592,7 @@ bgp_attr_print(netdissect_options *ndo, tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in6_addr)); - ND_PRINT((ndo, "%s", getname6(tptr))); + ND_PRINT((ndo, "%s", getname6(ndo, tptr))); tlen -= sizeof(struct in6_addr); tptr += sizeof(struct in6_addr); } @@ -1607,7 +1607,7 @@ bgp_attr_print(netdissect_options *ndo, ND_TCHECK2(tptr[0], sizeof(struct in6_addr)+BGP_VPN_RD_LEN); ND_PRINT((ndo, "RD: %s, %s", bgp_vpn_rd_print(ndo, tptr), - getname6(tptr+BGP_VPN_RD_LEN))); + getname6(ndo, tptr+BGP_VPN_RD_LEN))); tlen -= (sizeof(struct in6_addr)+BGP_VPN_RD_LEN); tptr += (sizeof(struct in6_addr)+BGP_VPN_RD_LEN); } @@ -1622,7 +1622,7 @@ bgp_attr_print(netdissect_options *ndo, tlen = 0; } else { ND_TCHECK2(tptr[0], sizeof(struct in_addr)); - ND_PRINT((ndo, "%s", getname(tptr))); + ND_PRINT((ndo, "%s", getname(ndo, tptr))); tlen -= (sizeof(struct in_addr)); tptr += (sizeof(struct in_addr)); } @@ -1649,11 +1649,11 @@ bgp_attr_print(netdissect_options *ndo, isonsap_string(tptr+BGP_VPN_RD_LEN,tlen-BGP_VPN_RD_LEN))); /* rfc986 mapped IPv4 address ? */ if (EXTRACT_32BITS(tptr+BGP_VPN_RD_LEN) == 0x47000601) - ND_PRINT((ndo, " = %s", getname(tptr+BGP_VPN_RD_LEN+4))); + ND_PRINT((ndo, " = %s", getname(ndo, tptr+BGP_VPN_RD_LEN+4))); #ifdef INET6 /* rfc1888 mapped IPv6 address ? */ else if (EXTRACT_24BITS(tptr+BGP_VPN_RD_LEN) == 0x350000) - ND_PRINT((ndo, " = %s", getname6(tptr+BGP_VPN_RD_LEN+3))); + ND_PRINT((ndo, " = %s", getname6(ndo, tptr+BGP_VPN_RD_LEN+3))); #endif tptr += tlen; tlen = 0; @@ -2028,14 +2028,14 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, ": %u:%u (= %s)", EXTRACT_16BITS(tptr+2), EXTRACT_32BITS(tptr+4), - getname(tptr+4))); + getname(ndo, tptr+4))); break; case BGP_EXT_COM_RT_1: case BGP_EXT_COM_RO_1: case BGP_EXT_COM_L2VPN_RT_1: case BGP_EXT_COM_VRF_RT_IMP: ND_PRINT((ndo, ": %s:%u", - getname(tptr+2), + getname(ndo, tptr+2), EXTRACT_16BITS(tptr+6))); break; case BGP_EXT_COM_RT_2: @@ -2055,12 +2055,12 @@ bgp_attr_print(netdissect_options *ndo, case BGP_EXT_COM_VPN_ORIGIN4: case BGP_EXT_COM_OSPF_RID: case BGP_EXT_COM_OSPF_RID2: - ND_PRINT((ndo, "%s", getname(tptr+2))); + ND_PRINT((ndo, "%s", getname(ndo, tptr+2))); break; case BGP_EXT_COM_OSPF_RTYPE: case BGP_EXT_COM_OSPF_RTYPE2: ND_PRINT((ndo, ": area:%s, router-type:%s, metric-type:%s%s", - getname(tptr+2), + getname(ndo, tptr+2), tok2strbuf(bgp_extd_comm_ospf_rtype_values, "unknown (0x%02x)", *(tptr+6), @@ -2113,32 +2113,32 @@ bgp_attr_print(netdissect_options *ndo, case BGP_PMSI_TUNNEL_PIM_BIDIR: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Sender %s, P-Group %s", - ipaddr_string(tptr), - ipaddr_string(tptr+4))); + ipaddr_string(ndo, tptr), + ipaddr_string(ndo, tptr+4))); break; case BGP_PMSI_TUNNEL_PIM_SSM: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Root-Node %s, P-Group %s", - ipaddr_string(tptr), - ipaddr_string(tptr+4))); + ipaddr_string(ndo, tptr), + ipaddr_string(ndo, tptr+4))); break; case BGP_PMSI_TUNNEL_INGRESS: ND_TCHECK2(tptr[0], 4); ND_PRINT((ndo, "\n\t Tunnel-Endpoint %s", - ipaddr_string(tptr))); + ipaddr_string(ndo, tptr))); break; case BGP_PMSI_TUNNEL_LDP_P2MP: /* fall through */ case BGP_PMSI_TUNNEL_LDP_MP2MP: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Root-Node %s, LSP-ID 0x%08x", - ipaddr_string(tptr), + ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr+4))); break; case BGP_PMSI_TUNNEL_RSVP_P2MP: ND_TCHECK2(tptr[0], 8); ND_PRINT((ndo, "\n\t Extended-Tunnel-ID %s, P2MP-ID 0x%08x", - ipaddr_string(tptr), + ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr+4))); break; default: @@ -2320,7 +2320,7 @@ bgp_open_print(netdissect_options *ndo, ND_PRINT((ndo, "my AS %s, ", as_printf(ndo, astostr, sizeof(astostr), ntohs(bgpo.bgpo_myas)))); ND_PRINT((ndo, "Holdtime %us, ", ntohs(bgpo.bgpo_holdtime))); - ND_PRINT((ndo, "ID %s", getname((u_char *)&bgpo.bgpo_id))); + ND_PRINT((ndo, "ID %s", getname(ndo, (u_char *)&bgpo.bgpo_id))); ND_PRINT((ndo, "\n\t Optional parameters, length: %u", bgpo.bgpo_optlen)); /* some little sanity checking */ diff --git a/print-bootp.c b/print-bootp.c index 10333700..7d08e22e 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -71,7 +71,7 @@ bootp_print(netdissect_options *ndo, if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) { ND_TCHECK2(bp->bp_chaddr[0], 6); - ND_PRINT((ndo, " from %s", etheraddr_string(bp->bp_chaddr))); + ND_PRINT((ndo, " from %s", etheraddr_string(ndo, bp->bp_chaddr))); } ND_PRINT((ndo, ", length %u", length)); @@ -105,27 +105,27 @@ bootp_print(netdissect_options *ndo, /* Client's ip address */ ND_TCHECK(bp->bp_ciaddr); if (EXTRACT_32BITS(&bp->bp_ciaddr.s_addr)) - ND_PRINT((ndo, "\n\t Client-IP %s", ipaddr_string(&bp->bp_ciaddr))); + ND_PRINT((ndo, "\n\t Client-IP %s", ipaddr_string(ndo, &bp->bp_ciaddr))); /* 'your' ip address (bootp client) */ ND_TCHECK(bp->bp_yiaddr); if (EXTRACT_32BITS(&bp->bp_yiaddr.s_addr)) - ND_PRINT((ndo, "\n\t Your-IP %s", ipaddr_string(&bp->bp_yiaddr))); + ND_PRINT((ndo, "\n\t Your-IP %s", ipaddr_string(ndo, &bp->bp_yiaddr))); /* Server's ip address */ ND_TCHECK(bp->bp_siaddr); if (EXTRACT_32BITS(&bp->bp_siaddr.s_addr)) - ND_PRINT((ndo, "\n\t Server-IP %s", ipaddr_string(&bp->bp_siaddr))); + ND_PRINT((ndo, "\n\t Server-IP %s", ipaddr_string(ndo, &bp->bp_siaddr))); /* Gateway's ip address */ ND_TCHECK(bp->bp_giaddr); if (EXTRACT_32BITS(&bp->bp_giaddr.s_addr)) - ND_PRINT((ndo, "\n\t Gateway-IP %s", ipaddr_string(&bp->bp_giaddr))); + ND_PRINT((ndo, "\n\t Gateway-IP %s", ipaddr_string(ndo, &bp->bp_giaddr))); /* Client's Ethernet address */ if (bp->bp_htype == 1 && bp->bp_hlen == 6) { ND_TCHECK2(bp->bp_chaddr[0], 6); - ND_PRINT((ndo, "\n\t Client-Ethernet-Address %s", etheraddr_string(bp->bp_chaddr))); + ND_PRINT((ndo, "\n\t Client-Ethernet-Address %s", etheraddr_string(ndo, bp->bp_chaddr))); } ND_TCHECK2(bp->bp_sname[0], 1); /* check first char only */ @@ -494,7 +494,7 @@ rfc1048_print(netdissect_options *ndo, ul = EXTRACT_32BITS(bp); if (c == 'i') { ul = htonl(ul); - ND_PRINT((ndo, "%s", ipaddr_string(&ul))); + ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ul))); } else if (c == 'L') ND_PRINT((ndo, "%d", ul)); else @@ -511,10 +511,10 @@ rfc1048_print(netdissect_options *ndo, if (!first) ND_PRINT((ndo, ",")); memcpy((char *)&ul, (const char *)bp, sizeof(ul)); - ND_PRINT((ndo, "(%s:", ipaddr_string(&ul))); + ND_PRINT((ndo, "(%s:", ipaddr_string(ndo, &ul))); bp += sizeof(ul); memcpy((char *)&ul, (const char *)bp, sizeof(ul)); - ND_PRINT((ndo, "%s)", ipaddr_string(&ul))); + ND_PRINT((ndo, "%s)", ipaddr_string(ndo, &ul))); bp += sizeof(ul); len -= 2*sizeof(ul); first = 0; @@ -743,7 +743,7 @@ rfc1048_print(netdissect_options *ndo, ND_PRINT((ndo, "/%d", mask_width)); } memcpy((char *)&ul, (const char *)bp, sizeof(ul)); - ND_PRINT((ndo, ":%s)", ipaddr_string(&ul))); + ND_PRINT((ndo, ":%s)", ipaddr_string(ndo, &ul))); bp += sizeof(ul); len -= (significant_octets + 4); first = 0; @@ -779,7 +779,7 @@ cmu_print(netdissect_options *ndo, #define PRINTCMUADDR(m, s) { ND_TCHECK(cmu->m); \ if (cmu->m.s_addr != 0) \ - ND_PRINT((ndo, " %s:%s", s, ipaddr_string(&cmu->m.s_addr))); } + ND_PRINT((ndo, " %s:%s", s, ipaddr_string(ndo, &cmu->m.s_addr))); } ND_PRINT((ndo, " vend-cmu")); cmu = (const struct cmu_vend *)bp; diff --git a/print-calm-fast.c b/print-calm-fast.c index 324a118c..5cc39f41 100644 --- a/print-calm-fast.c +++ b/print-calm-fast.c @@ -43,7 +43,7 @@ calm_fast_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_ length -= 2; bp += 2; - ND_PRINT((ndo, "CALM FAST src:%s; ", etheraddr_string(eth+6))); + ND_PRINT((ndo, "CALM FAST src:%s; ", etheraddr_string(ndo, eth+6))); ND_PRINT((ndo, "SrcNwref:%d; ", srcNwref)); ND_PRINT((ndo, "DstNwref:%d; ", dstNwref)); diff --git a/print-cdp.c b/print-cdp.c index 880b81cd..353ce4c1 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -282,7 +282,7 @@ cdp_print_addr(netdissect_options *ndo, ND_TCHECK2(*p, 4); if (p + 4 > endp) goto trunc; - ND_PRINT((ndo, "IPv4 (%u) %s", num, ipaddr_string(p))); + ND_PRINT((ndo, "IPv4 (%u) %s", num, ipaddr_string(ndo, p))); p += 4; } #ifdef INET6 @@ -299,7 +299,7 @@ cdp_print_addr(netdissect_options *ndo, if (p + al > endp) goto trunc; - ND_PRINT((ndo, "IPv6 (%u) %s", num, ip6addr_string(p))); + ND_PRINT((ndo, "IPv6 (%u) %s", num, ip6addr_string(ndo, p))); p += al; } #endif diff --git a/print-cfm.c b/print-cfm.c index 6901b898..25fac19b 100644 --- a/print-cfm.c +++ b/print-cfm.c @@ -247,12 +247,12 @@ cfm_mgmt_addr_print(netdissect_options *ndo, */ switch(mgmt_addr_type) { case AFNUM_INET: - ND_PRINT((ndo, ", %s", ipaddr_string(tptr + 1))); + ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr + 1))); break; #ifdef INET6 case AFNUM_INET6: - ND_PRINT((ndo, ", %s", ip6addr_string(tptr + 1))); + ND_PRINT((ndo, ", %s", ip6addr_string(ndo, tptr + 1))); break; #endif @@ -268,13 +268,13 @@ cfm_mgmt_addr_print(netdissect_options *ndo, * The egress-ID string is a 16-Bit string plus a MAC address. */ static const char * -cfm_egress_id_string(register const u_char *tptr) { +cfm_egress_id_string(netdissect_options *ndo, register const u_char *tptr) { static char egress_id_buffer[80]; snprintf(egress_id_buffer, sizeof(egress_id_buffer), "MAC 0x%4x-%s", EXTRACT_16BITS(tptr), - etheraddr_string(tptr+2)); + etheraddr_string(ndo, tptr+2)); return egress_id_buffer; } @@ -371,7 +371,7 @@ cfm_print(netdissect_options *ndo, break; case CFM_CCM_MD_FORMAT_MAC: - ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string( + ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(ndo, msg_ptr.cfm_ccm->md_name))); break; @@ -421,12 +421,12 @@ cfm_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, Egress-ID %s, ttl %u", EXTRACT_32BITS(msg_ptr.cfm_ltm->transaction_id), - cfm_egress_id_string(msg_ptr.cfm_ltm->egress_id), + cfm_egress_id_string(ndo, msg_ptr.cfm_ltm->egress_id), msg_ptr.cfm_ltm->ttl)); ND_PRINT((ndo, "\n\t Original-MAC %s, Target-MAC %s", - etheraddr_string(msg_ptr.cfm_ltm->original_mac), - etheraddr_string(msg_ptr.cfm_ltm->target_mac))); + etheraddr_string(ndo, msg_ptr.cfm_ltm->original_mac), + etheraddr_string(ndo, msg_ptr.cfm_ltm->target_mac))); break; case CFM_OPCODE_LTR: @@ -437,10 +437,10 @@ cfm_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Transaction-ID 0x%08x, Last-Egress-ID %s", EXTRACT_32BITS(msg_ptr.cfm_ltr->transaction_id), - cfm_egress_id_string(msg_ptr.cfm_ltr->last_egress_id))); + cfm_egress_id_string(ndo, msg_ptr.cfm_ltr->last_egress_id))); ND_PRINT((ndo, "\n\t Next-Egress-ID %s, ttl %u", - cfm_egress_id_string(msg_ptr.cfm_ltr->next_egress_id), + cfm_egress_id_string(ndo, msg_ptr.cfm_ltr->next_egress_id), msg_ptr.cfm_ltr->ttl)); ND_PRINT((ndo, "\n\t Replay-Action %s (%u)", @@ -565,7 +565,7 @@ cfm_print(netdissect_options *ndo, switch (chassis_id_type) { case CFM_CHASSIS_ID_MAC_ADDRESS: - ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(tptr + 1))); + ND_PRINT((ndo, "\n\t MAC %s", etheraddr_string(ndo, tptr + 1))); break; case CFM_CHASSIS_ID_NETWORK_ADDRESS: diff --git a/print-chdlc.c b/print-chdlc.c index 9ef550f5..7b2b66ba 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -161,8 +161,8 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) break; case SLARP_REPLY: ND_PRINT((ndo, "reply %s/%s", - ipaddr_string(&slarp->un.addr.addr), - ipaddr_string(&slarp->un.addr.mask))); + ipaddr_string(ndo, &slarp->un.addr.addr), + ipaddr_string(ndo, &slarp->un.addr.mask))); break; case SLARP_KEEPALIVE: ND_PRINT((ndo, "keepalive: mineseen=0x%08x, yourseen=0x%08x, reliability=0x%04x", diff --git a/print-dccp.c b/print-dccp.c index d8a98755..891c2a55 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -303,14 +303,14 @@ void dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, #ifdef INET6 if (ip6) { ND_PRINT((ndo, "%s.%d > %s.%d: ", - ip6addr_string(&ip6->ip6_src), sport, - ip6addr_string(&ip6->ip6_dst), dport)); + ip6addr_string(ndo, &ip6->ip6_src), sport, + ip6addr_string(ndo, &ip6->ip6_dst), dport)); } else #endif /*INET6*/ { ND_PRINT((ndo, "%s.%d > %s.%d: ", - ipaddr_string(&ip->ip_src), sport, - ipaddr_string(&ip->ip_dst), dport)); + ipaddr_string(ndo, &ip->ip_src), sport, + ipaddr_string(ndo, &ip->ip_dst), dport)); } if (ndo->ndo_qflag) { diff --git a/print-decnet.c b/print-decnet.c index e29691fb..a1546217 100644 --- a/print-decnet.c +++ b/print-decnet.c @@ -591,7 +591,7 @@ decnet_print(netdissect_options *ndo, } 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 ")); @@ -640,7 +640,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, 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; @@ -651,7 +651,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, 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)); + ND_PRINT((ndo, "src %s fcnval %o", dnaddr_string(ndo, src), other)); ret = 1; break; case RMF_TEST: @@ -661,7 +661,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, 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)); + ND_PRINT((ndo, "src %s data %o", dnaddr_string(ndo, src), other)); ret = 1; break; case RMF_L1ROUT: @@ -670,7 +670,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 +680,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; @@ -702,7 +702,7 @@ print_decnet_ctlmsg(netdissect_options *ndo, 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)); @@ -729,8 +729,8 @@ print_decnet_ctlmsg(netdissect_options *ndo, 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; diff --git a/print-dhcp6.c b/print-dhcp6.c index 28b30451..178ec6f8 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -417,7 +417,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (u_char *)(dh6o + 1); - ND_PRINT((ndo, " %s", ip6addr_string(&tp[0]))); + ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0]))); ND_PRINT((ndo, " pltime:%u vltime:%u", EXTRACT_32BITS(&tp[16]), EXTRACT_32BITS(&tp[20]))); @@ -599,7 +599,7 @@ dhcp6opt_print(netdissect_options *ndo, } tp = (u_char *)(dh6o + 1); for (i = 0; i < optlen; i += 16) - ND_PRINT((ndo, " %s", ip6addr_string(&tp[i]))); + ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[i]))); ND_PRINT((ndo, ")")); break; case DH6OPT_SIP_SERVER_D: @@ -656,7 +656,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (u_char *)(dh6o + 1); - ND_PRINT((ndo, " %s/%d", ip6addr_string(&tp[9]), tp[8])); + ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, &tp[9]), tp[8])); ND_PRINT((ndo, " pltime:%u vltime:%u", EXTRACT_32BITS(&tp[0]), EXTRACT_32BITS(&tp[4]))); @@ -706,7 +706,7 @@ dhcp6opt_print(netdissect_options *ndo, ND_PRINT((ndo, " type_%d", (int)*tp)); break; } - ND_PRINT((ndo, " %s", ip6addr_string(&tp[1]))); + ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[1]))); if (optlen > 17) { /* there are query-options */ dhcp6opt_print(ndo, tp + 17, tp + optlen); @@ -727,7 +727,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (u_char *)(dh6o + 1); - ND_PRINT((ndo, " %s ", ip6addr_string(&tp[0]))); + ND_PRINT((ndo, " %s ", ip6addr_string(ndo, &tp[0]))); /* * Print hex dump first 10 characters. */ @@ -756,7 +756,7 @@ dhcp6opt_print(netdissect_options *ndo, ND_PRINT((ndo, " ?")); break; } - ND_PRINT((ndo, " %s", ip6addr_string(&tp[0]))); + ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0]))); break; case DH6OPT_NTP_SUBOPTION_SRV_FQDN: ND_PRINT((ndo, " ")); @@ -907,10 +907,10 @@ dhcp6_print(netdissect_options *ndo, ND_TCHECK(dh6relay->dh6relay_peeraddr); memcpy(&addr6, dh6relay->dh6relay_linkaddr, sizeof (addr6)); - ND_PRINT((ndo, "linkaddr=%s", ip6addr_string(&addr6))); + ND_PRINT((ndo, "linkaddr=%s", ip6addr_string(ndo, &addr6))); memcpy(&addr6, dh6relay->dh6relay_peeraddr, sizeof (addr6)); - ND_PRINT((ndo, " peeraddr=%s", ip6addr_string(&addr6))); + ND_PRINT((ndo, " peeraddr=%s", ip6addr_string(ndo, &addr6))); dhcp6opt_print(ndo, (u_char *)(dh6relay + 1), ep); } diff --git a/print-dtp.c b/print-dtp.c index 88f98a78..cfdfed3e 100644 --- a/print-dtp.c +++ b/print-dtp.c @@ -97,7 +97,7 @@ dtp_print (netdissect_options *ndo, const u_char *pptr, u_int length) break; case DTP_NEIGHBOR_TLV: - ND_PRINT((ndo, ", %s", etheraddr_string(tptr+4))); + ND_PRINT((ndo, ", %s", etheraddr_string(ndo, tptr+4))); break; default: diff --git a/print-dvmrp.c b/print-dvmrp.c index 2d712d82..76a86445 100644 --- a/print-dvmrp.c +++ b/print-dvmrp.c @@ -239,7 +239,7 @@ print_probe(netdissect_options *ndo, while ((len > 0) && (bp < ep)) { ND_TCHECK2(bp[0], 4); - ND_PRINT((ndo, "\n\tneighbor %s", ipaddr_string(bp))); + ND_PRINT((ndo, "\n\tneighbor %s", ipaddr_string(ndo, bp))); bp += 4; len -= 4; } return (0); @@ -267,9 +267,9 @@ print_neighbors(netdissect_options *ndo, len -= 7; while (--ncount >= 0) { ND_TCHECK2(bp[0], 4); - ND_PRINT((ndo, " [%s ->", ipaddr_string(laddr))); + ND_PRINT((ndo, " [%s ->", ipaddr_string(ndo, laddr))); ND_PRINT((ndo, " %s, (%d/%d)]", - ipaddr_string(bp), metric, thresh)); + ipaddr_string(ndo, bp), metric, thresh)); bp += 4; len -= 4; } @@ -302,8 +302,8 @@ print_neighbors2(netdissect_options *ndo, ncount = *bp++; len -= 8; while (--ncount >= 0 && (len >= 4) && (bp + 4) <= ep) { - ND_PRINT((ndo, " [%s -> ", ipaddr_string(laddr))); - ND_PRINT((ndo, "%s (%d/%d", ipaddr_string(bp), + ND_PRINT((ndo, " [%s -> ", ipaddr_string(ndo, laddr))); + ND_PRINT((ndo, "%s (%d/%d", ipaddr_string(ndo, bp), metric, thresh)); if (flags & DVMRP_NF_TUNNEL) ND_PRINT((ndo, "/tunnel")); @@ -334,7 +334,7 @@ print_prune(netdissect_options *ndo, register const u_char *bp) { ND_TCHECK2(bp[0], 12); - ND_PRINT((ndo, " src %s grp %s", ipaddr_string(bp), ipaddr_string(bp + 4))); + ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4))); bp += 8; ND_PRINT((ndo, " timer ")); relts_print(ndo, EXTRACT_32BITS(bp)); @@ -348,7 +348,7 @@ print_graft(netdissect_options *ndo, register const u_char *bp) { ND_TCHECK2(bp[0], 8); - ND_PRINT((ndo, " src %s grp %s", ipaddr_string(bp), ipaddr_string(bp + 4))); + ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4))); return (0); trunc: return (-1); @@ -359,7 +359,7 @@ print_graft_ack(netdissect_options *ndo, register const u_char *bp) { ND_TCHECK2(bp[0], 8); - ND_PRINT((ndo, " src %s grp %s", ipaddr_string(bp), ipaddr_string(bp + 4))); + ND_PRINT((ndo, " src %s grp %s", ipaddr_string(ndo, bp), ipaddr_string(ndo, bp + 4))); return (0); trunc: return (-1); diff --git a/print-egp.c b/print-egp.c index cb3aa5b1..5013c2ff 100644 --- a/print-egp.c +++ b/print-egp.c @@ -175,7 +175,7 @@ egpnrprint(netdissect_options *ndo, distances = *cp++; ND_PRINT((ndo, " %s %s ", gateways < (int)egp->egp_intgw ? "int" : "ext", - ipaddr_string(&addr))); + ipaddr_string(ndo, &addr))); comma = ""; ND_PRINT((ndo, "(")); @@ -196,7 +196,7 @@ egpnrprint(netdissect_options *ndo, addr |= (u_int32_t)*cp++ << 16; addr |= (u_int32_t)*cp++ << 8; } - ND_PRINT((ndo, " %s", ipaddr_string(&addr))); + ND_PRINT((ndo, " %s", ipaddr_string(ndo, &addr))); } } ND_PRINT((ndo, ")")); @@ -315,7 +315,7 @@ egp_print(netdissect_options *ndo, ND_PRINT((ndo, " state:%s", egp_status_updown[status])); else ND_PRINT((ndo, " [status %d]", status)); - ND_PRINT((ndo, " net:%s", ipaddr_string(&egp->egp_sourcenet))); + ND_PRINT((ndo, " net:%s", ipaddr_string(ndo, &egp->egp_sourcenet))); break; case EGPT_UPDATE: @@ -329,7 +329,7 @@ egp_print(netdissect_options *ndo, else ND_PRINT((ndo, " [status %d]", status)); ND_PRINT((ndo, " %s int %d ext %d", - ipaddr_string(&egp->egp_sourcenet), + ipaddr_string(ndo, &egp->egp_sourcenet), egp->egp_intgw, egp->egp_extgw)); if (ndo->ndo_vflag) diff --git a/print-eigrp.c b/print-eigrp.c index 83a9f31a..f6d28294 100644 --- a/print-eigrp.c +++ b/print-eigrp.c @@ -328,12 +328,12 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_int->destination,byte_length); ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ", - ipaddr_string(prefix), + ipaddr_string(ndo, prefix), bit_length)); if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) ND_PRINT((ndo, "self")); else - ND_PRINT((ndo, "%s",ipaddr_string(&tlv_ptr.eigrp_tlv_ip_int->nexthop))); + ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_int->nexthop))); ND_PRINT((ndo, "\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_int->delay)/100), @@ -357,15 +357,15 @@ eigrp_print(netdissect_options *ndo, register const u_char *pptr, register u_int memcpy(prefix,&tlv_ptr.eigrp_tlv_ip_ext->destination,byte_length); ND_PRINT((ndo, "\n\t IPv4 prefix: %15s/%u, nexthop: ", - ipaddr_string(prefix), + ipaddr_string(ndo, prefix), bit_length)); if (EXTRACT_32BITS(&tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) ND_PRINT((ndo, "self")); else - ND_PRINT((ndo, "%s",ipaddr_string(&tlv_ptr.eigrp_tlv_ip_ext->nexthop))); + ND_PRINT((ndo, "%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->nexthop))); ND_PRINT((ndo, "\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u", - ipaddr_string(tlv_ptr.eigrp_tlv_ip_ext->origin_router), + ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router), EXTRACT_32BITS(tlv_ptr.eigrp_tlv_ip_ext->origin_as), tok2str(eigrp_ext_proto_id_values,"unknown",tlv_ptr.eigrp_tlv_ip_ext->proto_id), tlv_ptr.eigrp_tlv_ip_ext->flags, diff --git a/print-ether.c b/print-ether.c index 64b7f338..f3f43c1e 100644 --- a/print-ether.c +++ b/print-ether.c @@ -94,8 +94,8 @@ ether_hdr_print(netdissect_options *ndo, ep = (const struct ether_header *)bp; ND_PRINT((ndo, "%s > %s", - etheraddr_string(ESRC(ep)), - etheraddr_string(EDST(ep)))); + etheraddr_string(ndo, ESRC(ep)), + etheraddr_string(ndo, EDST(ep)))); ether_type = EXTRACT_16BITS(&ep->ether_type); if (!ndo->ndo_qflag) { diff --git a/print-fddi.c b/print-fddi.c index 413a6efb..ad760c85 100644 --- a/print-fddi.c +++ b/print-fddi.c @@ -256,8 +256,8 @@ fddi_hdr_print(netdissect_options *ndo, { const char *srcname, *dstname; - srcname = etheraddr_string(fsrc); - dstname = etheraddr_string(fdst); + srcname = etheraddr_string(ndo, fsrc); + dstname = etheraddr_string(ndo, fdst); if (ndo->ndo_vflag) ND_PRINT((ndo, "%02x %s %s %d: ", diff --git a/print-fr.c b/print-fr.c index 29976ab9..8b3de128 100644 --- a/print-fr.c +++ b/print-fr.c @@ -29,8 +29,8 @@ #include #include -#include "addrtoname.h" #include "interface.h" +#include "addrtoname.h" #include "ethertype.h" #include "nlpid.h" #include "extract.h" diff --git a/print-geonet.c b/print-geonet.c index 229b2540..ee7292c2 100644 --- a/print-geonet.c +++ b/print-geonet.c @@ -89,7 +89,7 @@ print_long_pos_vector(netdissect_options *ndo, { u_int32_t lat, lon; - ND_PRINT((ndo, "GN_ADDR:%s ", linkaddr_string (bp, 0, GEONET_ADDR_LEN))); + ND_PRINT((ndo, "GN_ADDR:%s ", linkaddr_string (ndo, bp, 0, GEONET_ADDR_LEN))); lat = EXTRACT_32BITS(bp+12); ND_PRINT((ndo, "lat:%d ", lat)); @@ -105,7 +105,7 @@ print_long_pos_vector(netdissect_options *ndo, void geonet_print(netdissect_options *ndo, const u_char *eth, const u_char *bp, u_int length) { - ND_PRINT((ndo, "GeoNet src:%s; ", etheraddr_string(eth+6))); + ND_PRINT((ndo, "GeoNet src:%s; ", etheraddr_string(ndo, eth+6))); if (length >= 36) { /* Process Common Header */ diff --git a/print-hsrp.c b/print-hsrp.c index f35188f7..ddc912c9 100644 --- a/print-hsrp.c +++ b/print-hsrp.c @@ -113,7 +113,7 @@ hsrp_print(netdissect_options *ndo, register const u_int8_t *bp, register u_int ND_PRINT((ndo, "[reserved=%d!] ", hp->hsrp_reserved)); } ND_TCHECK(hp->hsrp_virtaddr); - ND_PRINT((ndo, "addr=%s", ipaddr_string(&hp->hsrp_virtaddr))); + ND_PRINT((ndo, "addr=%s", ipaddr_string(ndo, &hp->hsrp_virtaddr))); if (ndo->ndo_vflag) { ND_PRINT((ndo, " hellotime=")); relts_print(ndo, hp->hsrp_hellotime); diff --git a/print-icmp.c b/print-icmp.c index c22d92b8..bebf3b7a 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -371,7 +371,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * ND_TCHECK(dp->icmp_ip.ip_p); (void)snprintf(buf, sizeof(buf), "%s protocol %d unreachable", - ipaddr_string(&dp->icmp_ip.ip_dst), + ipaddr_string(ndo, &dp->icmp_ip.ip_dst), dp->icmp_ip.ip_p); break; @@ -387,21 +387,21 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * case IPPROTO_TCP: (void)snprintf(buf, sizeof(buf), "%s tcp port %s unreachable", - ipaddr_string(&oip->ip_dst), + ipaddr_string(ndo, &oip->ip_dst), tcpport_string(dport)); break; case IPPROTO_UDP: (void)snprintf(buf, sizeof(buf), "%s udp port %s unreachable", - ipaddr_string(&oip->ip_dst), + ipaddr_string(ndo, &oip->ip_dst), udpport_string(dport)); break; default: (void)snprintf(buf, sizeof(buf), "%s protocol %d port %d unreachable", - ipaddr_string(&oip->ip_dst), + ipaddr_string(ndo, &oip->ip_dst), oip->ip_p, dport); break; } @@ -415,11 +415,11 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * if (mtu) { (void)snprintf(buf, sizeof(buf), "%s unreachable - need to frag (mtu %d)", - ipaddr_string(&dp->icmp_ip.ip_dst), mtu); + ipaddr_string(ndo, &dp->icmp_ip.ip_dst), mtu); } else { (void)snprintf(buf, sizeof(buf), "%s unreachable - need to frag", - ipaddr_string(&dp->icmp_ip.ip_dst)); + ipaddr_string(ndo, &dp->icmp_ip.ip_dst)); } } break; @@ -428,7 +428,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * fmt = tok2str(unreach2str, "#%d %%s unreachable", dp->icmp_code); (void)snprintf(buf, sizeof(buf), fmt, - ipaddr_string(&dp->icmp_ip.ip_dst)); + ipaddr_string(ndo, &dp->icmp_ip.ip_dst)); break; } break; @@ -438,8 +438,8 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * fmt = tok2str(type2str, "redirect-#%d %%s to net %%s", dp->icmp_code); (void)snprintf(buf, sizeof(buf), fmt, - ipaddr_string(&dp->icmp_ip.ip_dst), - ipaddr_string(&dp->icmp_gwaddr)); + ipaddr_string(ndo, &dp->icmp_ip.ip_dst), + ipaddr_string(ndo, &dp->icmp_gwaddr)); break; case ICMP_ROUTERADVERT: @@ -485,7 +485,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const u_char * while (num-- > 0) { ND_TCHECK(*idp); (void)snprintf(cp, sizeof(buf) - (cp - buf), " {%s %u}", - ipaddr_string(&idp->ird_addr), + ipaddr_string(ndo, &idp->ird_addr), EXTRACT_32BITS(&idp->ird_pref)); cp = buf + strlen(buf); ++idp; diff --git a/print-icmp6.c b/print-icmp6.c index a29a4f76..121f9337 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -938,12 +938,12 @@ icmp6_print(netdissect_options *ndo, case ICMP6_DST_UNREACH_NOROUTE: /* fall through */ case ICMP6_DST_UNREACH_ADMIN: case ICMP6_DST_UNREACH_ADDR: - ND_PRINT((ndo," %s",ip6addr_string(&oip->ip6_dst))); + ND_PRINT((ndo," %s",ip6addr_string(ndo, &oip->ip6_dst))); break; case ICMP6_DST_UNREACH_BEYONDSCOPE: ND_PRINT((ndo," %s, source address %s", - ip6addr_string(&oip->ip6_dst), - ip6addr_string(&oip->ip6_src))); + ip6addr_string(ndo, &oip->ip6_dst), + ip6addr_string(ndo, &oip->ip6_src))); break; case ICMP6_DST_UNREACH_NOPORT: if ((ouh = get_upperlayer(ndo, (u_char *)oip, &prot)) @@ -954,17 +954,17 @@ icmp6_print(netdissect_options *ndo, switch (prot) { case IPPROTO_TCP: ND_PRINT((ndo,", %s tcp port %s", - ip6addr_string(&oip->ip6_dst), + ip6addr_string(ndo, &oip->ip6_dst), tcpport_string(dport))); break; case IPPROTO_UDP: ND_PRINT((ndo,", %s udp port %s", - ip6addr_string(&oip->ip6_dst), + ip6addr_string(ndo, &oip->ip6_dst), udpport_string(dport))); break; default: ND_PRINT((ndo,", %s protocol %d port %d unreachable", - ip6addr_string(&oip->ip6_dst), + ip6addr_string(ndo, &oip->ip6_dst), oip->ip6_nxt, dport)); break; } @@ -986,7 +986,7 @@ icmp6_print(netdissect_options *ndo, switch (dp->icmp6_code) { case ICMP6_TIME_EXCEED_TRANSIT: ND_PRINT((ndo," for %s", - ip6addr_string(&oip->ip6_dst))); + ip6addr_string(ndo, &oip->ip6_dst))); break; case ICMP6_TIME_EXCEED_REASSEMBLY: ND_PRINT((ndo," (reassembly)")); @@ -1067,7 +1067,7 @@ icmp6_print(netdissect_options *ndo, struct nd_neighbor_solicit *p; p = (struct nd_neighbor_solicit *)dp; ND_TCHECK(p->nd_ns_target); - ND_PRINT((ndo,", who has %s", ip6addr_string(&p->nd_ns_target))); + ND_PRINT((ndo,", who has %s", ip6addr_string(ndo, &p->nd_ns_target))); if (ndo->ndo_vflag) { #define NDSOLLEN 24 icmp6_opt_print(ndo, (const u_char *)dp + NDSOLLEN, @@ -1082,7 +1082,7 @@ icmp6_print(netdissect_options *ndo, p = (struct nd_neighbor_advert *)dp; ND_TCHECK(p->nd_na_target); ND_PRINT((ndo,", tgt is %s", - ip6addr_string(&p->nd_na_target))); + ip6addr_string(ndo, &p->nd_na_target))); if (ndo->ndo_vflag) { ND_PRINT((ndo,", Flags [%s]", bittok2str(icmp6_nd_na_flag_values, @@ -1098,10 +1098,10 @@ icmp6_print(netdissect_options *ndo, case ND_REDIRECT: #define RDR(i) ((struct nd_redirect *)(i)) ND_TCHECK(RDR(dp)->nd_rd_dst); - ND_PRINT((ndo,", %s", getname6((const u_char *)&RDR(dp)->nd_rd_dst))); + ND_PRINT((ndo,", %s", getname6(ndo, (const u_char *)&RDR(dp)->nd_rd_dst))); ND_TCHECK(RDR(dp)->nd_rd_target); ND_PRINT((ndo," to %s", - getname6((const u_char*)&RDR(dp)->nd_rd_target))); + getname6(ndo, (const u_char*)&RDR(dp)->nd_rd_target))); #define REDIRECTLEN 40 if (ndo->ndo_vflag) { icmp6_opt_print(ndo, (const u_char *)dp + REDIRECTLEN, @@ -1139,7 +1139,7 @@ icmp6_print(netdissect_options *ndo, in6 = (struct in6_addr *)(dp + 1); for (; (u_char *)in6 < cp; in6++) { ND_TCHECK(*in6); - ND_PRINT((ndo,", %s", ip6addr_string(in6))); + ND_PRINT((ndo,", %s", ip6addr_string(ndo, in6))); } } break; @@ -1301,7 +1301,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) opp = (struct nd_opt_prefix_info *)op; ND_TCHECK(opp->nd_opt_pi_prefix); ND_PRINT((ndo,"%s/%u%s, Flags [%s], valid time %s", - ip6addr_string(&opp->nd_opt_pi_prefix), + ip6addr_string(ndo, &opp->nd_opt_pi_prefix), opp->nd_opt_pi_prefix_len, (op->nd_opt_len != 4) ? "badlen" : "", bittok2str(icmp6_opt_pi_flag_values, "none", opp->nd_opt_pi_flags_reserved), @@ -1327,7 +1327,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) for (i = 0; i < l; i++) { ND_TCHECK(oprd->nd_opt_rdnss_addr[i]); ND_PRINT((ndo," addr: %s", - ip6addr_string(&oprd->nd_opt_rdnss_addr[i]))); + ip6addr_string(ndo, &oprd->nd_opt_rdnss_addr[i]))); } break; case ND_OPT_DNSSL: @@ -1373,7 +1373,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) default: goto trunc; } - ND_PRINT((ndo," %s/%u", ip6addr_string(&in6), + ND_PRINT((ndo," %s/%u", ip6addr_string(ndo, &in6), opri->nd_opt_rti_prefixlen)); ND_PRINT((ndo,", pref=%s", get_rtpref(opri->nd_opt_rti_flags))); ND_PRINT((ndo,", lifetime=%s", @@ -1414,7 +1414,7 @@ mld6_print(netdissect_options *ndo, const u_char *bp) return; ND_PRINT((ndo,"max resp delay: %d ", EXTRACT_16BITS(&mp->mld6_maxdelay))); - ND_PRINT((ndo,"addr: %s", ip6addr_string(&mp->mld6_addr))); + ND_PRINT((ndo,"addr: %s", ip6addr_string(ndo, &mp->mld6_addr))); } static void @@ -1443,7 +1443,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) return; } ND_TCHECK2(bp[group + 4], sizeof(struct in6_addr)); - ND_PRINT((ndo," [gaddr %s", ip6addr_string(&bp[group + 4]))); + ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, &bp[group + 4]))); ND_PRINT((ndo," %s", tok2str(mldv2report2str, " [v2-report-#%d]", bp[group]))); nsrcs = (bp[group + 2] << 8) + bp[group + 3]; @@ -1460,7 +1460,7 @@ mldv2_report_print(netdissect_options *ndo, const u_char *bp, u_int len) for (j = 0; j < nsrcs; j++) { ND_TCHECK2(bp[group + 20 + j * sizeof(struct in6_addr)], sizeof(struct in6_addr)); - ND_PRINT((ndo," %s", ip6addr_string(&bp[group + 20 + j * sizeof(struct in6_addr)]))); + ND_PRINT((ndo," %s", ip6addr_string(ndo, &bp[group + 20 + j * sizeof(struct in6_addr)]))); } ND_PRINT((ndo," }")); } @@ -1500,7 +1500,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo," [max resp delay=%d]", mrt)); } ND_TCHECK2(bp[8], sizeof(struct in6_addr)); - ND_PRINT((ndo," [gaddr %s", ip6addr_string(&bp[8]))); + ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, &bp[8]))); if (ndo->ndo_vflag) { ND_TCHECK(bp[25]); @@ -1528,7 +1528,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) for (i = 0; i < nsrcs; i++) { ND_TCHECK2(bp[28 + i * sizeof(struct in6_addr)], sizeof(struct in6_addr)); - ND_PRINT((ndo," %s", ip6addr_string(&bp[28 + i * sizeof(struct in6_addr)]))); + ND_PRINT((ndo," %s", ip6addr_string(ndo, &bp[28 + i * sizeof(struct in6_addr)]))); } ND_PRINT((ndo," }")); } else @@ -1666,7 +1666,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } ND_PRINT((ndo,", subject=%s", - getname6((const u_char *)(ni6 + 1)))); + getname6(ndo, (const u_char *)(ni6 + 1)))); break; case ICMP6_NI_SUBJ_FQDN: ND_PRINT((ndo,", subject=DNS name")); @@ -1694,7 +1694,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } ND_PRINT((ndo,", subject=%s", - getname((const u_char *)(ni6 + 1)))); + getname(ndo, (const u_char *)(ni6 + 1)))); break; default: ND_PRINT((ndo,", unknown subject")); @@ -1791,7 +1791,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, while (i < siz) { if (i + sizeof(struct in6_addr) + sizeof(int32_t) > siz) break; - ND_PRINT((ndo," %s", getname6(bp + i))); + ND_PRINT((ndo," %s", getname6(ndo, bp + i))); i += sizeof(struct in6_addr); ND_PRINT((ndo,"(%d)", (int32_t)EXTRACT_32BITS(bp + i))); i += sizeof(int32_t); diff --git a/print-igmp.c b/print-igmp.c index 1c9a71c9..728fcaf1 100644 --- a/print-igmp.c +++ b/print-igmp.c @@ -114,8 +114,8 @@ print_mtrace(netdissect_options *ndo, } ND_PRINT((ndo, "mtrace %u: %s to %s reply-to %s", TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)), - ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst), - ipaddr_string(&tr->tr_raddr))); + ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst), + ipaddr_string(ndo, &tr->tr_raddr))); if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr))) ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)))); return; @@ -136,8 +136,8 @@ print_mresp(netdissect_options *ndo, } ND_PRINT((ndo, "mresp %lu: %s to %s reply-to %s", (u_long)TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)), - ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst), - ipaddr_string(&tr->tr_raddr))); + ipaddr_string(ndo, &tr->tr_src), ipaddr_string(ndo, &tr->tr_dst), + ipaddr_string(ndo, &tr->tr_raddr))); if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr))) ND_PRINT((ndo, " with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)))); return; @@ -169,7 +169,7 @@ print_igmpv3_report(netdissect_options *ndo, return; } ND_TCHECK2(bp[group+4], 4); - ND_PRINT((ndo, " [gaddr %s", ipaddr_string(&bp[group+4]))); + ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[group+4]))); ND_PRINT((ndo, " %s", tok2str(igmpv3report2str, " [v3-report-#%d]", bp[group]))); nsrcs = EXTRACT_16BITS(&bp[group+2]); @@ -185,7 +185,7 @@ print_igmpv3_report(netdissect_options *ndo, ND_PRINT((ndo, " {")); for (j=0; j 0) { @@ -243,7 +243,7 @@ print_igmpv3_query(netdissect_options *ndo, ND_PRINT((ndo, " {")); for (i=0; i -#include "addrtoname.h" #include "interface.h" +#include "addrtoname.h" #include "extract.h" /* must come after interface.h */ #include "ip.h" @@ -71,7 +71,7 @@ ip_printroute(netdissect_options *ndo, ND_PRINT((ndo, " [bad ptr %u]", cp[2])); for (len = 3; len < length; len += 4) { - ND_PRINT((ndo, " %s", ipaddr_string(&cp[len]))); + ND_PRINT((ndo, " %s", ipaddr_string(ndo, &cp[len]))); if (ptr > len) ND_PRINT((ndo, ",")); } @@ -211,7 +211,7 @@ ip_printts(netdissect_options *ndo, if (ptr == len) type = " ^ "; ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_32BITS(&cp[len+hoplen-4]), - hoplen!=8 ? "" : ipaddr_string(&cp[len]))); + hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len]))); type = " "; } @@ -466,14 +466,14 @@ again: if (ndo->ndo_packettype == PT_CARP) { if (ndo->ndo_vflag) ND_PRINT((ndo, "carp %s > %s: ", - ipaddr_string(&ipds->ip->ip_src), - ipaddr_string(&ipds->ip->ip_dst))); + ipaddr_string(ndo, &ipds->ip->ip_src), + ipaddr_string(ndo, &ipds->ip->ip_dst))); carp_print(ndo, ipds->cp, ipds->len, ipds->ip->ip_ttl); } else { if (ndo->ndo_vflag) ND_PRINT((ndo, "vrrp %s > %s: ", - ipaddr_string(&ipds->ip->ip_src), - ipaddr_string(&ipds->ip->ip_dst))); + ipaddr_string(ndo, &ipds->ip->ip_src), + ipaddr_string(ndo, &ipds->ip->ip_dst))); vrrp_print(ndo, ipds->cp, ipds->len, (const u_char *)ipds->ip, ipds->ip->ip_ttl); } @@ -647,8 +647,8 @@ ip_print(netdissect_options *ndo, if (ipds->nh != IPPROTO_TCP && ipds->nh != IPPROTO_UDP && ipds->nh != IPPROTO_SCTP && ipds->nh != IPPROTO_DCCP) { ND_PRINT((ndo, "%s > %s: ", - ipaddr_string(&ipds->ip->ip_src), - ipaddr_string(&ipds->ip->ip_dst))); + ipaddr_string(ndo, &ipds->ip->ip_src), + ipaddr_string(ndo, &ipds->ip->ip_dst))); } ip_print_demux(ndo, ipds); } else { @@ -661,8 +661,8 @@ ip_print(netdissect_options *ndo, * and the protocol. */ if (ipds->off & 0x1fff) { - ND_PRINT((ndo, "%s > %s:", ipaddr_string(&ipds->ip->ip_src), - ipaddr_string(&ipds->ip->ip_dst))); + ND_PRINT((ndo, "%s > %s:", ipaddr_string(ndo, &ipds->ip->ip_src), + ipaddr_string(ndo, &ipds->ip->ip_dst))); if (!ndo->ndo_nflag && (proto = getprotobynumber(ipds->ip->ip_p)) != NULL) ND_PRINT((ndo, " %s", proto->p_name)); else diff --git a/print-ip6.c b/print-ip6.c index 7fc93d93..219db53f 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -147,8 +147,8 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) if (cp == (const u_char *)(ip6 + 1) && nh != IPPROTO_TCP && nh != IPPROTO_UDP && nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) { - ND_PRINT((ndo, "%s > %s: ", ip6addr_string(&ip6->ip6_src), - ip6addr_string(&ip6->ip6_dst))); + ND_PRINT((ndo, "%s > %s: ", ip6addr_string(ndo, &ip6->ip6_src), + ip6addr_string(ndo, &ip6->ip6_dst))); } switch (nh) { diff --git a/print-ip6opts.c b/print-ip6opts.c index 835fe411..14ad42c3 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -147,7 +147,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) ND_PRINT((ndo, "(homeaddr: invalid len %d)", bp[i + 1])); goto trunc; } - ND_PRINT((ndo, "(homeaddr: %s", ip6addr_string(&bp[i + 2]))); + ND_PRINT((ndo, "(homeaddr: %s", ip6addr_string(ndo, &bp[i + 2]))); if (bp[i + 1] > IP6OPT_HOMEADDR_MINLEN - 2) { ip6_sopt_print(ndo, &bp[i + IP6OPT_HOMEADDR_MINLEN], (optlen - IP6OPT_HOMEADDR_MINLEN)); diff --git a/print-ipfc.c b/print-ipfc.c index 4b397d1f..295ac0fd 100644 --- a/print-ipfc.c +++ b/print-ipfc.c @@ -68,8 +68,8 @@ ipfc_hdr_print(netdissect_options *ndo, { const char *srcname, *dstname; - srcname = etheraddr_string(ipfcsrc); - dstname = etheraddr_string(ipfcdst); + srcname = etheraddr_string(ndo, ipfcsrc); + dstname = etheraddr_string(ndo, ipfcdst); /* * XXX - show the upper 16 bits? Do so only if "vflag" is set? diff --git a/print-ipnet.c b/print-ipnet.c index 9f11f392..e1cd59e1 100644 --- a/print-ipnet.c +++ b/print-ipnet.c @@ -30,7 +30,7 @@ static const struct tok ipnet_values[] = { }; static inline void -ipnet_hdr_print(struct netdissect_options *ndo, const u_char *bp, u_int length) +ipnet_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length) { const ipnet_hdr_t *hdr; hdr = (const ipnet_hdr_t *)bp; @@ -53,7 +53,7 @@ ipnet_hdr_print(struct netdissect_options *ndo, const u_char *bp, u_int length) } static void -ipnet_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) +ipnet_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen) { ipnet_hdr_t *hdr; @@ -100,7 +100,7 @@ ipnet_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int * is the number of bytes actually captured. */ u_int -ipnet_if_print(struct netdissect_options *ndo, +ipnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { ipnet_print(ndo, p, h->len, h->caplen); diff --git a/print-isakmp.c b/print-isakmp.c index 09e3c544..5ee23f86 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -884,7 +884,7 @@ trunc: /* * returns false if we run out of data buffer */ -static int ike_show_somedata(struct netdissect_options *ndo, +static int ike_show_somedata(netdissect_options *ndo, const u_char *cp, const u_char *ep) { /* there is too much data, just show some of it */ @@ -1388,7 +1388,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, if (len < 4) ND_PRINT((ndo," len=%d [bad: < 4]", len)); else - ND_PRINT((ndo," len=%d %s", len, ipaddr_string(data))); + ND_PRINT((ndo," len=%d %s", len, ipaddr_string(ndo, data))); len = 0; break; case IPSECDOI_ID_FQDN: @@ -1409,7 +1409,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, else { mask = data + sizeof(struct in_addr); ND_PRINT((ndo," len=%d %s/%u.%u.%u.%u", len, - ipaddr_string(data), + ipaddr_string(ndo, data), mask[0], mask[1], mask[2], mask[3])); } len = 0; @@ -1420,7 +1420,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, if (len < 16) ND_PRINT((ndo," len=%d [bad: < 16]", len)); else - ND_PRINT((ndo," len=%d %s", len, ip6addr_string(data))); + ND_PRINT((ndo," len=%d %s", len, ip6addr_string(ndo, data))); len = 0; break; case IPSECDOI_ID_IPV6_ADDR_SUBNET: @@ -1432,7 +1432,7 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, mask = (u_char *)(data + sizeof(struct in6_addr)); /*XXX*/ ND_PRINT((ndo," len=%d %s/0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len, - ip6addr_string(data), + ip6addr_string(ndo, data), mask[0], mask[1], mask[2], mask[3], mask[4], mask[5], mask[6], mask[7], mask[8], mask[9], mask[10], mask[11], @@ -1447,8 +1447,8 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, ND_PRINT((ndo," len=%d [bad: < 8]", len)); else { ND_PRINT((ndo," len=%d %s-%s", len, - ipaddr_string(data), - ipaddr_string(data + sizeof(struct in_addr)))); + ipaddr_string(ndo, data), + ipaddr_string(ndo, data + sizeof(struct in_addr)))); } len = 0; break; @@ -1458,8 +1458,8 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, ND_PRINT((ndo," len=%d [bad: < 32]", len)); else { ND_PRINT((ndo," len=%d %s-%s", len, - ip6addr_string(data), - ip6addr_string(data + sizeof(struct in6_addr)))); + ip6addr_string(ndo, data), + ip6addr_string(ndo, data + sizeof(struct in6_addr)))); } len = 0; break; diff --git a/print-isoclns.c b/print-isoclns.c index d9a69093..80bd3ce5 100644 --- a/print-isoclns.c +++ b/print-isoclns.c @@ -1147,7 +1147,7 @@ esis_print(netdissect_options *ndo, li -= netal; if (netal == 0) - ND_PRINT((ndo, "\n\t %s", etheraddr_string(snpa))); + ND_PRINT((ndo, "\n\t %s", etheraddr_string(ndo, snpa))); else ND_PRINT((ndo, "\n\t %s", isonsap_string(neta, netal))); break; @@ -1615,12 +1615,12 @@ isis_print_tlv_ip_reach(netdissect_options *ndo, if (prefix_len == -1) ND_PRINT((ndo, "%sIPv4 prefix: %s mask %s", ident, - ipaddr_string((tlv_ip_reach->prefix)), - ipaddr_string((tlv_ip_reach->mask)))); + ipaddr_string(ndo, (tlv_ip_reach->prefix)), + ipaddr_string(ndo, (tlv_ip_reach->mask)))); else ND_PRINT((ndo, "%sIPv4 prefix: %15s/%u", ident, - ipaddr_string((tlv_ip_reach->prefix)), + ipaddr_string(ndo, (tlv_ip_reach->prefix)), prefix_len)); ND_PRINT((ndo, ", Distribution: %s, Metric: %u, %s", @@ -1739,7 +1739,7 @@ isis_print_is_reach_subtlv(netdissect_options *ndo, case ISIS_SUBTLV_EXT_IS_REACH_IPV4_INTF_ADDR: case ISIS_SUBTLV_EXT_IS_REACH_IPV4_NEIGHBOR_ADDR: if (subl >= sizeof(struct in_addr)) - ND_PRINT((ndo, ", %s", ipaddr_string(tptr))); + ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr))); break; case ISIS_SUBTLV_EXT_IS_REACH_MAX_LINK_BW : case ISIS_SUBTLV_EXT_IS_REACH_RESERVABLE_BW: @@ -2004,13 +2004,13 @@ isis_print_extd_ip_reach(netdissect_options *ndo, if (afi == AF_INET) ND_PRINT((ndo, "%sIPv4 prefix: %15s/%u", ident, - ipaddr_string(prefix), + ipaddr_string(ndo, prefix), bit_length)); #ifdef INET6 if (afi == AF_INET6) ND_PRINT((ndo, "%sIPv6 prefix: %s/%u", ident, - ip6addr_string(prefix), + ip6addr_string(ndo, prefix), bit_length)); #endif @@ -2641,7 +2641,7 @@ isis_print(netdissect_options *ndo, goto trunctlv; ND_PRINT((ndo, "\n\t IPv6 interface address: %s", - ip6addr_string(tptr))); + ip6addr_string(ndo, tptr))); tptr += sizeof(struct in6_addr); tmp -= sizeof(struct in6_addr); @@ -2790,14 +2790,14 @@ isis_print(netdissect_options *ndo, case ISIS_TLV_TE_ROUTER_ID: if (!ND_TTEST2(*pptr, sizeof(struct in_addr))) goto trunctlv; - ND_PRINT((ndo, "\n\t Traffic Engineering Router ID: %s", ipaddr_string(pptr))); + ND_PRINT((ndo, "\n\t Traffic Engineering Router ID: %s", ipaddr_string(ndo, pptr))); break; case ISIS_TLV_IPADDR: while (tmp>=sizeof(struct in_addr)) { if (!ND_TTEST2(*tptr, sizeof(struct in_addr))) goto trunctlv; - ND_PRINT((ndo, "\n\t IPv4 interface address: %s", ipaddr_string(tptr))); + ND_PRINT((ndo, "\n\t IPv4 interface address: %s", ipaddr_string(ndo, tptr))); tptr += sizeof(struct in_addr); tmp -= sizeof(struct in_addr); } @@ -2833,7 +2833,7 @@ isis_print(netdissect_options *ndo, break; if (!ND_TTEST2(*tptr, sizeof(struct in_addr))) goto trunctlv; - ND_PRINT((ndo, "\n\t IPv4 interface address: %s", ipaddr_string(tptr))); + ND_PRINT((ndo, "\n\t IPv4 interface address: %s", ipaddr_string(ndo, tptr))); tptr+=sizeof(struct in_addr); tmp-=sizeof(struct in_addr); @@ -2841,7 +2841,7 @@ isis_print(netdissect_options *ndo, break; if (!ND_TTEST2(*tptr, sizeof(struct in_addr))) goto trunctlv; - ND_PRINT((ndo, "\n\t IPv4 neighbor address: %s", ipaddr_string(tptr))); + ND_PRINT((ndo, "\n\t IPv4 neighbor address: %s", ipaddr_string(ndo, tptr))); tptr+=sizeof(struct in_addr); tmp-=sizeof(struct in_addr); diff --git a/print-juniper.c b/print-juniper.c index 1bdca812..058bfd56 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -548,8 +548,8 @@ juniper_es_print(netdissect_options *ndo, tok2str(juniper_ipsec_type_values,"Unknown",ih->type), ih->type, EXTRACT_32BITS(&ih->spi), - ipaddr_string(&ih->src_ip), - ipaddr_string(&ih->dst_ip), + ipaddr_string(ndo, &ih->src_ip), + ipaddr_string(ndo, &ih->dst_ip), l2info.length)); } else { ND_PRINT((ndo, "ES SA, index %u, ttl %u type %s (%u), length %u\n", diff --git a/print-ldp.c b/print-ldp.c index c7e6baf9..98256659 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -276,12 +276,12 @@ ldp_tlv_print(netdissect_options *ndo, case LDP_TLV_IPV4_TRANSPORT_ADDR: TLV_TCHECK(4); - ND_PRINT((ndo, "\n\t IPv4 Transport Address: %s", ipaddr_string(tptr))); + ND_PRINT((ndo, "\n\t IPv4 Transport Address: %s", ipaddr_string(ndo, tptr))); break; #ifdef INET6 case LDP_TLV_IPV6_TRANSPORT_ADDR: TLV_TCHECK(16); - ND_PRINT((ndo, "\n\t IPv6 Transport Address: %s", ip6addr_string(tptr))); + ND_PRINT((ndo, "\n\t IPv6 Transport Address: %s", ip6addr_string(ndo, tptr))); break; #endif case LDP_TLV_CONFIG_SEQ_NUMBER: @@ -300,7 +300,7 @@ ldp_tlv_print(netdissect_options *ndo, case AFNUM_INET: while(tlv_tlen >= sizeof(struct in_addr)) { ND_TCHECK2(*tptr, sizeof(struct in_addr)); - ND_PRINT((ndo, " %s", ipaddr_string(tptr))); + ND_PRINT((ndo, " %s", ipaddr_string(ndo, tptr))); tlv_tlen-=sizeof(struct in_addr); tptr+=sizeof(struct in_addr); } @@ -309,7 +309,7 @@ ldp_tlv_print(netdissect_options *ndo, case AFNUM_INET6: while(tlv_tlen >= sizeof(struct in6_addr)) { ND_TCHECK2(*tptr, sizeof(struct in6_addr)); - ND_PRINT((ndo, " %s", ip6addr_string(tptr))); + ND_PRINT((ndo, " %s", ip6addr_string(ndo, tptr))); tlv_tlen-=sizeof(struct in6_addr); tptr+=sizeof(struct in6_addr); } @@ -577,7 +577,7 @@ ldp_msg_print(netdissect_options *ndo, pdu_len = EXTRACT_16BITS(&ldp_com_header->pdu_length); ND_PRINT((ndo, "%sLDP, Label-Space-ID: %s:%u, pdu-length: %u", (ndo->ndo_vflag < 1) ? "" : "\n\t", - ipaddr_string(&ldp_com_header->lsr_id), + ipaddr_string(ndo, &ldp_com_header->lsr_id), EXTRACT_16BITS(&ldp_com_header->label_space), pdu_len)); diff --git a/print-llc.c b/print-llc.c index 5619730a..00d9268b 100644 --- a/print-llc.c +++ b/print-llc.c @@ -312,8 +312,8 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, ND_PRINT((ndo, "%s ", tok2str(llc_values, "Unknown DSAP 0x%02x", dsap))); else ND_PRINT((ndo, "%s > %s %s ", - etheraddr_string(esrc), - etheraddr_string(edst), + etheraddr_string(ndo, esrc), + etheraddr_string(ndo, edst), tok2str(llc_values, "Unknown DSAP 0x%02x", dsap))); } else { if (esrc == NULL || edst == NULL) @@ -322,9 +322,9 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, tok2str(llc_values, "Unknown DSAP 0x%02x", dsap))); else ND_PRINT((ndo, "%s %s > %s %s ", - etheraddr_string(esrc), + etheraddr_string(ndo, esrc), tok2str(llc_values, "Unknown SSAP 0x%02x", ssap), - etheraddr_string(edst), + etheraddr_string(ndo, edst), tok2str(llc_values, "Unknown DSAP 0x%02x", dsap))); } } diff --git a/print-lldp.c b/print-lldp.c index 1b736919..3829bd5b 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -1262,11 +1262,11 @@ lldp_private_dcbx_print(netdissect_options *ndo, } static char * -lldp_network_addr_print(const u_char *tptr, u_int len) { +lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len) { u_int8_t af; static char buf[BUFSIZE]; - const char * (*pfunc)(const u_char *); + const char * (*pfunc)(netdissect_options *, const u_char *); if (len < 1) return NULL; @@ -1300,7 +1300,7 @@ lldp_network_addr_print(const u_char *tptr, u_int len) { tok2str(af_values, "Unknown", af), af); } else { snprintf(buf, sizeof(buf), "AFI %s (%u): %s", - tok2str(af_values, "Unknown", af), af, (*pfunc)(tptr+1)); + tok2str(af_values, "Unknown", af), af, (*pfunc)(ndo, tptr+1)); } return buf; @@ -1328,7 +1328,7 @@ lldp_mgmt_addr_tlv_print(netdissect_options *ndo, return 0; } - mgmt_addr = lldp_network_addr_print(tptr, mgmt_addr_len); + mgmt_addr = lldp_network_addr_print(ndo, tptr, mgmt_addr_len); if (mgmt_addr == NULL) { return 0; } @@ -1429,7 +1429,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 1+6) { goto trunc; } - ND_PRINT((ndo, "%s", etheraddr_string(tptr + 1))); + ND_PRINT((ndo, "%s", etheraddr_string(ndo, tptr + 1))); break; case LLDP_CHASSIS_INTF_NAME_SUBTYPE: /* fall through */ @@ -1441,7 +1441,7 @@ lldp_print(netdissect_options *ndo, break; case LLDP_CHASSIS_NETWORK_ADDR_SUBTYPE: - network_addr = lldp_network_addr_print(tptr+1, tlv_len-1); + network_addr = lldp_network_addr_print(ndo, tptr+1, tlv_len-1); if (network_addr == NULL) { goto trunc; } @@ -1470,7 +1470,7 @@ lldp_print(netdissect_options *ndo, if (tlv_len < 1+6) { goto trunc; } - ND_PRINT((ndo, "%s", etheraddr_string(tptr + 1))); + ND_PRINT((ndo, "%s", etheraddr_string(ndo, tptr + 1))); break; case LLDP_PORT_INTF_NAME_SUBTYPE: /* fall through */ @@ -1482,7 +1482,7 @@ lldp_print(netdissect_options *ndo, break; case LLDP_PORT_NETWORK_ADDR_SUBTYPE: - network_addr = lldp_network_addr_print(tptr+1, tlv_len-1); + network_addr = lldp_network_addr_print(ndo, tptr+1, tlv_len-1); if (network_addr == NULL) { goto trunc; } diff --git a/print-lmp.c b/print-lmp.c index d204887e..396ce48b 100644 --- a/print-lmp.c +++ b/print-lmp.c @@ -458,14 +458,14 @@ lmp_print(netdissect_options *ndo, case LMP_CTYPE_IPV4_LOC: case LMP_CTYPE_IPV4_RMT: ND_PRINT((ndo, "\n\t IPv4 Link ID: %s (0x%08x)", - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr))); break; #ifdef INET6 case LMP_CTYPE_IPV6_LOC: case LMP_CTYPE_IPV6_RMT: ND_PRINT((ndo, "\n\t IPv6 Link ID: %s (0x%08x)", - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr))); break; #endif @@ -502,7 +502,7 @@ lmp_print(netdissect_options *ndo, case LMP_CTYPE_LOC: case LMP_CTYPE_RMT: ND_PRINT((ndo, "\n\t Node ID: %s (0x%08x)", - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr))); break; @@ -547,9 +547,9 @@ lmp_print(netdissect_options *ndo, case LMP_CTYPE_IPV4: ND_PRINT((ndo, "\n\t Local Link-ID: %s (0x%08x)" "\n\t Remote Link-ID: %s (0x%08x)", - ipaddr_string(obj_tptr+4), + ipaddr_string(ndo, obj_tptr+4), EXTRACT_32BITS(obj_tptr+4), - ipaddr_string(obj_tptr+8), + ipaddr_string(ndo, obj_tptr+8), EXTRACT_32BITS(obj_tptr+8))); break; @@ -573,9 +573,9 @@ lmp_print(netdissect_options *ndo, case LMP_CTYPE_UNMD: ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)" "\n\t Remote Interface ID: %s (0x%08x)", - ipaddr_string(obj_tptr+4), + ipaddr_string(ndo, obj_tptr+4), EXTRACT_32BITS(obj_tptr+4), - ipaddr_string(obj_tptr+8), + ipaddr_string(ndo, obj_tptr+8), EXTRACT_32BITS(obj_tptr+8))); total_subobj_len = lmp_obj_len - 16; @@ -692,7 +692,7 @@ lmp_print(netdissect_options *ndo, /* Decode pairs: */ while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", - ipaddr_string(obj_tptr+offset), + ipaddr_string(ndo, obj_tptr+offset), EXTRACT_32BITS(obj_tptr+offset))); ND_PRINT((ndo, "\n\t\t Active: %s (%u)", (EXTRACT_32BITS(obj_tptr+offset+4)>>31) ? @@ -726,7 +726,7 @@ lmp_print(netdissect_options *ndo, offset = 0; while (offset < (lmp_obj_len-(int)sizeof(struct lmp_object_header)) ) { ND_PRINT((ndo, "\n\t Interface ID: %s (0x%08x)", - ipaddr_string(obj_tptr+offset), + ipaddr_string(ndo, obj_tptr+offset), EXTRACT_32BITS(obj_tptr+offset))); offset+=4; } @@ -821,7 +821,7 @@ lmp_print(netdissect_options *ndo, EXTRACT_16BITS(obj_tptr+10))); ND_PRINT((ndo, "\n\t Local Interface ID: %s (0x%08x)", - ipaddr_string(obj_tptr+12), + ipaddr_string(ndo, obj_tptr+12), EXTRACT_32BITS(obj_tptr+12))); break; diff --git a/print-loopback.c b/print-loopback.c index c0297b8d..4994c3a2 100644 --- a/print-loopback.c +++ b/print-loopback.c @@ -85,7 +85,7 @@ loopback_message_print(netdissect_options *ndo, const u_char *cp, const u_int le goto corrupt; /* forwarding address */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); - ND_PRINT((ndo, ", forwarding address %s", etheraddr_string(cp))); + ND_PRINT((ndo, ", forwarding address %s", etheraddr_string(ndo, cp))); cp += ETHER_ADDR_LEN; /* data */ ND_PRINT((ndo, ", data (%u octets)", len - 8)); diff --git a/print-lspping.c b/print-lspping.c index 4103a924..6ecac823 100644 --- a/print-lspping.c +++ b/print-lspping.c @@ -629,7 +629,7 @@ lspping_print(netdissect_options *ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4 = \ (const struct lspping_tlv_targetfec_subtlv_ldp_ipv4_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t %s/%u", - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix), subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv4->prefix_len)); break; @@ -638,7 +638,7 @@ lspping_print(netdissect_options *ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6 = \ (const struct lspping_tlv_targetfec_subtlv_ldp_ipv6_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t %s/%u", - ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix), + ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix), subtlv_ptr.lspping_tlv_targetfec_subtlv_ldp_ipv6->prefix_len)); break; #endif @@ -647,9 +647,9 @@ lspping_print(netdissect_options *ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4 = \ (const struct lspping_tlv_targetfec_subtlv_bgp_ipv4_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t %s/%u, sender-id %s", - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix), subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->prefix_len, - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->sender_id))); + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv4->sender_id))); break; #ifdef INET6 @@ -657,9 +657,9 @@ lspping_print(netdissect_options *ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6 = \ (const struct lspping_tlv_targetfec_subtlv_bgp_ipv6_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t %s/%u, sender-id %s", - ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix), + ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix), subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->prefix_len, - ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->sender_id))); + ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_bgp_ipv6->sender_id))); break; #endif @@ -668,11 +668,11 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv4_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \ "\n\t tunnel-id 0x%04x, extended tunnel-id %s", - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint), - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_endpoint), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_sender), EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->lsp_id), EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->tunnel_id), - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id))); + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv4->extended_tunnel_id))); break; #ifdef INET6 @@ -681,11 +681,11 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_rsvp_ipv6_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t tunnel end-point %s, tunnel sender %s, lsp-id 0x%04x" \ "\n\t tunnel-id 0x%04x, extended tunnel-id %s", - ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint), - ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender), + ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_endpoint), + ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_sender), EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->lsp_id), EXTRACT_16BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->tunnel_id), - ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id))); + ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_rsvp_ipv6->extended_tunnel_id))); break; #endif @@ -694,7 +694,7 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv4_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t RD: %s, %s/%u", bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->rd), - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix), subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv4->prefix_len)); break; @@ -704,7 +704,7 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_l3vpn_ipv6_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t RD: %s, %s/%u", bgp_vpn_rd_print(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->rd), - ip6addr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix), + ip6addr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix), subtlv_ptr.lspping_tlv_targetfec_subtlv_l3vpn_ipv6->prefix_len)); break; #endif @@ -730,7 +730,7 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_old_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t Remote PE: %s" \ "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)", - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->remote_pe_address), EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid_old->vc_id), tok2str(l2vpn_encaps_values, "unknown", @@ -744,8 +744,8 @@ lspping_print(netdissect_options *ndo, (const struct lspping_tlv_targetfec_subtlv_l2vpn_vcid_t *)subtlv_tptr; ND_PRINT((ndo, "\n\t Sender PE: %s, Remote PE: %s" \ "\n\t VC-ID: 0x%08x, Encapsulation Type: %s (%u)", - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address), - ipaddr_string(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->sender_pe_address), + ipaddr_string(ndo, subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->remote_pe_address), EXTRACT_32BITS(subtlv_ptr.lspping_tlv_targetfec_subtlv_l2vpn_vcid->vc_id), tok2str(l2vpn_encaps_values, "unknown", @@ -790,8 +790,8 @@ lspping_print(netdissect_options *ndo, case LSPPING_AFI_IPV4: ND_PRINT((ndo, "\n\t Downstream IP: %s" \ "\n\t Downstream Interface IP: %s", - ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip), - ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface))); + ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip), + ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface))); tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t); tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t); break; @@ -799,8 +799,8 @@ lspping_print(netdissect_options *ndo, case LSPPING_AFI_IPV6: ND_PRINT((ndo, "\n\t Downstream IP: %s" \ "\n\t Downstream Interface IP: %s", - ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_ip), - ip6addr_string(tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface))); + ip6addr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_ip), + ip6addr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv6->downstream_interface))); tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv6_t); tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv6_t); break; @@ -808,7 +808,7 @@ lspping_print(netdissect_options *ndo, case LSPPING_AFI_UNMB: ND_PRINT((ndo, "\n\t Downstream IP: %s" \ "\n\t Downstream Interface Index: 0x%08x", - ipaddr_string(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip), + ipaddr_string(ndo, tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_ip), EXTRACT_32BITS(tlv_ptr.lspping_tlv_downstream_map_ipv4->downstream_interface))); tlv_tptr+=sizeof(struct lspping_tlv_downstream_map_ipv4_t); tlv_tlen-=sizeof(struct lspping_tlv_downstream_map_ipv4_t); diff --git a/print-lwapp.c b/print-lwapp.c index 2b942bce..ffd67690 100644 --- a/print-lwapp.c +++ b/print-lwapp.c @@ -213,7 +213,7 @@ lwapp_control_print(netdissect_options *ndo, tlen)); if (has_ap_ident) { - ND_PRINT((ndo, "\n\tAP identity: %s", etheraddr_string(tptr))); + ND_PRINT((ndo, "\n\tAP identity: %s", etheraddr_string(ndo, tptr))); tptr+=sizeof(const struct lwapp_transport_header)+6; } else { tptr+=sizeof(const struct lwapp_transport_header); diff --git a/print-lwres.c b/print-lwres.c index 90334e8c..59e18649 100644 --- a/print-lwres.c +++ b/print-lwres.c @@ -266,14 +266,14 @@ lwres_printaddr(netdissect_options *ndo, case 1: /* IPv4 */ if (l < 4) return -1; - ND_PRINT((ndo, " %s", ipaddr_string(p))); + ND_PRINT((ndo, " %s", ipaddr_string(ndo, p))); p += sizeof(struct in_addr); break; #ifdef INET6 case 2: /* IPv6 */ if (l < 16) return -1; - ND_PRINT((ndo, " %s", ip6addr_string(p))); + ND_PRINT((ndo, " %s", ip6addr_string(ndo, p))); p += sizeof(struct in6_addr); break; #endif diff --git a/print-mobile.c b/print-mobile.c index 64c7d556..42f0aa1f 100644 --- a/print-mobile.c +++ b/print-mobile.c @@ -86,12 +86,12 @@ mobile_print(netdissect_options *ndo, const u_char *bp, u_int length) if (osp) { ND_PRINT((ndo, "[S] ")); if (ndo->ndo_vflag) - ND_PRINT((ndo, "%s ", ipaddr_string(&mob->osrc))); + ND_PRINT((ndo, "%s ", ipaddr_string(ndo, &mob->osrc))); } else { ND_PRINT((ndo, "[] ")); } if (ndo->ndo_vflag) { - ND_PRINT((ndo, "> %s ", ipaddr_string(&mob->odst))); + ND_PRINT((ndo, "> %s ", ipaddr_string(ndo, &mob->odst))); ND_PRINT((ndo, "(oproto=%d)", proto>>8)); } vec[0].ptr = (const u_int8_t *)(void *)mob; diff --git a/print-mobility.c b/print-mobility.c index 7abb9224..9dfb6eb2 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -131,7 +131,7 @@ mobility_opt_print(netdissect_options *ndo, ND_PRINT((ndo, "(altcoa: trunc)")); goto trunc; } - ND_PRINT((ndo, "(alt-CoA: %s)", ip6addr_string(&bp[i+2]))); + ND_PRINT((ndo, "(alt-CoA: %s)", ip6addr_string(ndo, &bp[i+2]))); break; case IP6MOPT_NONCEID: if (len - i < IP6MOPT_NONCEID_MINLEN) { @@ -294,7 +294,7 @@ mobility_print(netdissect_options *ndo, /* Reserved */ hlen = IP6M_MINLEN; ND_TCHECK2(*mh, hlen + 16); - ND_PRINT((ndo, " homeaddr %s", ip6addr_string(&bp[hlen]))); + ND_PRINT((ndo, " homeaddr %s", ip6addr_string(ndo, &bp[hlen]))); hlen += 16; break; default: diff --git a/print-mptcp.c b/print-mptcp.c index 292189af..6d763d57 100644 --- a/print-mptcp.c +++ b/print-mptcp.c @@ -320,13 +320,13 @@ add_addr_print(netdissect_options *ndo, ND_PRINT((ndo, " id %u", add_addr->addr_id)); switch (ipver) { case 4: - ND_PRINT((ndo, " %s", ipaddr_string(add_addr->u.v4.addr))); + ND_PRINT((ndo, " %s", ipaddr_string(ndo, add_addr->u.v4.addr))); if (opt_len == 10) ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v4.port))); break; case 6: #ifdef INET6 - ND_PRINT((ndo, " %s", ip6addr_string(add_addr->u.v6.addr))); + ND_PRINT((ndo, " %s", ip6addr_string(ndo, add_addr->u.v6.addr))); #endif if (opt_len == 22) ND_PRINT((ndo, ":%u", EXTRACT_16BITS(add_addr->u.v6.port))); diff --git a/print-msdp.c b/print-msdp.c index 87812435..fb802b58 100644 --- a/print-msdp.c +++ b/print-msdp.c @@ -72,7 +72,7 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length) case 2: ND_PRINT((ndo, " SA-Request")); ND_TCHECK2(*sp, 5); - ND_PRINT((ndo, " for %s", ipaddr_string(sp + 1))); + ND_PRINT((ndo, " for %s", ipaddr_string(ndo, sp + 1))); break; case 4: ND_PRINT((ndo, " Keepalive")); diff --git a/print-msnlb.c b/print-msnlb.c index c28646f9..7cb0bf90 100644 --- a/print-msnlb.c +++ b/print-msnlb.c @@ -56,8 +56,8 @@ msnlb_print(netdissect_options *ndo, const u_char *bp) ND_PRINT((ndo, "MS NLB heartbeat, host priority: %u,", EXTRACT_LE_32BITS(&(hb->host_prio)))); - ND_PRINT((ndo, " cluster IP: %s,", ipaddr_string(&(hb->virtual_ip)))); - ND_PRINT((ndo, " host IP: %s", ipaddr_string(&(hb->host_ip)))); + ND_PRINT((ndo, " cluster IP: %s,", ipaddr_string(ndo, &(hb->virtual_ip)))); + ND_PRINT((ndo, " host IP: %s", ipaddr_string(ndo, &(hb->host_ip)))); return; trunc: ND_PRINT((ndo, "[|MS NLB]")); diff --git a/print-nflog.c b/print-nflog.c index 29d23b62..bb375c10 100644 --- a/print-nflog.c +++ b/print-nflog.c @@ -44,7 +44,7 @@ static const struct tok nflog_values[] = { }; static inline void -nflog_hdr_print(struct netdissect_options *ndo, const nflog_hdr_t *hdr, u_int length) +nflog_hdr_print(netdissect_options *ndo, const nflog_hdr_t *hdr, u_int length) { ND_PRINT((ndo, "version %d, resource ID %d", hdr->nflog_version, ntohs(hdr->nflog_rid))); @@ -64,7 +64,7 @@ nflog_hdr_print(struct netdissect_options *ndo, const nflog_hdr_t *hdr, u_int le } u_int -nflog_if_print(struct netdissect_options *ndo, +nflog_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { const nflog_hdr_t *hdr = (const nflog_hdr_t *)p; diff --git a/print-nfs.c b/print-nfs.c index a2d3aafe..98cdabdc 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -170,15 +170,15 @@ print_nfsaddr(netdissect_options *ndo, switch (IP_V((struct ip *)bp)) { case 4: ip = (struct ip *)bp; - strlcpy(srcaddr, ipaddr_string(&ip->ip_src), sizeof(srcaddr)); - strlcpy(dstaddr, ipaddr_string(&ip->ip_dst), sizeof(dstaddr)); + strlcpy(srcaddr, ipaddr_string(ndo, &ip->ip_src), sizeof(srcaddr)); + strlcpy(dstaddr, ipaddr_string(ndo, &ip->ip_dst), sizeof(dstaddr)); break; #ifdef INET6 case 6: ip6 = (struct ip6_hdr *)bp; - strlcpy(srcaddr, ip6addr_string(&ip6->ip6_src), + strlcpy(srcaddr, ip6addr_string(ndo, &ip6->ip6_src), sizeof(srcaddr)); - strlcpy(dstaddr, ip6addr_string(&ip6->ip6_dst), + strlcpy(dstaddr, ip6addr_string(ndo, &ip6->ip6_dst), sizeof(dstaddr)); break; #endif diff --git a/print-ntp.c b/print-ntp.c index 5dd0e240..93268ac0 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -266,17 +266,17 @@ ntp_print(netdissect_options *ndo, break; case INFO_QUERY: - ND_PRINT((ndo, "%s INFO_QUERY", ipaddr_string(&(bp->refid)))); + ND_PRINT((ndo, "%s INFO_QUERY", ipaddr_string(ndo, &(bp->refid)))); /* this doesn't have more content */ return; case INFO_REPLY: - ND_PRINT((ndo, "%s INFO_REPLY", ipaddr_string(&(bp->refid)))); + ND_PRINT((ndo, "%s INFO_REPLY", ipaddr_string(ndo, &(bp->refid)))); /* this is too complex to be worth printing */ return; default: - ND_PRINT((ndo, "%s", ipaddr_string(&(bp->refid)))); + ND_PRINT((ndo, "%s", ipaddr_string(ndo, &(bp->refid)))); break; } diff --git a/print-olsr.c b/print-olsr.c index 82ee11b7..34300a44 100644 --- a/print-olsr.c +++ b/print-olsr.c @@ -190,7 +190,7 @@ olsr_print_lq_neighbor4(netdissect_options *ndo, ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%" ", neighbor-link-quality %.2lf%%", - ipaddr_string(lq_neighbor->neighbor), + ipaddr_string(ndo, lq_neighbor->neighbor), ((double)lq_neighbor->link_quality/2.55), ((double)lq_neighbor->neighbor_link_quality/2.55))); @@ -212,7 +212,7 @@ olsr_print_lq_neighbor6(netdissect_options *ndo, ND_PRINT((ndo, "\n\t neighbor %s, link-quality %.2lf%%" ", neighbor-link-quality %.2lf%%", - ip6addr_string(lq_neighbor->neighbor), + ip6addr_string(ndo, lq_neighbor->neighbor), ((double)lq_neighbor->link_quality/2.55), ((double)lq_neighbor->neighbor_link_quality/2.55))); @@ -238,7 +238,7 @@ olsr_print_neighbor(netdissect_options *ndo, /* print 4 neighbors per line */ - ND_PRINT((ndo, "%s%s", ipaddr_string(msg_data), + ND_PRINT((ndo, "%s%s", ipaddr_string(ndo, msg_data), neighbor % 4 == 0 ? "\n\t\t" : " ")); msg_data += sizeof(struct in_addr); @@ -323,7 +323,7 @@ olsr_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t%s Message (%#04x), originator %s, ttl %u, hop %u" "\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s", tok2str(olsr_msg_values, "Unknown", msg_type), - msg_type, ip6addr_string(msgptr.v6->originator), + msg_type, ip6addr_string(ndo, msgptr.v6->originator), msgptr.v6->ttl, msgptr.v6->hopcount, ME_TO_DOUBLE(msgptr.v6->vtime), @@ -351,7 +351,7 @@ olsr_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t%s Message (%#04x), originator %s, ttl %u, hop %u" "\n\t vtime %.3lfs, msg-seq 0x%04x, length %u%s", tok2str(olsr_msg_values, "Unknown", msg_type), - msg_type, ipaddr_string(msgptr.v4->originator), + msg_type, ipaddr_string(ndo, msgptr.v4->originator), msgptr.v4->ttl, msgptr.v4->hopcount, ME_TO_DOUBLE(msgptr.v4->vtime), @@ -459,11 +459,11 @@ olsr_print(netdissect_options *ndo, goto trunc; #if INET6 ND_PRINT((ndo, "\n\t interface address %s", - is_ipv6 ? ip6addr_string(msg_data) : - ipaddr_string(msg_data))); + is_ipv6 ? ip6addr_string(ndo, msg_data) : + ipaddr_string(ndo, msg_data))); #else ND_PRINT((ndo, "\n\t interface address %s", - ipaddr_string(msg_data))); + ipaddr_string(ndo, msg_data))); #endif msg_data += addr_size; @@ -488,7 +488,7 @@ olsr_print(netdissect_options *ndo, hna6 = (struct olsr_hna6 *)msg_data; ND_PRINT((ndo, "\n\t #%i: %s/%u", - i, ip6addr_string(hna6->network), + i, ip6addr_string(ndo, hna6->network), mask62plen (hna6->mask))); msg_data += sizeof(struct olsr_hna6); @@ -508,7 +508,7 @@ olsr_print(netdissect_options *ndo, /* print 4 prefixes per line */ ND_PRINT((ndo, "%s%s/%u", col == 0 ? "\n\t " : ", ", - ipaddr_string(ptr.hna->network), + ipaddr_string(ndo, ptr.hna->network), mask2plen(EXTRACT_32BITS(ptr.hna->mask)))); msg_data += sizeof(struct olsr_hna4); @@ -586,11 +586,11 @@ olsr_print(netdissect_options *ndo, #if INET6 if (is_ipv6) ND_PRINT((ndo, ", address %s, name \"", - ip6addr_string(msg_data))); + ip6addr_string(ndo, msg_data))); else #endif ND_PRINT((ndo, ", address %s, name \"", - ipaddr_string(msg_data))); + ipaddr_string(ndo, msg_data))); fn_printn(msg_data + addr_size, name_entry_len, NULL); ND_PRINT((ndo, "\"")); diff --git a/print-openflow-1.0.c b/print-openflow-1.0.c index 03bb623f..e8be4017 100644 --- a/print-openflow-1.0.c +++ b/print-openflow-1.0.c @@ -692,7 +692,7 @@ of10_phy_ports_print(netdissect_options *ndo, cp += 2; /* hw_addr */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); - ND_PRINT((ndo, ", hw_addr %s", etheraddr_string(cp))); + ND_PRINT((ndo, ", hw_addr %s", etheraddr_string(ndo, cp))); cp += ETHER_ADDR_LEN; /* name */ ND_TCHECK2(*cp, OFP_MAX_PORT_NAME_LEN); @@ -896,12 +896,12 @@ of10_match_print(netdissect_options *ndo, /* dl_src */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); if (! (wildcards & OFPFW_DL_SRC)) - ND_PRINT((ndo, "%smatch dl_src %s", pfx, etheraddr_string(cp))); + ND_PRINT((ndo, "%smatch dl_src %s", pfx, etheraddr_string(ndo, cp))); cp += ETHER_ADDR_LEN; /* dl_dst */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); if (! (wildcards & OFPFW_DL_DST)) - ND_PRINT((ndo, "%smatch dl_dst %s", pfx, etheraddr_string(cp))); + ND_PRINT((ndo, "%smatch dl_dst %s", pfx, etheraddr_string(ndo, cp))); cp += ETHER_ADDR_LEN; /* dl_vlan */ ND_TCHECK2(*cp, 2); @@ -943,13 +943,13 @@ of10_match_print(netdissect_options *ndo, ND_TCHECK2(*cp, 4); nw_bits = (wildcards & OFPFW_NW_SRC_MASK) >> OFPFW_NW_SRC_SHIFT; if (nw_bits < 32) - ND_PRINT((ndo, "%smatch nw_src %s/%u", pfx, ipaddr_string(cp), 32 - nw_bits)); + ND_PRINT((ndo, "%smatch nw_src %s/%u", pfx, ipaddr_string(ndo, cp), 32 - nw_bits)); cp += 4; /* nw_dst */ ND_TCHECK2(*cp, 4); nw_bits = (wildcards & OFPFW_NW_DST_MASK) >> OFPFW_NW_DST_SHIFT; if (nw_bits < 32) - ND_PRINT((ndo, "%smatch nw_dst %s/%u", pfx, ipaddr_string(cp), 32 - nw_bits)); + ND_PRINT((ndo, "%smatch nw_dst %s/%u", pfx, ipaddr_string(ndo, cp), 32 - nw_bits)); cp += 4; /* tp_src */ ND_TCHECK2(*cp, 2); @@ -1072,7 +1072,7 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_DL_DST: /* dl_addr */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); - ND_PRINT((ndo, ", dl_addr %s", etheraddr_string(cp))); + ND_PRINT((ndo, ", dl_addr %s", etheraddr_string(ndo, cp))); cp += ETHER_ADDR_LEN; /* pad */ ND_TCHECK2(*cp, 6); @@ -1082,7 +1082,7 @@ of10_actions_print(netdissect_options *ndo, case OFPAT_SET_NW_DST: /* nw_addr */ ND_TCHECK2(*cp, 4); - ND_PRINT((ndo, ", nw_addr %s", ipaddr_string(cp))); + ND_PRINT((ndo, ", nw_addr %s", ipaddr_string(ndo, cp))); cp += 4; break; case OFPAT_SET_NW_TOS: @@ -1245,7 +1245,7 @@ of10_port_mod_print(netdissect_options *ndo, cp += 2; /* hw_addr */ ND_TCHECK2(*cp, ETHER_ADDR_LEN); - ND_PRINT((ndo, ", hw_addr %s", etheraddr_string(cp))); + ND_PRINT((ndo, ", hw_addr %s", etheraddr_string(ndo, cp))); cp += ETHER_ADDR_LEN; /* config */ ND_TCHECK2(*cp, 4); diff --git a/print-ospf.c b/print-ospf.c index a6bd6c31..e8bd31b9 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -239,7 +239,7 @@ ospf_print_grace_lsa(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Bogus length %u != 4", tlv_length)); return -1; } - ND_PRINT((ndo, "%s", ipaddr_string(tptr))); + ND_PRINT((ndo, "%s", ipaddr_string(ndo, tptr))); break; default: @@ -327,16 +327,16 @@ ospf_print_te_lsa(netdissect_options *ndo, case LS_OPAQUE_TE_LINK_SUBTLV_LINK_ID: case LS_OPAQUE_TE_LINK_SUBTLV_LINK_LOCAL_REMOTE_ID: ND_PRINT((ndo, ", %s (0x%08x)", - ipaddr_string(tptr), + ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr))); if (subtlv_length == 8) /* rfc4203 */ ND_PRINT((ndo, ", %s (0x%08x)", - ipaddr_string(tptr+4), + ipaddr_string(ndo, tptr+4), EXTRACT_32BITS(tptr + 4))); break; case LS_OPAQUE_TE_LINK_SUBTLV_LOCAL_IP: case LS_OPAQUE_TE_LINK_SUBTLV_REMOTE_IP: - ND_PRINT((ndo, ", %s", ipaddr_string(tptr))); + ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr))); break; case LS_OPAQUE_TE_LINK_SUBTLV_MAX_BW: case LS_OPAQUE_TE_LINK_SUBTLV_MAX_RES_BW: @@ -426,7 +426,7 @@ ospf_print_te_lsa(netdissect_options *ndo, return -1; } ND_TCHECK2(*tptr, 4); - ND_PRINT((ndo, ", %s", ipaddr_string(tptr))); + ND_PRINT((ndo, ", %s", ipaddr_string(ndo, tptr))); break; default: @@ -463,7 +463,7 @@ ospf_print_lshdr(netdissect_options *ndo, ND_TCHECK(lshp->ls_seq); /* XXX - ls_length check checked this */ ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", - ipaddr_string(&lshp->ls_router), + ipaddr_string(ndo, &lshp->ls_router), EXTRACT_32BITS(&lshp->ls_seq), EXTRACT_16BITS(&lshp->ls_age), ls_length - (u_int)sizeof(struct lsa_hdr))); @@ -492,7 +492,7 @@ ospf_print_lshdr(netdissect_options *ndo, ND_PRINT((ndo, "\n\t %s LSA (%d), LSA-ID: %s", tok2str(lsa_values,"unknown",lshp->ls_type), lshp->ls_type, - ipaddr_string(&lshp->un_lsa_id.lsa_id))); + ipaddr_string(ndo, &lshp->un_lsa_id.lsa_id))); break; } @@ -583,26 +583,26 @@ ospf_print_lsa(netdissect_options *ndo, case RLA_TYPE_VIRTUAL: ND_PRINT((ndo, "\n\t Virtual Link: Neighbor Router-ID: %s, Interface Address: %s", - ipaddr_string(&rlp->link_id), - ipaddr_string(&rlp->link_data))); + ipaddr_string(ndo, &rlp->link_id), + ipaddr_string(ndo, &rlp->link_data))); break; case RLA_TYPE_ROUTER: ND_PRINT((ndo, "\n\t Neighbor Router-ID: %s, Interface Address: %s", - ipaddr_string(&rlp->link_id), - ipaddr_string(&rlp->link_data))); + ipaddr_string(ndo, &rlp->link_id), + ipaddr_string(ndo, &rlp->link_data))); break; case RLA_TYPE_TRANSIT: ND_PRINT((ndo, "\n\t Neighbor Network-ID: %s, Interface Address: %s", - ipaddr_string(&rlp->link_id), - ipaddr_string(&rlp->link_data))); + ipaddr_string(ndo, &rlp->link_id), + ipaddr_string(ndo, &rlp->link_data))); break; case RLA_TYPE_STUB: ND_PRINT((ndo, "\n\t Stub Network: %s, Mask: %s", - ipaddr_string(&rlp->link_id), - ipaddr_string(&rlp->link_data))); + ipaddr_string(ndo, &rlp->link_id), + ipaddr_string(ndo, &rlp->link_data))); break; default: @@ -621,11 +621,11 @@ ospf_print_lsa(netdissect_options *ndo, case LS_TYPE_NETWORK: ND_TCHECK(lsap->lsa_un.un_nla.nla_mask); ND_PRINT((ndo, "\n\t Mask %s\n\t Connected Routers:", - ipaddr_string(&lsap->lsa_un.un_nla.nla_mask))); + ipaddr_string(ndo, &lsap->lsa_un.un_nla.nla_mask))); ap = lsap->lsa_un.un_nla.nla_router; while ((u_char *)ap < ls_end) { ND_TCHECK(*ap); - ND_PRINT((ndo, "\n\t %s", ipaddr_string(ap))); + ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap))); ++ap; } break; @@ -633,7 +633,7 @@ ospf_print_lsa(netdissect_options *ndo, case LS_TYPE_SUM_IP: ND_TCHECK(lsap->lsa_un.un_nla.nla_mask); ND_PRINT((ndo, "\n\t Mask %s", - ipaddr_string(&lsap->lsa_un.un_sla.sla_mask))); + ipaddr_string(ndo, &lsap->lsa_un.un_sla.sla_mask))); ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric); lp = lsap->lsa_un.un_sla.sla_tosmetric; while ((u_char *)lp < ls_end) { @@ -671,7 +671,7 @@ ospf_print_lsa(netdissect_options *ndo, case LS_TYPE_NSSA: /* fall through - those LSAs share the same format */ ND_TCHECK(lsap->lsa_un.un_nla.nla_mask); ND_PRINT((ndo, "\n\t Mask %s", - ipaddr_string(&lsap->lsa_un.un_asla.asla_mask))); + ipaddr_string(ndo, &lsap->lsa_un.un_asla.asla_mask))); ND_TCHECK(lsap->lsa_un.un_sla.sla_tosmetric); almp = lsap->lsa_un.un_asla.asla_metric; @@ -692,11 +692,11 @@ ospf_print_lsa(netdissect_options *ndo, ND_TCHECK(almp->asla_forward); if (almp->asla_forward.s_addr) { - ND_PRINT((ndo, ", forward %s", ipaddr_string(&almp->asla_forward))); + ND_PRINT((ndo, ", forward %s", ipaddr_string(ndo, &almp->asla_forward))); } ND_TCHECK(almp->asla_tag); if (almp->asla_tag.s_addr) { - ND_PRINT((ndo, ", tag %s", ipaddr_string(&almp->asla_tag))); + ND_PRINT((ndo, ", tag %s", ipaddr_string(ndo, &almp->asla_tag))); } ++almp; } @@ -711,12 +711,12 @@ ospf_print_lsa(netdissect_options *ndo, case MCLA_VERTEX_ROUTER: ND_PRINT((ndo, "\n\t Router Router-ID %s", - ipaddr_string(&mcp->mcla_vid))); + ipaddr_string(ndo, &mcp->mcla_vid))); break; case MCLA_VERTEX_NETWORK: ND_PRINT((ndo, "\n\t Network Designated Router %s", - ipaddr_string(&mcp->mcla_vid))); + ipaddr_string(ndo, &mcp->mcla_vid))); break; default: @@ -936,25 +936,25 @@ ospf_decode_v2(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Mask %s, Priority %u", EXTRACT_16BITS(&op->ospf_hello.hello_helloint), EXTRACT_32BITS(&op->ospf_hello.hello_deadint), - ipaddr_string(&op->ospf_hello.hello_mask), + ipaddr_string(ndo, &op->ospf_hello.hello_mask), op->ospf_hello.hello_priority)); ND_TCHECK(op->ospf_hello.hello_dr); if (op->ospf_hello.hello_dr.s_addr != 0) ND_PRINT((ndo, "\n\t Designated Router %s", - ipaddr_string(&op->ospf_hello.hello_dr))); + ipaddr_string(ndo, &op->ospf_hello.hello_dr))); ND_TCHECK(op->ospf_hello.hello_bdr); if (op->ospf_hello.hello_bdr.s_addr != 0) ND_PRINT((ndo, ", Backup Designated Router %s", - ipaddr_string(&op->ospf_hello.hello_bdr))); + ipaddr_string(ndo, &op->ospf_hello.hello_bdr))); ap = op->ospf_hello.hello_neighbor; if ((u_char *)ap < dataend) ND_PRINT((ndo, "\n\t Neighbor List:")); while ((u_char *)ap < dataend) { ND_TCHECK(*ap); - ND_PRINT((ndo, "\n\t %s", ipaddr_string(ap))); + ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap))); ++ap; } break; /* HELLO */ @@ -986,7 +986,7 @@ ospf_decode_v2(netdissect_options *ndo, ND_TCHECK(*lsrp); ND_PRINT((ndo, "\n\t Advertising Router: %s, %s LSA (%u)", - ipaddr_string(&lsrp->ls_router), + ipaddr_string(ndo, &lsrp->ls_router), tok2str(lsa_values,"unknown",EXTRACT_32BITS(lsrp->ls_type)), EXTRACT_32BITS(&lsrp->ls_type))); @@ -1002,7 +1002,7 @@ ospf_decode_v2(netdissect_options *ndo, break; default: ND_PRINT((ndo, ", LSA-ID: %s", - ipaddr_string(&lsrp->un_ls_stateid.ls_stateid))); + ipaddr_string(ndo, &lsrp->un_ls_stateid.ls_stateid))); break; } @@ -1080,11 +1080,11 @@ ospf_print(netdissect_options *ndo, } ND_TCHECK(op->ospf_routerid); - ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(&op->ospf_routerid))); + ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf_routerid))); ND_TCHECK(op->ospf_areaid); if (op->ospf_areaid.s_addr != 0) - ND_PRINT((ndo, ", Area %s", ipaddr_string(&op->ospf_areaid))); + ND_PRINT((ndo, ", Area %s", ipaddr_string(ndo, &op->ospf_areaid))); else ND_PRINT((ndo, ", Backbone Area")); diff --git a/print-ospf6.c b/print-ospf6.c index 31f10405..4862114a 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -383,7 +383,7 @@ ospf6_print_ls_type(netdissect_options *ndo, ls_type & LS_TYPE_MASK, tok2str(ospf6_ls_scope_values, "Unknown", ls_type & LS_SCOPE_MASK), ls_type &0x8000 ? ", transitive" : "", /* U-bit */ - ipaddr_string(ls_stateid))); + ipaddr_string(ndo, ls_stateid))); } static int @@ -396,7 +396,7 @@ ospf6_print_lshdr(netdissect_options *ndo, ND_TCHECK(lshp->ls_seq); ND_PRINT((ndo, "\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", - ipaddr_string(&lshp->ls_router), + ipaddr_string(ndo, &lshp->ls_router), EXTRACT_32BITS(&lshp->ls_seq), EXTRACT_16BITS(&lshp->ls_age), EXTRACT_16BITS(&lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr))); @@ -431,7 +431,7 @@ ospf6_print_lsaprefix(netdissect_options *ndo, ND_TCHECK2(lsapp->lsa_p_prefix, wordlen * 4); memset(&prefix, 0, sizeof(prefix)); memcpy(&prefix, lsapp->lsa_p_prefix, wordlen * 4); - ND_PRINT((ndo, "\n\t\t%s/%d", ip6addr_string(&prefix), + ND_PRINT((ndo, "\n\t\t%s/%d", ip6addr_string(ndo, &prefix), lsapp->lsa_p_len)); if (lsapp->lsa_p_opt) { ND_PRINT((ndo, ", Options [%s]", @@ -513,25 +513,25 @@ ospf6_print_lsa(netdissect_options *ndo, case RLA_TYPE_VIRTUAL: ND_PRINT((ndo, "\n\t Virtual Link: Neighbor Router-ID %s" "\n\t Neighbor Interface-ID %s, Interface %s", - ipaddr_string(&rlp->link_nrtid), - ipaddr_string(&rlp->link_nifid), - ipaddr_string(&rlp->link_ifid))); + ipaddr_string(ndo, &rlp->link_nrtid), + ipaddr_string(ndo, &rlp->link_nifid), + ipaddr_string(ndo, &rlp->link_ifid))); break; case RLA_TYPE_ROUTER: ND_PRINT((ndo, "\n\t Neighbor Router-ID %s" "\n\t Neighbor Interface-ID %s, Interface %s", - ipaddr_string(&rlp->link_nrtid), - ipaddr_string(&rlp->link_nifid), - ipaddr_string(&rlp->link_ifid))); + ipaddr_string(ndo, &rlp->link_nrtid), + ipaddr_string(ndo, &rlp->link_nifid), + ipaddr_string(ndo, &rlp->link_ifid))); break; case RLA_TYPE_TRANSIT: ND_PRINT((ndo, "\n\t Neighbor Network-ID %s" "\n\t Neighbor Interface-ID %s, Interface %s", - ipaddr_string(&rlp->link_nrtid), - ipaddr_string(&rlp->link_nifid), - ipaddr_string(&rlp->link_ifid))); + ipaddr_string(ndo, &rlp->link_nrtid), + ipaddr_string(ndo, &rlp->link_nifid), + ipaddr_string(ndo, &rlp->link_ifid))); break; default: @@ -560,7 +560,7 @@ ospf6_print_lsa(netdissect_options *ndo, return (1); lsa_length -= sizeof (*ap); ND_TCHECK(*ap); - ND_PRINT((ndo, "\n\t\t%s", ipaddr_string(ap))); + ND_PRINT((ndo, "\n\t\t%s", ipaddr_string(ndo, ap))); ++ap; } break; @@ -612,7 +612,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (*fwdaddr6); ND_TCHECK(*fwdaddr6); ND_PRINT((ndo, " forward %s", - ip6addr_string(fwdaddr6))); + ip6addr_string(ndo, fwdaddr6))); tptr += sizeof(*fwdaddr6); } @@ -622,7 +622,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (u_int32_t); ND_TCHECK(*(u_int32_t *)tptr); ND_PRINT((ndo, " tag %s", - ipaddr_string((u_int32_t *)tptr))); + ipaddr_string(ndo, (u_int32_t *)tptr))); tptr += sizeof(u_int32_t); } @@ -632,7 +632,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (u_int32_t); ND_TCHECK(*(u_int32_t *)tptr); ND_PRINT((ndo, " RefLSID: %s", - ipaddr_string((u_int32_t *)tptr))); + ipaddr_string(ndo, (u_int32_t *)tptr))); tptr += sizeof(u_int32_t); } break; @@ -654,7 +654,7 @@ ospf6_print_lsa(netdissect_options *ndo, prefixes = EXTRACT_32BITS(&llsap->llsa_nprefix); ND_PRINT((ndo, "\n\t Priority %d, Link-local address %s, Prefixes %d:", llsap->llsa_priority, - ip6addr_string(&llsap->llsa_lladdr), + ip6addr_string(ndo, &llsap->llsa_lladdr), prefixes)); tptr = (u_int8_t *)llsap->llsa_prefix; @@ -744,23 +744,23 @@ ospf6_decode_v3(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Hello Timer %us, Dead Timer %us, Interface-ID %s, Priority %u", EXTRACT_16BITS(&op->ospf6_hello.hello_helloint), EXTRACT_16BITS(&op->ospf6_hello.hello_deadint), - ipaddr_string(&op->ospf6_hello.hello_ifid), + ipaddr_string(ndo, &op->ospf6_hello.hello_ifid), op->ospf6_hello.hello_priority)); ND_TCHECK(op->ospf6_hello.hello_dr); if (op->ospf6_hello.hello_dr != 0) ND_PRINT((ndo, "\n\t Designated Router %s", - ipaddr_string(&op->ospf6_hello.hello_dr))); + ipaddr_string(ndo, &op->ospf6_hello.hello_dr))); ND_TCHECK(op->ospf6_hello.hello_bdr); if (op->ospf6_hello.hello_bdr != 0) ND_PRINT((ndo, ", Backup Designated Router %s", - ipaddr_string(&op->ospf6_hello.hello_bdr))); + ipaddr_string(ndo, &op->ospf6_hello.hello_bdr))); if (ndo->ndo_vflag > 1) { ND_PRINT((ndo, "\n\t Neighbor List:")); ap = op->ospf6_hello.hello_neighbor; while ((u_char *)ap < dataend) { ND_TCHECK(*ap); - ND_PRINT((ndo, "\n\t %s", ipaddr_string(ap))); + ND_PRINT((ndo, "\n\t %s", ipaddr_string(ndo, ap))); ++ap; } } @@ -795,7 +795,7 @@ ospf6_decode_v3(netdissect_options *ndo, while ((u_char *)lsrp < dataend) { ND_TCHECK(*lsrp); ND_PRINT((ndo, "\n\t Advertising Router %s", - ipaddr_string(&lsrp->ls_router))); + ipaddr_string(ndo, &lsrp->ls_router))); ospf6_print_ls_type(ndo, EXTRACT_16BITS(&lsrp->ls_type), &lsrp->ls_stateid); ++lsrp; @@ -971,11 +971,11 @@ ospf6_print(netdissect_options *ndo, dataend = bp + datalen; ND_TCHECK(op->ospf6_routerid); - ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(&op->ospf6_routerid))); + ND_PRINT((ndo, "\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf6_routerid))); ND_TCHECK(op->ospf6_areaid); if (op->ospf6_areaid != 0) - ND_PRINT((ndo, ", Area %s", ipaddr_string(&op->ospf6_areaid))); + ND_PRINT((ndo, ", Area %s", ipaddr_string(ndo, &op->ospf6_areaid))); else ND_PRINT((ndo, ", Backbone Area")); ND_TCHECK(op->ospf6_instanceid); diff --git a/print-pgm.c b/print-pgm.c index 877819fe..d4c3b610 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -181,15 +181,15 @@ pgm_print(netdissect_options *ndo, #ifdef INET6 if (ip6) { ND_PRINT((ndo, "%s > %s: [|pgm]", - ip6addr_string(&ip6->ip6_src), - ip6addr_string(&ip6->ip6_dst))); + ip6addr_string(ndo, &ip6->ip6_src), + ip6addr_string(ndo, &ip6->ip6_dst))); return; } else #endif /* INET6 */ { ND_PRINT((ndo, "%s > %s: [|pgm]", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst))); + ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, &ip->ip_dst))); return; } } @@ -201,9 +201,9 @@ pgm_print(netdissect_options *ndo, if (ip6) { if (ip6->ip6_nxt == IPPROTO_PGM) { ND_PRINT((ndo, "%s.%s > %s.%s: ", - ip6addr_string(&ip6->ip6_src), + ip6addr_string(ndo, &ip6->ip6_src), tcpport_string(sport), - ip6addr_string(&ip6->ip6_dst), + ip6addr_string(ndo, &ip6->ip6_dst), tcpport_string(dport))); } else { ND_PRINT((ndo, "%s > %s: ", @@ -214,9 +214,9 @@ pgm_print(netdissect_options *ndo, { if (ip->ip_p == IPPROTO_PGM) { ND_PRINT((ndo, "%s.%s > %s.%s: ", - ipaddr_string(&ip->ip_src), + ipaddr_string(ndo, &ip->ip_src), tcpport_string(sport), - ipaddr_string(&ip->ip_dst), + ipaddr_string(ndo, &ip->ip_dst), tcpport_string(dport))); } else { ND_PRINT((ndo, "%s > %s: ", diff --git a/print-pim.c b/print-pim.c index 9ac9eeb6..3bb98219 100644 --- a/print-pim.c +++ b/print-pim.c @@ -123,17 +123,17 @@ pimv1_join_prune_print(netdissect_options *ndo, ((njoin = EXTRACT_16BITS(&bp[20])) + EXTRACT_16BITS(&bp[22])) == 1) { int hold; - ND_PRINT((ndo, " RPF %s ", ipaddr_string(bp))); + ND_PRINT((ndo, " RPF %s ", ipaddr_string(ndo, bp))); hold = EXTRACT_16BITS(&bp[6]); if (hold != 180) { ND_PRINT((ndo, "Hold ")); relts_print(ndo, hold); } ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune", - ipaddr_string(&bp[26]), bp[25] & 0x3f, - ipaddr_string(&bp[12]))); + ipaddr_string(ndo, &bp[26]), bp[25] & 0x3f, + ipaddr_string(ndo, &bp[12]))); if (EXTRACT_32BITS(&bp[16]) != 0xffffffff) - ND_PRINT((ndo, "/%s", ipaddr_string(&bp[16]))); + ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[16]))); ND_PRINT((ndo, ") %s%s %s", (bp[24] & 0x01) ? "Sparse" : "Dense", (bp[25] & 0x80) ? " WC" : "", @@ -144,7 +144,7 @@ pimv1_join_prune_print(netdissect_options *ndo, ND_TCHECK2(bp[0], sizeof(struct in_addr)); if (ndo->ndo_vflag > 1) ND_PRINT((ndo, "\n")); - ND_PRINT((ndo, " Upstream Nbr: %s", ipaddr_string(bp))); + ND_PRINT((ndo, " Upstream Nbr: %s", ipaddr_string(ndo, bp))); ND_TCHECK2(bp[6], 2); if (ndo->ndo_vflag > 1) ND_PRINT((ndo, "\n")); @@ -165,10 +165,10 @@ pimv1_join_prune_print(netdissect_options *ndo, * mask length "maddrlen"? */ ND_TCHECK2(bp[0], sizeof(struct in_addr)); - ND_PRINT((ndo, "\n\tGroup: %s", ipaddr_string(bp))); + ND_PRINT((ndo, "\n\tGroup: %s", ipaddr_string(ndo, bp))); ND_TCHECK2(bp[4], sizeof(struct in_addr)); if (EXTRACT_32BITS(&bp[4]) != 0xffffffff) - ND_PRINT((ndo, "/%s", ipaddr_string(&bp[4]))); + ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[4]))); ND_TCHECK2(bp[8], 4); njoin = EXTRACT_16BITS(&bp[8]); nprune = EXTRACT_16BITS(&bp[10]); @@ -187,7 +187,7 @@ pimv1_join_prune_print(netdissect_options *ndo, (bp[0] & 0x01) ? "Sparse " : "Dense ", (bp[1] & 0x80) ? "WC " : "", (bp[1] & 0x40) ? "RP " : "SPT ", - ipaddr_string(&bp[2]), bp[1] & 0x3f)); + ipaddr_string(ndo, &bp[2]), bp[1] & 0x3f)); bp += 6; len -= 6; } @@ -242,14 +242,14 @@ pimv1_print(netdissect_options *ndo, case 1: ND_PRINT((ndo, " Register")); ND_TCHECK2(bp[8], 20); /* ip header */ - ND_PRINT((ndo, " for %s > %s", ipaddr_string(&bp[20]), - ipaddr_string(&bp[24]))); + ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[20]), + ipaddr_string(ndo, &bp[24]))); break; case 2: ND_PRINT((ndo, " Register-Stop")); ND_TCHECK2(bp[12], sizeof(struct in_addr)); - ND_PRINT((ndo, " for %s > %s", ipaddr_string(&bp[8]), - ipaddr_string(&bp[12]))); + ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[8]), + ipaddr_string(ndo, &bp[12]))); break; case 3: ND_PRINT((ndo, " Join/Prune")); @@ -260,20 +260,20 @@ pimv1_print(netdissect_options *ndo, ND_PRINT((ndo, " RP-reachable")); if (ndo->ndo_vflag) { ND_TCHECK2(bp[22], 2); - ND_PRINT((ndo, " group %s", ipaddr_string(&bp[8]))); + ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8]))); if (EXTRACT_32BITS(&bp[12]) != 0xffffffff) - ND_PRINT((ndo, "/%s", ipaddr_string(&bp[12]))); - ND_PRINT((ndo, " RP %s hold ", ipaddr_string(&bp[16]))); + ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12]))); + ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16]))); relts_print(ndo, EXTRACT_16BITS(&bp[22])); } break; case 5: ND_PRINT((ndo, " Assert")); ND_TCHECK2(bp[16], sizeof(struct in_addr)); - ND_PRINT((ndo, " for %s > %s", ipaddr_string(&bp[16]), - ipaddr_string(&bp[8]))); + ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]), + ipaddr_string(ndo, &bp[8]))); if (EXTRACT_32BITS(&bp[12]) != 0xffffffff) - ND_PRINT((ndo, "/%s", ipaddr_string(&bp[12]))); + ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12]))); ND_TCHECK2(bp[24], 4); ND_PRINT((ndo, " %s pref %d metric %d", (bp[20] & 0x80) ? "RP-tree" : "SPT", @@ -368,7 +368,7 @@ cisco_autorp_print(netdissect_options *ndo, char s; ND_TCHECK2(bp[0], 4); - ND_PRINT((ndo, " RP %s", ipaddr_string(bp))); + ND_PRINT((ndo, " RP %s", ipaddr_string(ndo, bp))); ND_TCHECK(bp[4]); switch (bp[4] & 0x3) { case 0: ND_PRINT((ndo, " PIMv?")); @@ -389,7 +389,7 @@ cisco_autorp_print(netdissect_options *ndo, for (; nentries; nentries--) { ND_TCHECK2(bp[0], 6); ND_PRINT((ndo, "%c%s%s/%d", s, bp[0] & 1 ? "!" : "", - ipaddr_string(&bp[2]), bp[1])); + ipaddr_string(ndo, &bp[2]), bp[1])); if (bp[0] & 0x02) { ND_PRINT((ndo, " bidir")); } @@ -564,12 +564,12 @@ pimv2_addr_print(netdissect_options *ndo, ND_TCHECK2(bp[0], len); if (af == AF_INET) { if (!silent) - ND_PRINT((ndo, "%s", ipaddr_string(bp))); + ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp))); } #ifdef INET6 else if (af == AF_INET6) { if (!silent) - ND_PRINT((ndo, "%s", ip6addr_string(bp))); + ND_PRINT((ndo, "%s", ip6addr_string(ndo, bp))); } #endif return hdrlen + len; @@ -578,7 +578,7 @@ pimv2_addr_print(netdissect_options *ndo, ND_TCHECK2(bp[0], len + 2); if (af == AF_INET) { if (!silent) { - ND_PRINT((ndo, "%s", ipaddr_string(bp + 2))); + ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp + 2))); if (bp[1] != 32) ND_PRINT((ndo, "/%u", bp[1])); } @@ -586,7 +586,7 @@ pimv2_addr_print(netdissect_options *ndo, #ifdef INET6 else if (af == AF_INET6) { if (!silent) { - ND_PRINT((ndo, "%s", ip6addr_string(bp + 2))); + ND_PRINT((ndo, "%s", ip6addr_string(ndo, bp + 2))); if (bp[1] != 128) ND_PRINT((ndo, "/%u", bp[1])); } @@ -756,8 +756,8 @@ pimv2_print(netdissect_options *ndo, switch (IP_V(ip)) { case 0: /* Null header */ ND_PRINT((ndo, "IP-Null-header %s > %s", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst))); + ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, &ip->ip_dst))); break; case 4: /* IPv4 */ diff --git a/print-pktap.c b/print-pktap.c index 1b5e3c91..55425330 100644 --- a/print-pktap.c +++ b/print-pktap.c @@ -66,7 +66,7 @@ typedef struct pktap_header { #define PKT_REC_PACKET 1 /* a packet follows the header */ static inline void -pktap_header_print(struct netdissect_options *ndo, const u_char *bp, u_int length) +pktap_header_print(netdissect_options *ndo, const u_char *bp, u_int length) { const pktap_header_t *hdr; uint32_t dlt, hdrlen; @@ -92,7 +92,7 @@ pktap_header_print(struct netdissect_options *ndo, const u_char *bp, u_int lengt * is the number of bytes actually captured. */ u_int -pktap_if_print(struct netdissect_options *ndo, +pktap_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { uint32_t dlt, hdrlen, rectype; diff --git a/print-ppi.c b/print-ppi.c index f2a6dad9..16815720 100644 --- a/print-ppi.c +++ b/print-ppi.c @@ -23,7 +23,7 @@ typedef struct ppi_header { #ifdef DLT_PPI static inline void -ppi_header_print(struct netdissect_options *ndo, const u_char *bp, u_int length) +ppi_header_print(netdissect_options *ndo, const u_char *bp, u_int length) { const ppi_header_t *hdr; u_int32_t dlt; @@ -46,7 +46,7 @@ ppi_header_print(struct netdissect_options *ndo, const u_char *bp, u_int length) } static void -ppi_print(struct netdissect_options *ndo, +ppi_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { if_ndo_printer ndo_printer; @@ -91,7 +91,7 @@ ppi_print(struct netdissect_options *ndo, * is the number of bytes actually captured. */ u_int -ppi_if_print(struct netdissect_options *ndo, +ppi_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) { ppi_print(ndo, h, p); diff --git a/print-ppp.c b/print-ppp.c index cf1e7d74..c03ae881 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -731,7 +731,7 @@ print_lcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK2(*(p + 3), 4); - ND_PRINT((ndo, ": IPv4 %s", ipaddr_string(p + 3))); + ND_PRINT((ndo, ": IPv4 %s", ipaddr_string(ndo, p + 3))); break; case MEDCLASS_MAC: if (len != 9) { @@ -1037,8 +1037,8 @@ print_ipcp_config_options(netdissect_options *ndo, } ND_TCHECK2(*(p + 6), 4); ND_PRINT((ndo, ": src %s, dst %s", - ipaddr_string(p + 2), - ipaddr_string(p + 6))); + ipaddr_string(ndo, p + 2), + ipaddr_string(ndo, p + 6))); break; case IPCPOPT_IPCOMP: if (len < 4) { @@ -1118,7 +1118,7 @@ print_ipcp_config_options(netdissect_options *ndo, return 0; } ND_TCHECK2(*(p + 2), 4); - ND_PRINT((ndo, ": %s", ipaddr_string(p + 2))); + ND_PRINT((ndo, ": %s", ipaddr_string(ndo, p + 2))); break; default: /* diff --git a/print-radius.c b/print-radius.c index 3ba26b14..0c3880ef 100644 --- a/print-radius.c +++ b/print-radius.c @@ -699,11 +699,11 @@ print_attr_address(netdissect_options *ndo, if (EXTRACT_32BITS(data) == 0xFFFFFFFE ) ND_PRINT((ndo, "NAS Select")); else - ND_PRINT((ndo, "%s",ipaddr_string(data))); + ND_PRINT((ndo, "%s",ipaddr_string(ndo, data))); break; default: - ND_PRINT((ndo, "%s", ipaddr_string(data))); + ND_PRINT((ndo, "%s", ipaddr_string(ndo, data))); break; } diff --git a/print-rip.c b/print-rip.c index 4ef0a65a..1fb6dd65 100644 --- a/print-rip.c +++ b/print-rip.c @@ -114,12 +114,12 @@ rip_entry_print_v1(netdissect_options *ndo, } if (family == 0) { ND_PRINT((ndo, "\n\t AFI 0, %s, metric: %u", - ipaddr_string(&ni->rip_dest), + ipaddr_string(ndo, &ni->rip_dest), EXTRACT_32BITS(&ni->rip_metric))); return; } /* BSD_AFNUM_INET */ ND_PRINT((ndo, "\n\t %s, metric: %u", - ipaddr_string(&ni->rip_dest), + ipaddr_string(ndo, &ni->rip_dest), EXTRACT_32BITS(&ni->rip_metric))); } @@ -161,12 +161,12 @@ rip_entry_print_v2(netdissect_options *ndo, } else { /* BSD_AFNUM_INET or AFI 0 */ ND_PRINT((ndo, "\n\t AFI %s, %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ", tok2str(bsd_af_values, "%u", family), - ipaddr_string(&ni->rip_dest), + ipaddr_string(ndo, &ni->rip_dest), mask2plen(EXTRACT_32BITS(&ni->rip_dest_mask)), EXTRACT_16BITS(&ni->rip_tag), EXTRACT_32BITS(&ni->rip_metric))); if (EXTRACT_32BITS(&ni->rip_router)) - ND_PRINT((ndo, "%s", ipaddr_string(&ni->rip_router))); + ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ni->rip_router))); else ND_PRINT((ndo, "self")); } diff --git a/print-ripng.c b/print-ripng.c index 17b0ef72..9a5dba43 100644 --- a/print-ripng.c +++ b/print-ripng.c @@ -98,7 +98,7 @@ static int rip6_entry_print(netdissect_options *ndo, register const struct netinfo6 *ni, int metric) { int l; - l = ND_PRINT((ndo, "%s/%d", ip6addr_string(&ni->rip6_dest), ni->rip6_plen)); + l = ND_PRINT((ndo, "%s/%d", ip6addr_string(ndo, &ni->rip6_dest), ni->rip6_plen)); if (ni->rip6_tag) l += ND_PRINT((ndo, " [%d]", EXTRACT_16BITS(&ni->rip6_tag))); if (metric) diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c index 5502ebb4..5bb5df7b 100644 --- a/print-rpki-rtr.c +++ b/print-rpki-rtr.c @@ -225,7 +225,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent) pdu = (rpki_rtr_pdu_ipv4_prefix *)tptr; ND_PRINT((ndo, "%sIPv4 Prefix %s/%u-%u, origin-as %u, flags 0x%02x", indent_string(indent+2), - ipaddr_string(pdu->prefix), + ipaddr_string(ndo, pdu->prefix), pdu->prefix_length, pdu->max_length, EXTRACT_32BITS(pdu->as), pdu->flags)); } @@ -239,7 +239,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, u_int indent) pdu = (rpki_rtr_pdu_ipv6_prefix *)tptr; ND_PRINT((ndo, "%sIPv6 Prefix %s/%u-%u, origin-as %u, flags 0x%02x", indent_string(indent+2), - ip6addr_string(pdu->prefix), + ip6addr_string(ndo, pdu->prefix), pdu->prefix_length, pdu->max_length, EXTRACT_32BITS(pdu->as), pdu->flags)); } diff --git a/print-rrcp.c b/print-rrcp.c index 82d0788a..7c6ca25f 100644 --- a/print-rrcp.c +++ b/print-rrcp.c @@ -89,8 +89,8 @@ rrcp_print(netdissect_options *ndo, ND_TCHECK(*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)); rrcp_opcode = (*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK; ND_PRINT((ndo, "%s > %s, %s %s", - etheraddr_string(ESRC(ep)), - etheraddr_string(EDST(ep)), + etheraddr_string(ndo, ESRC(ep)), + etheraddr_string(ndo, EDST(ep)), tok2strbuf(proto_values,"RRCP-0x%02x",rrcp_proto,proto_str,sizeof(proto_str)), ((*(rrcp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_ISREPLY) ? "reply" : "query")); if (rrcp_proto==1){ @@ -114,7 +114,7 @@ rrcp_print(netdissect_options *ndo, ND_PRINT((ndo, " downlink_port=%d, uplink_port=%d, uplink_mac=%s, vendor_id=%08x ,chip_id=%04x ", *(rrcp + RRCP_DOWNLINK_PORT_OFFSET), *(rrcp + RRCP_UPLINK_PORT_OFFSET), - etheraddr_string(rrcp + RRCP_UPLINK_MAC_OFFSET), + etheraddr_string(ndo, rrcp + RRCP_UPLINK_MAC_OFFSET), EXTRACT_32BITS(rrcp + RRCP_VENDOR_ID_OFFSET), EXTRACT_16BITS(rrcp + RRCP_CHIP_ID_OFFSET))); }else if (rrcp_opcode==1 || rrcp_opcode==2 || rrcp_proto==2){ diff --git a/print-rsvp.c b/print-rsvp.c index 38bfbbb6..4edb90ee 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -715,7 +715,7 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv4 DestAddress: %s, Protocol ID: 0x%02x", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), *(obj_tptr + sizeof(struct in_addr)))); ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u", ident, @@ -730,7 +730,7 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv6 DestAddress: %s, Protocol ID: 0x%02x", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), *(obj_tptr + sizeof(struct in6_addr)))); ND_PRINT((ndo, "%s Flags: [0x%02x], DestPort %u", ident, @@ -745,9 +745,9 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), - ip6addr_string(obj_tptr + 20))); + ip6addr_string(ndo, obj_tptr + 20))); obj_tlen-=36; obj_tptr+=36; break; @@ -759,7 +759,7 @@ _U_ ident, EXTRACT_32BITS(obj_tptr), EXTRACT_16BITS(obj_tptr+6), - ip6addr_string(obj_tptr + 8))); + ip6addr_string(ndo, obj_tptr + 8))); obj_tlen-=26; obj_tptr+=26; break; @@ -769,9 +769,9 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), - ipaddr_string(obj_tptr + 8))); + ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; @@ -781,9 +781,9 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), - ipaddr_string(obj_tptr + 8))); + ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; @@ -799,7 +799,7 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv4 Receiver Address: %s", ident, - ipaddr_string(obj_tptr))); + ipaddr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in_addr); obj_tptr+=sizeof(struct in_addr); break; @@ -809,7 +809,7 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv6 Receiver Address: %s", ident, - ip6addr_string(obj_tptr))); + ip6addr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in6_addr); obj_tptr+=sizeof(struct in6_addr); break; @@ -826,7 +826,7 @@ _U_ return -1; ND_PRINT((ndo, "%s IPv4 Notify Node Address: %s", ident, - ipaddr_string(obj_tptr))); + ipaddr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in_addr); obj_tptr+=sizeof(struct in_addr); break; @@ -836,7 +836,7 @@ _U_ return-1; ND_PRINT((ndo, "%s IPv6 Notify Node Address: %s", ident, - ip6addr_string(obj_tptr))); + ip6addr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in6_addr); obj_tptr+=sizeof(struct in6_addr); break; @@ -910,7 +910,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; @@ -921,7 +921,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; @@ -932,10 +932,10 @@ _U_ ND_PRINT((ndo, "%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x" "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ident, - ip6addr_string(obj_tptr+20), + ip6addr_string(ndo, obj_tptr+20), EXTRACT_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; @@ -946,7 +946,7 @@ _U_ return-1; ND_PRINT((ndo, "%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; @@ -957,10 +957,10 @@ _U_ ND_PRINT((ndo, "%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x" "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ident, - ipaddr_string(obj_tptr+8), + ipaddr_string(ndo, obj_tptr+8), EXTRACT_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; @@ -1068,7 +1068,7 @@ _U_ case RSVP_OBJ_XRO_IPV4: ND_PRINT((ndo, ", %s, %s/%u, Flags: [%s]", RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr) ? "Loose" : "Strict", - ipaddr_string(obj_tptr+2), + ipaddr_string(ndo, obj_tptr+2), *(obj_tptr+6), bittok2str(rsvp_obj_rro_flag_values, "none", @@ -1189,14 +1189,14 @@ _U_ if (subobj_len < 8) return -1; ND_PRINT((ndo, "%s UNI IPv4 TNA address: %s", - ident, ipaddr_string(obj_tptr + 4))); + ident, ipaddr_string(ndo, obj_tptr + 4))); break; #ifdef INET6 case AFNUM_INET6: if (subobj_len < 20) return -1; ND_PRINT((ndo, "%s UNI IPv6 TNA address: %s", - ident, ip6addr_string(obj_tptr + 4))); + ident, ip6addr_string(ndo, obj_tptr + 4))); break; #endif case AFNUM_NSAP: @@ -1265,7 +1265,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; @@ -1279,7 +1279,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr + 16))); obj_tlen-=20; obj_tptr+=20; @@ -1356,7 +1356,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; @@ -1367,7 +1367,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Source Address: %s, Source Port: %u", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; @@ -1377,7 +1377,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Source Address: %s, Flow Label: %u", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_24BITS(obj_tptr + 17))); obj_tlen-=20; obj_tptr+=20; @@ -1387,7 +1387,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; @@ -1398,10 +1398,10 @@ _U_ ND_PRINT((ndo, "%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x" "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ident, - ip6addr_string(obj_tptr+20), + ip6addr_string(ndo, obj_tptr+20), EXTRACT_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; @@ -1412,7 +1412,7 @@ _U_ return-1; ND_PRINT((ndo, "%s Source Address: %s, LSP-ID: 0x%04x", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; @@ -1423,10 +1423,10 @@ _U_ ND_PRINT((ndo, "%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x" "%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ident, - ipaddr_string(obj_tptr+8), + ipaddr_string(ndo, obj_tptr+8), EXTRACT_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; @@ -1488,8 +1488,8 @@ _U_ while(obj_tlen >= 8) { ND_PRINT((ndo, "%s PLR-ID: %s, Avoid-Node-ID: %s", ident, - ipaddr_string(obj_tptr), - ipaddr_string(obj_tptr + 4))); + ipaddr_string(ndo, obj_tptr), + ipaddr_string(ndo, obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; } @@ -1524,7 +1524,7 @@ _U_ error_value=EXTRACT_16BITS(obj_tptr+6); ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", ident, - ipaddr_string(obj_tptr), + ipaddr_string(ndo, obj_tptr), *(obj_tptr+4), ident, tok2str(rsvp_obj_error_code_values,"unknown",error_code), @@ -1557,7 +1557,7 @@ _U_ error_value=EXTRACT_16BITS(obj_tptr+18); ND_PRINT((ndo, "%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)", ident, - ip6addr_string(obj_tptr), + ip6addr_string(ndo, obj_tptr), *(obj_tptr+16), ident, tok2str(rsvp_obj_error_code_values,"unknown",error_code), @@ -1746,7 +1746,7 @@ _U_ if (obj_tlen < 4) return-1; ND_PRINT((ndo, "%s Sub-LSP destination address: %s", - ident, ipaddr_string(obj_tptr))); + ident, ipaddr_string(ndo, obj_tptr))); obj_tlen-=4; obj_tptr+=4; @@ -1756,7 +1756,7 @@ _U_ if (obj_tlen < 16) return-1; ND_PRINT((ndo, "%s Sub-LSP destination address: %s", - ident, ip6addr_string(obj_tptr))); + ident, ip6addr_string(ndo, obj_tptr))); obj_tlen-=16; obj_tptr+=16; diff --git a/print-rt6.c b/print-rt6.c index 9cd13de1..2205c5ea 100644 --- a/print-rt6.c +++ b/print-rt6.c @@ -80,7 +80,7 @@ rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2 if ((u_char *)(addr + 1) > ep) goto trunc; - ND_PRINT((ndo, ", [%d]%s", i, ip6addr_string(addr))); + ND_PRINT((ndo, ", [%d]%s", i, ip6addr_string(ndo, addr))); addr++; } /*(*/ diff --git a/print-sctp.c b/print-sctp.c index 687c36f5..e3864968 100644 --- a/print-sctp.c +++ b/print-sctp.c @@ -456,17 +456,17 @@ void sctp_print(netdissect_options *ndo, #ifdef INET6 if (ip6) { ND_PRINT((ndo, "%s.%d > %s.%d: sctp", - ip6addr_string(&ip6->ip6_src), + ip6addr_string(ndo, &ip6->ip6_src), sourcePort, - ip6addr_string(&ip6->ip6_dst), + ip6addr_string(ndo, &ip6->ip6_dst), destPort)); } else #endif /*INET6*/ { ND_PRINT((ndo, "%s.%d > %s.%d: sctp", - ipaddr_string(&ip->ip_src), + ipaddr_string(ndo, &ip->ip_src), sourcePort, - ipaddr_string(&ip->ip_dst), + ipaddr_string(ndo, &ip->ip_dst), destPort)); } diff --git a/print-sflow.c b/print-sflow.c index 07dcb9ce..cad42c12 100644 --- a/print-sflow.c +++ b/print-sflow.c @@ -847,7 +847,7 @@ sflow_print(netdissect_options *ndo, ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, length %u", EXTRACT_32BITS(sflow_datagram->version), EXTRACT_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", - ipaddr_string(sflow_datagram->agent), + ipaddr_string(ndo, sflow_datagram->agent), EXTRACT_32BITS(sflow_datagram->agent_id), len)); return; @@ -858,7 +858,7 @@ sflow_print(netdissect_options *ndo, ND_PRINT((ndo, "sFlowv%u, %s agent %s, agent-id %u, seqnum %u, uptime %u, samples %u, length %u", EXTRACT_32BITS(sflow_datagram->version), EXTRACT_32BITS(sflow_datagram->ip_version) == 1 ? "IPv4" : "IPv6", - ipaddr_string(sflow_datagram->agent), + ipaddr_string(ndo, sflow_datagram->agent), EXTRACT_32BITS(sflow_datagram->agent_id), EXTRACT_32BITS(sflow_datagram->seqnum), EXTRACT_32BITS(sflow_datagram->uptime), diff --git a/print-sll.c b/print-sll.c index 82bb4d63..bddcab38 100644 --- a/print-sll.c +++ b/print-sll.c @@ -143,7 +143,7 @@ sll_print(netdissect_options *ndo, register const struct sll_header *sllp, u_int * XXX - print others as strings of hex? */ if (EXTRACT_16BITS(&sllp->sll_halen) == 6) - ND_PRINT((ndo, "%s ", etheraddr_string(sllp->sll_addr))); + ND_PRINT((ndo, "%s ", etheraddr_string(ndo, sllp->sll_addr))); if (!ndo->ndo_qflag) { ether_type = EXTRACT_16BITS(&sllp->sll_protocol); diff --git a/print-slow.c b/print-slow.c index aa26d3e9..c5746f12 100644 --- a/print-slow.c +++ b/print-slow.c @@ -382,7 +382,7 @@ slow_marker_lacp_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t System %s, System Priority %u, Key %u" \ ", Port %u, Port Priority %u\n\t State Flags [%s]", - etheraddr_string(tlv_ptr.lacp_tlv_actor_partner_info->sys), + etheraddr_string(ndo, tlv_ptr.lacp_tlv_actor_partner_info->sys), EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->sys_pri), EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->key), EXTRACT_16BITS(tlv_ptr.lacp_tlv_actor_partner_info->port), @@ -405,7 +405,7 @@ slow_marker_lacp_print(netdissect_options *ndo, tlv_ptr.marker_tlv_marker_info = (const struct marker_tlv_marker_info_t *)tlv_tptr; ND_PRINT((ndo, "\n\t Request System %s, Request Port %u, Request Transaction ID 0x%08x", - etheraddr_string(tlv_ptr.marker_tlv_marker_info->req_sys), + etheraddr_string(ndo, tlv_ptr.marker_tlv_marker_info->req_sys), EXTRACT_16BITS(tlv_ptr.marker_tlv_marker_info->req_port), EXTRACT_32BITS(tlv_ptr.marker_tlv_marker_info->req_trans_id))); diff --git a/print-sunrpc.c b/print-sunrpc.c index 16cc2712..e7b1d8ae 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -193,15 +193,15 @@ sunrpcrequest_print(netdissect_options *ndo, register const u_char *bp, case 4: ip = (struct ip *)bp2; ND_PRINT((ndo, "%s.%s > %s.%s: %d", - ipaddr_string(&ip->ip_src), srcid, - ipaddr_string(&ip->ip_dst), dstid, length)); + ipaddr_string(ndo, &ip->ip_src), srcid, + ipaddr_string(ndo, &ip->ip_dst), dstid, length)); break; #ifdef INET6 case 6: ip6 = (struct ip6_hdr *)bp2; ND_PRINT((ndo, "%s.%s > %s.%s: %d", - ip6addr_string(&ip6->ip6_src), srcid, - ip6addr_string(&ip6->ip6_dst), dstid, length)); + ip6addr_string(ndo, &ip6->ip6_src), srcid, + ip6addr_string(ndo, &ip6->ip6_dst), dstid, length)); break; #endif default: diff --git a/print-tcp.c b/print-tcp.c index 5d726af7..ee9e764e 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -179,8 +179,8 @@ tcp_print(netdissect_options *ndo, ch = '\0'; if (!ND_TTEST(tp->th_dport)) { ND_PRINT((ndo, "%s > %s: [|tcp]", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst))); + ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, &ip->ip_dst))); return; } @@ -193,9 +193,9 @@ tcp_print(netdissect_options *ndo, if (ip6) { if (ip6->ip6_nxt == IPPROTO_TCP) { ND_PRINT((ndo, "%s.%s > %s.%s: ", - ip6addr_string(&ip6->ip6_src), + ip6addr_string(ndo, &ip6->ip6_src), tcpport_string(sport), - ip6addr_string(&ip6->ip6_dst), + ip6addr_string(ndo, &ip6->ip6_dst), tcpport_string(dport))); } else { ND_PRINT((ndo, "%s > %s: ", @@ -206,9 +206,9 @@ tcp_print(netdissect_options *ndo, { if (ip->ip_p == IPPROTO_TCP) { ND_PRINT((ndo, "%s.%s > %s.%s: ", - ipaddr_string(&ip->ip_src), + ipaddr_string(ndo, &ip->ip_src), tcpport_string(sport), - ipaddr_string(&ip->ip_dst), + ipaddr_string(ndo, &ip->ip_dst), tcpport_string(dport))); } else { ND_PRINT((ndo, "%s > %s: ", diff --git a/print-token.c b/print-token.c index 3aba5bcf..027fb69f 100644 --- a/print-token.c +++ b/print-token.c @@ -110,8 +110,8 @@ token_hdr_print(netdissect_options *ndo, { const char *srcname, *dstname; - srcname = etheraddr_string(fsrc); - dstname = etheraddr_string(fdst); + srcname = etheraddr_string(ndo, fsrc); + dstname = etheraddr_string(ndo, fdst); if (ndo->ndo_vflag) ND_PRINT((ndo, "%02x %02x %s %s %d: ", diff --git a/print-udp.c b/print-udp.c index 8ae99923..a567cefc 100644 --- a/print-udp.c +++ b/print-udp.c @@ -304,13 +304,13 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo if (ip6->ip6_nxt == IPPROTO_UDP) { if (sport == -1) { ND_PRINT((ndo, "%s > %s: ", - ip6addr_string(&ip6->ip6_src), - ip6addr_string(&ip6->ip6_dst))); + ip6addr_string(ndo, &ip6->ip6_src), + ip6addr_string(ndo, &ip6->ip6_dst))); } else { ND_PRINT((ndo, "%s.%s > %s.%s: ", - ip6addr_string(&ip6->ip6_src), + ip6addr_string(ndo, &ip6->ip6_src), udpport_string(sport), - ip6addr_string(&ip6->ip6_dst), + ip6addr_string(ndo, &ip6->ip6_dst), udpport_string(dport))); } } else { @@ -326,13 +326,13 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo if (ip->ip_p == IPPROTO_UDP) { if (sport == -1) { ND_PRINT((ndo, "%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst))); + ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, &ip->ip_dst))); } else { ND_PRINT((ndo, "%s.%s > %s.%s: ", - ipaddr_string(&ip->ip_src), + ipaddr_string(ndo, &ip->ip_src), udpport_string(sport), - ipaddr_string(&ip->ip_dst), + ipaddr_string(ndo, &ip->ip_dst), udpport_string(dport))); } } else { diff --git a/print-vqp.c b/print-vqp.c index e583f445..a316b0cd 100644 --- a/print-vqp.c +++ b/print-vqp.c @@ -172,7 +172,7 @@ vqp_print(netdissect_options *ndo, register const u_char *pptr, register u_int l switch(vqp_obj_type) { case VQP_OBJ_IP_ADDRESS: - ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(tptr), EXTRACT_32BITS(tptr))); + ND_PRINT((ndo, "%s (0x%08x)", ipaddr_string(ndo, tptr), EXTRACT_32BITS(tptr))); break; /* those objects have similar semantics - fall through */ case VQP_OBJ_PORT_NAME: @@ -184,7 +184,7 @@ vqp_print(netdissect_options *ndo, register const u_char *pptr, register u_int l /* those objects have similar semantics - fall through */ case VQP_OBJ_MAC_ADDRESS: case VQP_OBJ_MAC_NULL: - ND_PRINT((ndo, "%s", etheraddr_string(tptr))); + ND_PRINT((ndo, "%s", etheraddr_string(ndo, tptr))); break; default: if (ndo->ndo_vflag <= 1) diff --git a/print-vrrp.c b/print-vrrp.c index 0be12628..610a84a5 100644 --- a/print-vrrp.c +++ b/print-vrrp.c @@ -162,7 +162,7 @@ vrrp_print(netdissect_options *ndo, bp += 8; for (i = 0; i < naddrs; i++) { ND_TCHECK(bp[3]); - ND_PRINT((ndo, "%c%s", c, ipaddr_string(bp))); + ND_PRINT((ndo, "%c%s", c, ipaddr_string(ndo, bp))); c = ','; bp += 4; } diff --git a/print-vtp.c b/print-vtp.c index 428e0ab3..2d331c0a 100644 --- a/print-vtp.c +++ b/print-vtp.c @@ -179,7 +179,7 @@ vtp_print (netdissect_options *ndo, ND_PRINT((ndo, "\n\t Config Rev %x, Updater %s", EXTRACT_32BITS(tptr), - ipaddr_string(tptr+4))); + ipaddr_string(ndo, tptr+4))); tptr += 8; ND_PRINT((ndo, ", Timestamp 0x%08x 0x%08x 0x%08x", EXTRACT_32BITS(tptr), diff --git a/print-wb.c b/print-wb.c index 14ce4450..3b7f11e2 100644 --- a/print-wb.c +++ b/print-wb.c @@ -192,10 +192,10 @@ wb_id(netdissect_options *ndo, ND_PRINT((ndo, " %u/%s:%u (max %u/%s:%u) ", EXTRACT_32BITS(&id->pi_ps.slot), - ipaddr_string(&id->pi_ps.page.p_sid), + ipaddr_string(ndo, &id->pi_ps.page.p_sid), EXTRACT_32BITS(&id->pi_ps.page.p_uid), EXTRACT_32BITS(&id->pi_mslot), - ipaddr_string(&id->pi_mpage.p_sid), + ipaddr_string(ndo, &id->pi_mpage.p_sid), EXTRACT_32BITS(&id->pi_mpage.p_uid))); nid = EXTRACT_16BITS(&id->pi_ps.nid); @@ -211,7 +211,7 @@ wb_id(netdissect_options *ndo, c = '<'; for (i = 0; i < nid && (u_char *)(io + 1) <= ndo->ndo_snapend; ++io, ++i) { ND_PRINT((ndo, "%c%s:%u", - c, ipaddr_string(&io->id), EXTRACT_32BITS(&io->off))); + c, ipaddr_string(ndo, &io->id), EXTRACT_32BITS(&io->off))); c = ','; } if (i >= nid) { @@ -230,8 +230,8 @@ wb_rreq(netdissect_options *ndo, return (-1); ND_PRINT((ndo, " please repair %s %s:%u<%u:%u>", - ipaddr_string(&rreq->pr_id), - ipaddr_string(&rreq->pr_page.p_sid), + ipaddr_string(ndo, &rreq->pr_id), + ipaddr_string(ndo, &rreq->pr_page.p_sid), EXTRACT_32BITS(&rreq->pr_page.p_uid), EXTRACT_32BITS(&rreq->pr_sseq), EXTRACT_32BITS(&rreq->pr_eseq))); @@ -248,7 +248,7 @@ wb_preq(netdissect_options *ndo, ND_PRINT((ndo, " need %u/%s:%u", EXTRACT_32BITS(&preq->pp_low), - ipaddr_string(&preq->pp_page.p_sid), + ipaddr_string(ndo, &preq->pp_page.p_sid), EXTRACT_32BITS(&preq->pp_page.p_uid))); return (0); } @@ -273,11 +273,11 @@ wb_prep(netdissect_options *ndo, ND_PRINT((ndo, " %u/%s:%u", EXTRACT_32BITS(&ps->slot), - ipaddr_string(&ps->page.p_sid), + ipaddr_string(ndo, &ps->page.p_sid), EXTRACT_32BITS(&ps->page.p_uid))); io = (struct id_off *)(ps + 1); for (ie = io + ps->nid; io < ie && (u_char *)(io + 1) <= ep; ++io) { - ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(&io->id), + ND_PRINT((ndo, "%c%s:%u", c, ipaddr_string(ndo, &io->id), EXTRACT_32BITS(&io->off))); c = ','; } @@ -352,8 +352,8 @@ wb_rrep(netdissect_options *ndo, len -= sizeof(*rrep); ND_PRINT((ndo, " for %s %s:%u<%u:%u>", - ipaddr_string(&rrep->pr_id), - ipaddr_string(&dop->pd_page.p_sid), + ipaddr_string(ndo, &rrep->pr_id), + ipaddr_string(ndo, &dop->pd_page.p_sid), EXTRACT_32BITS(&dop->pd_page.p_uid), EXTRACT_32BITS(&dop->pd_sseq), EXTRACT_32BITS(&dop->pd_eseq))); @@ -375,7 +375,7 @@ wb_drawop(netdissect_options *ndo, len -= sizeof(*dop); ND_PRINT((ndo, " %s:%u<%u:%u>", - ipaddr_string(&dop->pd_page.p_sid), + ipaddr_string(ndo, &dop->pd_page.p_sid), EXTRACT_32BITS(&dop->pd_page.p_uid), EXTRACT_32BITS(&dop->pd_sseq), EXTRACT_32BITS(&dop->pd_eseq))); diff --git a/tcpdump.c b/tcpdump.c index 294c74bf..2bc87924 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -1460,7 +1460,7 @@ main(int argc, char **argv) free(cmdbuf); exit(0); } - init_addrtoname(localnet, netmask); + init_addrtoname(gndo, localnet, netmask); init_checksum(); #ifndef WIN32