diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-01-31 00:43:45 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-01-31 00:43:45 -0800 |
commit | 0dad1934af3db3f97d4371463089c8725dbfa26d (patch) | |
tree | eaedbdb157d6aae6e44ade1830a6144b08a1eaaf | |
parent | 44c822e9f671b7a9b2e52b781cdbf38933cbdeaf (diff) | |
download | tcpdump-0dad1934af3db3f97d4371463089c8725dbfa26d.tar.gz |
Have ip{6}addr_string take a u_char * as the second argument.
Fix warnings that introduces.
-rw-r--r-- | addrtoname.c | 12 | ||||
-rw-r--r-- | addrtoname.h | 7 | ||||
-rw-r--r-- | print-aodv.c | 30 | ||||
-rw-r--r-- | print-bgp.c | 14 | ||||
-rw-r--r-- | print-chdlc.c | 4 | ||||
-rw-r--r-- | print-dccp.c | 8 | ||||
-rw-r--r-- | print-dhcp6.c | 8 | ||||
-rw-r--r-- | print-egp.c | 8 | ||||
-rw-r--r-- | print-eigrp.c | 6 | ||||
-rw-r--r-- | print-hncp.c | 2 | ||||
-rw-r--r-- | print-icmp6.c | 38 | ||||
-rw-r--r-- | print-ip.c | 16 | ||||
-rw-r--r-- | print-ip6.c | 4 | ||||
-rw-r--r-- | print-juniper.c | 4 | ||||
-rw-r--r-- | print-ldp.c | 2 | ||||
-rw-r--r-- | print-lldp.c | 4 | ||||
-rw-r--r-- | print-mobile.c | 4 | ||||
-rw-r--r-- | print-msnlb.c | 4 | ||||
-rw-r--r-- | print-nfs.c | 8 | ||||
-rw-r--r-- | print-ntp.c | 4 | ||||
-rw-r--r-- | print-ospf.c | 30 | ||||
-rw-r--r-- | print-ospf6.c | 59 | ||||
-rw-r--r-- | print-pgm.c | 16 | ||||
-rw-r--r-- | print-pim.c | 4 | ||||
-rw-r--r-- | print-rip.c | 8 | ||||
-rw-r--r-- | print-ripng.c | 2 | ||||
-rw-r--r-- | print-sctp.c | 8 | ||||
-rw-r--r-- | print-sunrpc.c | 8 | ||||
-rw-r--r-- | print-tcp.c | 20 | ||||
-rw-r--r-- | print-udp.c | 16 | ||||
-rw-r--r-- | print-wb.c | 22 |
31 files changed, 188 insertions, 192 deletions
diff --git a/addrtoname.c b/addrtoname.c index effc0914..f488dde0 100644 --- a/addrtoname.c +++ b/addrtoname.c @@ -283,7 +283,7 @@ extern cap_channel_t *capdns; * also needs to check whether they're present in the packet buffer. */ const char * -getname(netdissect_options *ndo, const u_char *ap) +ipaddr_string(netdissect_options *ndo, const u_char *ap) { struct hostent *hp; uint32_t addr; @@ -320,7 +320,7 @@ getname(netdissect_options *ndo, const u_char *ap) p->name = strdup(hp->h_name); if (p->name == NULL) (*ndo->ndo_error)(ndo, - "getname: strdup(hp->h_name)"); + "ipaddr_string: strdup(hp->h_name)"); if (ndo->ndo_Nflag) { /* Remove domain qualifications */ dotp = strchr(p->name, '.'); @@ -332,7 +332,7 @@ getname(netdissect_options *ndo, const u_char *ap) } p->name = strdup(intoa(addr)); if (p->name == NULL) - (*ndo->ndo_error)(ndo, "getname: strdup(intoa(addr))"); + (*ndo->ndo_error)(ndo, "ipaddr_string: strdup(intoa(addr))"); return (p->name); } @@ -341,7 +341,7 @@ getname(netdissect_options *ndo, const u_char *ap) * is assumed to be in network byte order. */ const char * -getname6(netdissect_options *ndo, const u_char *ap) +ip6addr_string(netdissect_options *ndo, const u_char *ap) { struct hostent *hp; union { @@ -382,7 +382,7 @@ getname6(netdissect_options *ndo, const u_char *ap) p->name = strdup(hp->h_name); if (p->name == NULL) (*ndo->ndo_error)(ndo, - "getname6: strdup(hp->h_name)"); + "ip6addr_string: strdup(hp->h_name)"); if (ndo->ndo_Nflag) { /* Remove domain qualifications */ dotp = strchr(p->name, '.'); @@ -395,7 +395,7 @@ getname6(netdissect_options *ndo, const u_char *ap) cp = addrtostr6(ap, ntop_buf, sizeof(ntop_buf)); p->name = strdup(cp); if (p->name == NULL) - (*ndo->ndo_error)(ndo, "getname6: strdup(cp)"); + (*ndo->ndo_error)(ndo, "ip6addr_string: strdup(cp)"); return (p->name); } diff --git a/addrtoname.h b/addrtoname.h index 8a37d3d5..dc22458f 100644 --- a/addrtoname.h +++ b/addrtoname.h @@ -48,14 +48,11 @@ extern const char *udpport_string(netdissect_options *, u_short); extern const char *isonsap_string(netdissect_options *, const u_char *, u_int); extern const char *dnaddr_string(netdissect_options *, u_short); extern const char *ipxsap_string(netdissect_options *, u_short); -extern const char *getname(netdissect_options *, const u_char *); -extern const char *getname6(netdissect_options *, const u_char *); +extern const char *ipaddr_string(netdissect_options *, const u_char *); +extern const char *ip6addr_string(netdissect_options *, const u_char *); extern const char *intoa(uint32_t); extern void init_addrtoname(netdissect_options *, uint32_t, uint32_t); extern struct hnamemem *newhnamemem(netdissect_options *); extern struct h6namemem *newh6namemem(netdissect_options *); extern const char * ieee8021q_tci_string(const uint16_t); - -#define ipaddr_string(ndo, p) getname(ndo, (const u_char *)(p)) -#define ip6addr_string(ndo, p) getname6(ndo, (const u_char *)(p)) diff --git a/print-aodv.c b/print-aodv.c index abec0104..2bbd3833 100644 --- a/print-aodv.c +++ b/print-aodv.c @@ -223,9 +223,9 @@ aodv_rreq(netdissect_options *ndo, const u_char *dat, u_int length) EXTRACT_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", EXTRACT_U_1(ap->rreq_hops), EXTRACT_BE_U_4(ap->rreq_id), - ipaddr_string(ndo, &ap->rreq_da), + ipaddr_string(ndo, ap->rreq_da), EXTRACT_BE_U_4(ap->rreq_ds), - ipaddr_string(ndo, &ap->rreq_oa), + ipaddr_string(ndo, ap->rreq_oa), EXTRACT_BE_U_4(ap->rreq_os)); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) @@ -251,9 +251,9 @@ aodv_rrep(netdissect_options *ndo, const u_char *dat, u_int length) EXTRACT_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", EXTRACT_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, EXTRACT_U_1(ap->rrep_hops), - ipaddr_string(ndo, &ap->rrep_da), + ipaddr_string(ndo, ap->rrep_da), EXTRACT_BE_U_4(ap->rrep_ds), - ipaddr_string(ndo, &ap->rrep_oa), + ipaddr_string(ndo, ap->rrep_oa), EXTRACT_BE_U_4(ap->rrep_life)); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) @@ -283,7 +283,7 @@ aodv_rerr(netdissect_options *ndo, const u_char *dat, u_int length) ND_TCHECK_SIZE(dp); if (i < sizeof(*dp)) goto trunc; - ND_PRINT(" {%s}(%u)", ipaddr_string(ndo, &dp->u_da), + ND_PRINT(" {%s}(%u)", ipaddr_string(ndo, dp->u_da), EXTRACT_BE_U_4(dp->u_ds)); dp++; i -= sizeof(*dp); @@ -312,9 +312,9 @@ aodv_v6_rreq(netdissect_options *ndo, const u_char *dat, u_int length) EXTRACT_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", EXTRACT_U_1(ap->rreq_hops), EXTRACT_BE_U_4(ap->rreq_id), - ip6addr_string(ndo, &ap->rreq_da), + ip6addr_string(ndo, ap->rreq_da), EXTRACT_BE_U_4(ap->rreq_ds), - ip6addr_string(ndo, &ap->rreq_oa), + ip6addr_string(ndo, ap->rreq_oa), EXTRACT_BE_U_4(ap->rreq_os)); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) @@ -340,9 +340,9 @@ aodv_v6_rrep(netdissect_options *ndo, const u_char *dat, u_int length) EXTRACT_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", EXTRACT_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, EXTRACT_U_1(ap->rrep_hops), - ip6addr_string(ndo, &ap->rrep_da), + ip6addr_string(ndo, ap->rrep_da), EXTRACT_BE_U_4(ap->rrep_ds), - ip6addr_string(ndo, &ap->rrep_oa), + ip6addr_string(ndo, ap->rrep_oa), EXTRACT_BE_U_4(ap->rrep_life)); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) @@ -372,7 +372,7 @@ aodv_v6_rerr(netdissect_options *ndo, const u_char *dat, u_int length) ND_TCHECK_SIZE(dp6); if (i < sizeof(*dp6)) goto trunc; - ND_PRINT(" {%s}(%u)", ip6addr_string(ndo, &dp6->u_da), + ND_PRINT(" {%s}(%u)", ip6addr_string(ndo, dp6->u_da), EXTRACT_BE_U_4(dp6->u_ds)); dp6++; i -= sizeof(*dp6); @@ -401,9 +401,9 @@ aodv_v6_draft_01_rreq(netdissect_options *ndo, const u_char *dat, u_int length) EXTRACT_U_1(ap->rreq_type) & RREQ_UNKNOWN ? "[U] " : " ", EXTRACT_U_1(ap->rreq_hops), EXTRACT_BE_U_4(ap->rreq_id), - ip6addr_string(ndo, &ap->rreq_da), + ip6addr_string(ndo, ap->rreq_da), EXTRACT_BE_U_4(ap->rreq_ds), - ip6addr_string(ndo, &ap->rreq_oa), + ip6addr_string(ndo, ap->rreq_oa), EXTRACT_BE_U_4(ap->rreq_os)); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) @@ -429,9 +429,9 @@ aodv_v6_draft_01_rrep(netdissect_options *ndo, const u_char *dat, u_int length) EXTRACT_U_1(ap->rrep_type) & RREP_ACK ? "[A] " : " ", EXTRACT_U_1(ap->rrep_ps) & RREP_PREFIX_MASK, EXTRACT_U_1(ap->rrep_hops), - ip6addr_string(ndo, &ap->rrep_da), + ip6addr_string(ndo, ap->rrep_da), EXTRACT_BE_U_4(ap->rrep_ds), - ip6addr_string(ndo, &ap->rrep_oa), + ip6addr_string(ndo, ap->rrep_oa), EXTRACT_BE_U_4(ap->rrep_life)); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) @@ -461,7 +461,7 @@ aodv_v6_draft_01_rerr(netdissect_options *ndo, const u_char *dat, u_int length) ND_TCHECK_SIZE(dp6); if (i < sizeof(*dp6)) goto trunc; - ND_PRINT(" {%s}(%u)", ip6addr_string(ndo, &dp6->u_da), + ND_PRINT(" {%s}(%u)", ip6addr_string(ndo, dp6->u_da), EXTRACT_BE_U_4(dp6->u_ds)); dp6++; i -= sizeof(*dp6); diff --git a/print-bgp.c b/print-bgp.c index f3a86e15..ffae3672 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -555,7 +555,7 @@ decode_prefix4(netdissect_options *ndo, if (plen % 8) { ((u_char *)&addr)[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } - nd_snprintf(buf, buflen, "%s/%u", ipaddr_string(ndo, &addr), plen); + nd_snprintf(buf, buflen, "%s/%u", ipaddr_string(ndo, (const u_char *)&addr), plen); return 1 + plenbytes; trunc: @@ -604,7 +604,7 @@ decode_labeled_prefix4(netdissect_options *ndo, } /* the label may get offsetted by 4 bits so lets shift it right */ nd_snprintf(buf, buflen, "%s/%u, label:%u %s", - ipaddr_string(ndo, &addr), + ipaddr_string(ndo, (const u_char *)&addr), plen, EXTRACT_BE_U_3(pptr + 1)>>4, ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -845,7 +845,7 @@ decode_labeled_vpn_prefix4(netdissect_options *ndo, /* the label may get offsetted by 4 bits so lets shift it right */ nd_snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s", bgp_vpn_rd_print(ndo, pptr+4), - ipaddr_string(ndo, &addr), + ipaddr_string(ndo, (const u_char *)&addr), plen, EXTRACT_BE_U_3(pptr + 1)>>4, ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -1169,7 +1169,7 @@ decode_prefix6(netdissect_options *ndo, addr.s6_addr[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } - nd_snprintf(buf, buflen, "%s/%u", ip6addr_string(ndo, &addr), plen); + nd_snprintf(buf, buflen, "%s/%u", ip6addr_string(ndo, (const u_char *)&addr), plen); return 1 + plenbytes; trunc: @@ -1210,7 +1210,7 @@ decode_labeled_prefix6(netdissect_options *ndo, } /* the label may get offsetted by 4 bits so lets shift it right */ nd_snprintf(buf, buflen, "%s/%u, label:%u %s", - ip6addr_string(ndo, &addr), + ip6addr_string(ndo, (const u_char *)&addr), plen, EXTRACT_BE_U_3(pptr + 1)>>4, ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -1252,7 +1252,7 @@ decode_labeled_vpn_prefix6(netdissect_options *ndo, /* the label may get offsetted by 4 bits so lets shift it right */ nd_snprintf(buf, buflen, "RD: %s, %s/%u, label:%u %s", bgp_vpn_rd_print(ndo, pptr+4), - ip6addr_string(ndo, &addr), + ip6addr_string(ndo, (const u_char *)&addr), plen, EXTRACT_BE_U_3(pptr + 1)>>4, ((EXTRACT_U_1(pptr + 3) & 1) == 0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" ); @@ -2620,7 +2620,7 @@ bgp_open_print(netdissect_options *ndo, as_printf(ndo, astostr, sizeof(astostr), EXTRACT_BE_U_2(bgp_open_header->bgpo_myas))); ND_PRINT("Holdtime %us, ", EXTRACT_BE_U_2(bgp_open_header->bgpo_holdtime)); - ND_PRINT("ID %s", ipaddr_string(ndo, &bgp_open_header->bgpo_id)); + ND_PRINT("ID %s", ipaddr_string(ndo, bgp_open_header->bgpo_id)); optslen = EXTRACT_U_1(bgp_open_header->bgpo_optlen); ND_PRINT("\n\t Optional parameters, length: %u", optslen); diff --git a/print-chdlc.c b/print-chdlc.c index 93cb42f7..6a420929 100644 --- a/print-chdlc.c +++ b/print-chdlc.c @@ -166,8 +166,8 @@ chdlc_slarp_print(netdissect_options *ndo, const u_char *cp, u_int length) break; case SLARP_REPLY: ND_PRINT("reply %s/%s", - ipaddr_string(ndo, &slarp->un.addr.addr), - ipaddr_string(ndo, &slarp->un.addr.mask)); + ipaddr_string(ndo, slarp->un.addr.addr), + ipaddr_string(ndo, slarp->un.addr.mask)); break; case SLARP_KEEPALIVE: ND_PRINT("keepalive: mineseen=0x%08x, yourseen=0x%08x, reliability=0x%04x", diff --git a/print-dccp.c b/print-dccp.c index b36f1072..88fbeb10 100644 --- a/print-dccp.c +++ b/print-dccp.c @@ -319,12 +319,12 @@ dccp_print(netdissect_options *ndo, const u_char *bp, const u_char *data2, if (ip6) { ND_PRINT("%s.%u > %s.%u: ", - ip6addr_string(ndo, &ip6->ip6_src), sport, - ip6addr_string(ndo, &ip6->ip6_dst), dport); + ip6addr_string(ndo, ip6->ip6_src), sport, + ip6addr_string(ndo, ip6->ip6_dst), dport); } else { ND_PRINT("%s.%u > %s.%u: ", - ipaddr_string(ndo, &ip->ip_src), sport, - ipaddr_string(ndo, &ip->ip_dst), dport); + ipaddr_string(ndo, ip->ip_src), sport, + ipaddr_string(ndo, ip->ip_dst), dport); } ND_PRINT("DCCP"); diff --git a/print-dhcp6.c b/print-dhcp6.c index aa3077f5..c3bee560 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -822,15 +822,11 @@ dhcp6_print(netdissect_options *ndo, extp = (const u_char *)(dh6 + 1); dhcp6opt_print(ndo, extp, ep); } else { /* relay messages */ - struct in6_addr addr6; - ND_TCHECK_16(dh6relay->dh6relay_peeraddr); - memcpy(&addr6, &dh6relay->dh6relay_linkaddr, sizeof (addr6)); - ND_PRINT("linkaddr=%s", ip6addr_string(ndo, &addr6)); + ND_PRINT("linkaddr=%s", ip6addr_string(ndo, dh6relay->dh6relay_linkaddr)); - memcpy(&addr6, &dh6relay->dh6relay_peeraddr, sizeof (addr6)); - ND_PRINT(" peeraddr=%s", ip6addr_string(ndo, &addr6)); + ND_PRINT(" peeraddr=%s", ip6addr_string(ndo, dh6relay->dh6relay_peeraddr)); dhcp6opt_print(ndo, (const u_char *)(dh6relay + 1), ep); } diff --git a/print-egp.c b/print-egp.c index 5e3ff2da..3a689d92 100644 --- a/print-egp.c +++ b/print-egp.c @@ -194,7 +194,7 @@ egpnrprint(netdissect_options *ndo, length--; ND_PRINT(" %s %s ", gateways < intgw ? "int" : "ext", - ipaddr_string(ndo, &addr)); + ipaddr_string(ndo, (const u_char *)&addr)); comma = ""; ND_PRINT("("); @@ -233,7 +233,7 @@ egpnrprint(netdissect_options *ndo, cp++; length -= 2; } - ND_PRINT(" %s", ipaddr_string(ndo, &addr)); + ND_PRINT(" %s", ipaddr_string(ndo, (const u_char *)&addr)); networks--; } distances--; @@ -356,7 +356,7 @@ egp_print(netdissect_options *ndo, ND_PRINT(" state:%s", egp_status_updown[status]); else ND_PRINT(" [status %u]", status); - ND_PRINT(" net:%s", ipaddr_string(ndo, &egp->egp_sourcenet)); + ND_PRINT(" net:%s", ipaddr_string(ndo, egp->egp_sourcenet)); break; case EGPT_UPDATE: @@ -370,7 +370,7 @@ egp_print(netdissect_options *ndo, else ND_PRINT(" [status %u]", status); ND_PRINT(" %s int %u ext %u", - ipaddr_string(ndo, &egp->egp_sourcenet), + ipaddr_string(ndo, egp->egp_sourcenet), EXTRACT_U_1(egp->egp_intgw), EXTRACT_U_1(egp->egp_extgw)); if (ndo->ndo_vflag) diff --git a/print-eigrp.c b/print-eigrp.c index 706a9c43..ba206b8b 100644 --- a/print-eigrp.c +++ b/print-eigrp.c @@ -362,7 +362,7 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) ND_PRINT("self"); else - ND_PRINT("%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_int->nexthop)); + ND_PRINT("%s",ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_int->nexthop)); ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->delay)/100), @@ -396,10 +396,10 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) if (EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) ND_PRINT("self"); else - ND_PRINT("%s",ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->nexthop)); + ND_PRINT("%s",ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->nexthop)); ND_PRINT("\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u", - ipaddr_string(ndo, &tlv_ptr.eigrp_tlv_ip_ext->origin_router), + ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router), EXTRACT_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->origin_as), tok2str(eigrp_ext_proto_id_values,"unknown",EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->proto_id)), EXTRACT_U_1(tlv_ptr.eigrp_tlv_ip_ext->flags), diff --git a/print-hncp.c b/print-hncp.c index 1121d2a1..e448f567 100644 --- a/print-hncp.c +++ b/print-hncp.c @@ -226,7 +226,7 @@ print_prefix(netdissect_options *ndo, const u_char *prefix, u_int max_length) ((u_char *)&addr)[plenbytes - 1] &= ((0xff00 >> (plen % 8)) & 0xff); } - nd_snprintf(buf, sizeof(buf), "%s/%u", ipaddr_string(ndo, &addr), plen); + nd_snprintf(buf, sizeof(buf), "%s/%u", ipaddr_string(ndo, (const u_char *)&addr), plen); plenbytes += 1 + IPV4_MAPPED_HEADING_LEN; } else { plenbytes = decode_prefix6(ndo, prefix, max_length, buf, sizeof(buf)); diff --git a/print-icmp6.c b/print-icmp6.c index e460092f..5b6dc05d 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -1074,19 +1074,19 @@ icmp6_print(netdissect_options *ndo, switch (icmp6_type) { case ICMP6_DST_UNREACH: - ND_TCHECK_16(&oip->ip6_dst); + ND_TCHECK_16(oip->ip6_dst); ND_PRINT(", %s", tok2str(icmp6_dst_unreach_code_values,"unknown unreach code (%u)",icmp6_code)); switch (icmp6_code) { case ICMP6_DST_UNREACH_NOROUTE: /* fall through */ case ICMP6_DST_UNREACH_ADMIN: case ICMP6_DST_UNREACH_ADDR: - ND_PRINT(" %s",ip6addr_string(ndo, &oip->ip6_dst)); + ND_PRINT(" %s",ip6addr_string(ndo, oip->ip6_dst)); break; case ICMP6_DST_UNREACH_BEYONDSCOPE: ND_PRINT(" %s, source address %s", - ip6addr_string(ndo, &oip->ip6_dst), - ip6addr_string(ndo, &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, (const u_char *)oip, &prot)) @@ -1097,17 +1097,17 @@ icmp6_print(netdissect_options *ndo, switch (prot) { case IPPROTO_TCP: ND_PRINT(", %s tcp port %s", - ip6addr_string(ndo, &oip->ip6_dst), + ip6addr_string(ndo, oip->ip6_dst), tcpport_string(ndo, dport)); break; case IPPROTO_UDP: ND_PRINT(", %s udp port %s", - ip6addr_string(ndo, &oip->ip6_dst), + ip6addr_string(ndo, oip->ip6_dst), udpport_string(ndo, dport)); break; default: ND_PRINT(", %s protocol %u port %u unreachable", - ip6addr_string(ndo, &oip->ip6_dst), + ip6addr_string(ndo, oip->ip6_dst), prot, dport); break; } @@ -1125,11 +1125,11 @@ icmp6_print(netdissect_options *ndo, ND_PRINT(", mtu %u", EXTRACT_BE_U_4(dp->icmp6_mtu)); break; case ICMP6_TIME_EXCEEDED: - ND_TCHECK_16(&oip->ip6_dst); + ND_TCHECK_16(oip->ip6_dst); switch (icmp6_code) { case ICMP6_TIME_EXCEED_TRANSIT: ND_PRINT(" for %s", - ip6addr_string(ndo, &oip->ip6_dst)); + ip6addr_string(ndo, oip->ip6_dst)); break; case ICMP6_TIME_EXCEED_REASSEMBLY: ND_PRINT(" (reassembly)"); @@ -1140,7 +1140,7 @@ icmp6_print(netdissect_options *ndo, } break; case ICMP6_PARAM_PROB: - ND_TCHECK_16(&oip->ip6_dst); + ND_TCHECK_16(oip->ip6_dst); switch (icmp6_code) { case ICMP6_PARAMPROB_HEADER: ND_PRINT(", erroneous - octet %u", EXTRACT_BE_U_4(dp->icmp6_pptr)); @@ -1284,7 +1284,7 @@ icmp6_print(netdissect_options *ndo, in6 = (const nd_ipv6 *)(dp + 1); for (; (const u_char *)in6 < cp; in6++) { ND_TCHECK_SIZE(in6); - ND_PRINT(", %s", ip6addr_string(ndo, in6)); + ND_PRINT(", %s", ip6addr_string(ndo, (const u_char *)in6)); } } break; @@ -1451,9 +1451,9 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) break; case ND_OPT_PREFIX_INFORMATION: opp = (const struct nd_opt_prefix_info *)op; - ND_TCHECK_16(&opp->nd_opt_pi_prefix); + ND_TCHECK_16(opp->nd_opt_pi_prefix); ND_PRINT("%s/%u%s, Flags [%s], valid time %s", - ip6addr_string(ndo, &opp->nd_opt_pi_prefix), + ip6addr_string(ndo, opp->nd_opt_pi_prefix), EXTRACT_U_1(opp->nd_opt_pi_prefix_len), (opt_len != 4) ? "badlen" : "", bittok2str(icmp6_opt_pi_flag_values, "none", EXTRACT_U_1(opp->nd_opt_pi_flags_reserved)), @@ -1477,9 +1477,9 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) ND_PRINT(" lifetime %us,", EXTRACT_BE_U_4(oprd->nd_opt_rdnss_lifetime)); for (i = 0; i < l; i++) { - ND_TCHECK_16(&oprd->nd_opt_rdnss_addr[i]); + ND_TCHECK_16(oprd->nd_opt_rdnss_addr[i]); ND_PRINT(" addr: %s", - ip6addr_string(ndo, &oprd->nd_opt_rdnss_addr[i])); + ip6addr_string(ndo, oprd->nd_opt_rdnss_addr[i])); } break; case ND_OPT_DNSSL: @@ -1524,7 +1524,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) default: goto trunc; } - ND_PRINT(" %s/%u", ip6addr_string(ndo, &in6), + ND_PRINT(" %s/%u", ip6addr_string(ndo, (const u_char *)&in6), EXTRACT_U_1(opri->nd_opt_rti_prefixlen)); ND_PRINT(", pref=%s", get_rtpref(EXTRACT_U_1(opri->nd_opt_rti_flags))); ND_PRINT(", lifetime=%s", @@ -1808,6 +1808,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } + cp = (const u_char *)(ni6 + 1); switch (EXTRACT_U_1(ni6->ni_code)) { case ICMP6_NI_SUBJ_IPV6: if (!ND_TTEST_LEN(dp, sizeof(*ni6) + sizeof(nd_ipv6))) @@ -1818,11 +1819,10 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } ND_PRINT(", subject=%s", - ip6addr_string(ndo, ni6 + 1)); + ip6addr_string(ndo, cp)); break; case ICMP6_NI_SUBJ_FQDN: ND_PRINT(", subject=DNS name"); - cp = (const u_char *)(ni6 + 1); if (EXTRACT_U_1(cp) == ep - cp - 1) { /* icmp-name-lookup-03, pascal string */ if (ndo->ndo_vflag) @@ -1846,7 +1846,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp, break; } ND_PRINT(", subject=%s", - ipaddr_string(ndo, ni6 + 1)); + ipaddr_string(ndo, cp)); break; default: ND_PRINT(", unknown subject"); @@ -484,15 +484,15 @@ again: if (ndo->ndo_packettype == PT_CARP) { if (ndo->ndo_vflag) ND_PRINT("carp %s > %s: ", - ipaddr_string(ndo, &ipds->ip->ip_src), - ipaddr_string(ndo, &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, EXTRACT_U_1(ipds->ip->ip_ttl)); } else { if (ndo->ndo_vflag) ND_PRINT("vrrp %s > %s: ", - ipaddr_string(ndo, &ipds->ip->ip_src), - ipaddr_string(ndo, &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, EXTRACT_U_1(ipds->ip->ip_ttl)); @@ -676,8 +676,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("%s > %s: ", - ipaddr_string(ndo, &ipds->ip->ip_src), - ipaddr_string(ndo, &ipds->ip->ip_dst)); + ipaddr_string(ndo, ipds->ip->ip_src), + ipaddr_string(ndo, ipds->ip->ip_dst)); } ip_print_demux(ndo, ipds); } else { @@ -693,8 +693,8 @@ ip_print(netdissect_options *ndo, * next level protocol header. print the ip addr * and the protocol. */ - ND_PRINT("%s > %s:", ipaddr_string(ndo, &ipds->ip->ip_src), - ipaddr_string(ndo, &ipds->ip->ip_dst)); + ND_PRINT("%s > %s:", ipaddr_string(ndo, ipds->ip->ip_src), + ipaddr_string(ndo, ipds->ip->ip_dst)); if (!ndo->ndo_nflag && (p_name = netdb_protoname(ip_proto)) != NULL) ND_PRINT(" %s", p_name); else diff --git a/print-ip6.c b/print-ip6.c index 53815402..8c0f192a 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -288,8 +288,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("%s > %s: ", ip6addr_string(ndo, &ip6->ip6_src), - ip6addr_string(ndo, &ip6->ip6_dst)); + ND_PRINT("%s > %s: ", ip6addr_string(ndo, ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_dst)); } switch (nh) { diff --git a/print-juniper.c b/print-juniper.c index 1d12d6a3..d1f9a663 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -557,8 +557,8 @@ juniper_es_if_print(netdissect_options *ndo, tok2str(juniper_ipsec_type_values,"Unknown",EXTRACT_U_1(ih->type)), EXTRACT_U_1(ih->type), EXTRACT_BE_U_4(ih->spi), - ipaddr_string(ndo, &ih->src_ip), - ipaddr_string(ndo, &ih->dst_ip), + ipaddr_string(ndo, ih->src_ip), + ipaddr_string(ndo, ih->dst_ip), l2info.length); } else { ND_PRINT("ES SA, index %u, ttl %u type %s (%u), length %u\n", diff --git a/print-ldp.c b/print-ldp.c index 4f89186a..2803aa33 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -593,7 +593,7 @@ ldp_pdu_print(netdissect_options *ndo, /* print the LSR-ID, label-space & length */ ND_PRINT("%sLDP, Label-Space-ID: %s:%u, pdu-length: %u", (ndo->ndo_vflag < 1) ? "" : "\n\t", - ipaddr_string(ndo, &ldp_com_header->lsr_id), + ipaddr_string(ndo, ldp_com_header->lsr_id), EXTRACT_BE_U_2(ldp_com_header->label_space), pdu_len); diff --git a/print-lldp.c b/print-lldp.c index e76260ec..c91b4c27 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -1336,13 +1336,13 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len) if (len < 4) return NULL; /* This cannot be assigned to ipaddr_string(), which is a macro. */ - pfunc = getname; + pfunc = ipaddr_string; break; case AFNUM_INET6: if (len < 16) return NULL; /* This cannot be assigned to ip6addr_string(), which is a macro. */ - pfunc = getname6; + pfunc = ip6addr_string; break; case AFNUM_802: if (len < 6) diff --git a/print-mobile.c b/print-mobile.c index 62ba65cc..ee916a94 100644 --- a/print-mobile.c +++ b/print-mobile.c @@ -87,12 +87,12 @@ mobile_print(netdissect_options *ndo, const u_char *bp, u_int length) if (osp) { ND_PRINT("[S] "); if (ndo->ndo_vflag) - ND_PRINT("%s ", ipaddr_string(ndo, &mob->osrc)); + ND_PRINT("%s ", ipaddr_string(ndo, mob->osrc)); } else { ND_PRINT("[] "); } if (ndo->ndo_vflag) { - ND_PRINT("> %s ", ipaddr_string(ndo, &mob->odst)); + ND_PRINT("> %s ", ipaddr_string(ndo, mob->odst)); ND_PRINT("(oproto=%u)", proto>>8); } vec[0].ptr = (const uint8_t *)(const void *)mob; diff --git a/print-msnlb.c b/print-msnlb.c index 997341e0..3d201fa3 100644 --- a/print-msnlb.c +++ b/print-msnlb.c @@ -57,8 +57,8 @@ msnlb_print(netdissect_options *ndo, const u_char *bp) ND_PRINT("MS NLB heartbeat, host priority: %u,", EXTRACT_LE_U_4((hb->host_prio))); - ND_PRINT(" cluster IP: %s,", ipaddr_string(ndo, &(hb->virtual_ip))); - ND_PRINT(" host IP: %s", ipaddr_string(ndo, &(hb->host_ip))); + ND_PRINT(" cluster IP: %s,", ipaddr_string(ndo, hb->virtual_ip)); + ND_PRINT(" host IP: %s", ipaddr_string(ndo, hb->host_ip)); return; trunc: ND_PRINT("[|MS NLB]"); diff --git a/print-nfs.c b/print-nfs.c index 85540693..d5f9137b 100644 --- a/print-nfs.c +++ b/print-nfs.c @@ -210,14 +210,14 @@ print_nfsaddr(netdissect_options *ndo, switch (IP_V((const struct ip *)bp)) { case 4: ip = (const struct ip *)bp; - strlcpy(srcaddr, ipaddr_string(ndo, &ip->ip_src), sizeof(srcaddr)); - strlcpy(dstaddr, ipaddr_string(ndo, &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; case 6: ip6 = (const struct ip6_hdr *)bp; - strlcpy(srcaddr, ip6addr_string(ndo, &ip6->ip6_src), + strlcpy(srcaddr, ip6addr_string(ndo, ip6->ip6_src), sizeof(srcaddr)); - strlcpy(dstaddr, ip6addr_string(ndo, &ip6->ip6_dst), + strlcpy(dstaddr, ip6addr_string(ndo, ip6->ip6_dst), sizeof(dstaddr)); break; default: diff --git a/print-ntp.c b/print-ntp.c index 257b65e8..7643ade1 100644 --- a/print-ntp.c +++ b/print-ntp.c @@ -305,12 +305,12 @@ ntp_time_print(netdissect_options *ndo, break; case INFO_QUERY: - ND_PRINT("%s INFO_QUERY", ipaddr_string(ndo, &(bp->refid))); + ND_PRINT("%s INFO_QUERY", ipaddr_string(ndo, bp->refid)); /* this doesn't have more content */ return; case INFO_REPLY: - ND_PRINT("%s INFO_REPLY", ipaddr_string(ndo, &(bp->refid))); + ND_PRINT("%s INFO_REPLY", ipaddr_string(ndo, bp->refid)); /* this is too complex to be worth printing */ return; diff --git a/print-ospf.c b/print-ospf.c index b177d1d7..959df23f 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -525,7 +525,7 @@ ospf_print_lshdr(netdissect_options *ndo, ND_TCHECK_4(lshp->ls_seq); /* XXX - ls_length check checked this */ ND_PRINT("\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", - ipaddr_string(ndo, &lshp->ls_router), + ipaddr_string(ndo, lshp->ls_router), EXTRACT_BE_U_4(lshp->ls_seq), EXTRACT_BE_U_2(lshp->ls_age), ls_length - (u_int)sizeof(struct lsa_hdr)); @@ -555,7 +555,7 @@ ospf_print_lshdr(netdissect_options *ndo, ND_PRINT("\n\t %s LSA (%u), LSA-ID: %s", tok2str(lsa_values,"unknown",ls_type), ls_type, - ipaddr_string(ndo, &lshp->un_lsa_id.lsa_id)); + ipaddr_string(ndo, lshp->un_lsa_id.lsa_id)); break; } @@ -652,26 +652,26 @@ ospf_print_lsa(netdissect_options *ndo, case RLA_TYPE_VIRTUAL: ND_PRINT("\n\t Virtual Link: Neighbor Router-ID: %s, Interface Address: %s", - ipaddr_string(ndo, &rlp->link_id), - ipaddr_string(ndo, &rlp->link_data)); + ipaddr_string(ndo, rlp->link_id), + ipaddr_string(ndo, rlp->link_data)); break; case RLA_TYPE_ROUTER: ND_PRINT("\n\t Neighbor Router-ID: %s, Interface Address: %s", - ipaddr_string(ndo, &rlp->link_id), - ipaddr_string(ndo, &rlp->link_data)); + ipaddr_string(ndo, rlp->link_id), + ipaddr_string(ndo, rlp->link_data)); break; case RLA_TYPE_TRANSIT: ND_PRINT("\n\t Neighbor Network-ID: %s, Interface Address: %s", - ipaddr_string(ndo, &rlp->link_id), - ipaddr_string(ndo, &rlp->link_data)); + ipaddr_string(ndo, rlp->link_id), + ipaddr_string(ndo, rlp->link_data)); break; case RLA_TYPE_STUB: ND_PRINT("\n\t Stub Network: %s, Mask: %s", - ipaddr_string(ndo, &rlp->link_id), - ipaddr_string(ndo, &rlp->link_data)); + ipaddr_string(ndo, rlp->link_id), + ipaddr_string(ndo, rlp->link_data)); break; default: @@ -695,7 +695,7 @@ ospf_print_lsa(netdissect_options *ndo, ap = &lsap->lsa_un.un_nla.nla_router[0]; while ((const u_char *)ap < ls_end) { ND_TCHECK_SIZE(ap); - ND_PRINT("\n\t %s", ipaddr_string(ndo, ap)); + ND_PRINT("\n\t %s", ipaddr_string(ndo, *ap)); ++ap; } break; @@ -741,7 +741,7 @@ ospf_print_lsa(netdissect_options *ndo, case LS_TYPE_NSSA: /* fall through - those LSAs share the same format */ ND_TCHECK_4(lsap->lsa_un.un_nla.nla_mask); ND_PRINT("\n\t Mask %s", - ipaddr_string(ndo, &lsap->lsa_un.un_asla.asla_mask)); + ipaddr_string(ndo, lsap->lsa_un.un_asla.asla_mask)); ND_TCHECK_SIZE(lsap->lsa_un.un_sla.sla_tosmetric); almp = lsap->lsa_un.un_asla.asla_metric; @@ -1018,7 +1018,7 @@ ospf_decode_v2(netdissect_options *ndo, ND_PRINT("\n\t Neighbor List:"); while ((const u_char *)ap < dataend) { ND_TCHECK_SIZE(ap); - ND_PRINT("\n\t %s", ipaddr_string(ndo, ap)); + ND_PRINT("\n\t %s", ipaddr_string(ndo, *ap)); ++ap; } break; /* HELLO */ @@ -1050,7 +1050,7 @@ ospf_decode_v2(netdissect_options *ndo, ND_TCHECK_SIZE(lsrp); ND_PRINT("\n\t Advertising Router: %s, %s LSA (%u)", - ipaddr_string(ndo, &lsrp->ls_router), + ipaddr_string(ndo, lsrp->ls_router), tok2str(lsa_values,"unknown",EXTRACT_BE_U_4(lsrp->ls_type)), EXTRACT_BE_U_4(lsrp->ls_type)); @@ -1066,7 +1066,7 @@ ospf_decode_v2(netdissect_options *ndo, break; default: ND_PRINT(", LSA-ID: %s", - ipaddr_string(ndo, &lsrp->un_ls_stateid.ls_stateid)); + ipaddr_string(ndo, lsrp->un_ls_stateid.ls_stateid)); break; } diff --git a/print-ospf6.c b/print-ospf6.c index df27e65d..e115d8e8 100644 --- a/print-ospf6.c +++ b/print-ospf6.c @@ -380,7 +380,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(ndo, ls_stateid)); + ipaddr_string(ndo, (const u_char *)ls_stateid)); } static int @@ -393,7 +393,7 @@ ospf6_print_lshdr(netdissect_options *ndo, ND_TCHECK_4(lshp->ls_seq); ND_PRINT("\n\t Advertising Router %s, seq 0x%08x, age %us, length %u", - ipaddr_string(ndo, &lshp->ls_router), + ipaddr_string(ndo, lshp->ls_router), EXTRACT_BE_U_4(lshp->ls_seq), EXTRACT_BE_U_2(lshp->ls_age), EXTRACT_BE_U_2(lshp->ls_length)-(u_int)sizeof(struct lsa6_hdr)); @@ -429,7 +429,7 @@ ospf6_print_lsaprefix(netdissect_options *ndo, ND_TCHECK_LEN(lsapp->lsa_p_prefix, wordlen * 4); memset(&prefix, 0, sizeof(prefix)); memcpy(&prefix, lsapp->lsa_p_prefix, wordlen * 4); - ND_PRINT("\n\t\t%s/%u", ip6addr_string(ndo, &prefix), + ND_PRINT("\n\t\t%s/%u", ip6addr_string(ndo, (const u_char *)&prefix), EXTRACT_U_1(lsapp->lsa_p_len)); if (EXTRACT_U_1(lsapp->lsa_p_opt)) { ND_PRINT(", Options [%s]", @@ -511,25 +511,25 @@ ospf6_print_lsa(netdissect_options *ndo, case RLA_TYPE_VIRTUAL: ND_PRINT("\n\t Virtual Link: Neighbor Router-ID %s" "\n\t Neighbor Interface-ID %s, Interface %s", - ipaddr_string(ndo, &rlp->link_nrtid), - ipaddr_string(ndo, &rlp->link_nifid), - ipaddr_string(ndo, &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("\n\t Neighbor Router-ID %s" "\n\t Neighbor Interface-ID %s, Interface %s", - ipaddr_string(ndo, &rlp->link_nrtid), - ipaddr_string(ndo, &rlp->link_nifid), - ipaddr_string(ndo, &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("\n\t Neighbor Network-ID %s" "\n\t Neighbor Interface-ID %s, Interface %s", - ipaddr_string(ndo, &rlp->link_nrtid), - ipaddr_string(ndo, &rlp->link_nifid), - ipaddr_string(ndo, &rlp->link_ifid)); + ipaddr_string(ndo, rlp->link_nrtid), + ipaddr_string(ndo, rlp->link_nifid), + ipaddr_string(ndo, rlp->link_ifid)); break; default: @@ -558,7 +558,7 @@ ospf6_print_lsa(netdissect_options *ndo, return (1); lsa_length -= sizeof (*ap); ND_TCHECK_SIZE(ap); - ND_PRINT("\n\t\t%s", ipaddr_string(ndo, ap)); + ND_PRINT("\n\t\t%s", ipaddr_string(ndo, *ap)); ++ap; } break; @@ -602,16 +602,13 @@ ospf6_print_lsa(netdissect_options *ndo, tptr += bytelen; if ((flags32 & ASLA_FLAG_FWDADDR) != 0) { - const nd_ipv6 *fwdaddr6; - - fwdaddr6 = (const nd_ipv6 *)tptr; - if (lsa_length < sizeof (*fwdaddr6)) + if (lsa_length < sizeof (nd_ipv6)) return (1); - lsa_length -= sizeof (*fwdaddr6); - ND_TCHECK_SIZE(fwdaddr6); + lsa_length -= sizeof (nd_ipv6); + ND_TCHECK_8(tptr); ND_PRINT(" forward %s", - ip6addr_string(ndo, fwdaddr6)); - tptr += sizeof(*fwdaddr6); + ip6addr_string(ndo, tptr)); + tptr += sizeof(nd_ipv6); } if ((flags32 & ASLA_FLAG_ROUTETAG) != 0) { @@ -620,7 +617,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (uint32_t); ND_TCHECK_4(tptr); ND_PRINT(" tag %s", - ipaddr_string(ndo, (const uint32_t *)tptr)); + ipaddr_string(ndo, tptr)); tptr += sizeof(uint32_t); } @@ -630,7 +627,7 @@ ospf6_print_lsa(netdissect_options *ndo, lsa_length -= sizeof (uint32_t); ND_TCHECK_4(tptr); ND_PRINT(" RefLSID: %s", - ipaddr_string(ndo, (const uint32_t *)tptr)); + ipaddr_string(ndo, tptr)); tptr += sizeof(uint32_t); } break; @@ -653,7 +650,7 @@ ospf6_print_lsa(netdissect_options *ndo, prefixes = EXTRACT_BE_U_4(llsap->llsa_nprefix); ND_PRINT("\n\t Priority %u, Link-local address %s, Prefixes %u:", EXTRACT_U_1(llsap->llsa_priority), - ip6addr_string(ndo, &llsap->llsa_lladdr), + ip6addr_string(ndo, llsap->llsa_lladdr), prefixes); tptr = (const uint8_t *)llsap->llsa_prefix; @@ -746,23 +743,23 @@ ospf6_decode_v3(netdissect_options *ndo, ND_PRINT("\n\t Hello Timer %us, Dead Timer %us, Interface-ID %s, Priority %u", EXTRACT_BE_U_2(hellop->hello_helloint), EXTRACT_BE_U_2(hellop->hello_deadint), - ipaddr_string(ndo, &hellop->hello_ifid), + ipaddr_string(ndo, hellop->hello_ifid), EXTRACT_U_1(hellop->hello_priority)); ND_TCHECK_4(hellop->hello_dr); if (EXTRACT_BE_U_4(hellop->hello_dr) != 0) ND_PRINT("\n\t Designated Router %s", - ipaddr_string(ndo, &hellop->hello_dr)); + ipaddr_string(ndo, hellop->hello_dr)); ND_TCHECK_4(hellop->hello_bdr); if (EXTRACT_BE_U_4(hellop->hello_bdr) != 0) ND_PRINT(", Backup Designated Router %s", - ipaddr_string(ndo, &hellop->hello_bdr)); + ipaddr_string(ndo, hellop->hello_bdr)); if (ndo->ndo_vflag > 1) { ND_PRINT("\n\t Neighbor List:"); ap = hellop->hello_neighbor; while ((const u_char *)ap < dataend) { ND_TCHECK_SIZE(ap); - ND_PRINT("\n\t %s", ipaddr_string(ndo, ap)); + ND_PRINT("\n\t %s", ipaddr_string(ndo, *ap)); ++ap; } } @@ -801,7 +798,7 @@ ospf6_decode_v3(netdissect_options *ndo, while ((const u_char *)lsrp < dataend) { ND_TCHECK_SIZE(lsrp); ND_PRINT("\n\t Advertising Router %s", - ipaddr_string(ndo, &lsrp->ls_router)); + ipaddr_string(ndo, lsrp->ls_router)); ospf6_print_ls_type(ndo, EXTRACT_BE_U_2(lsrp->ls_type), &lsrp->ls_stateid); @@ -990,11 +987,11 @@ ospf6_print(netdissect_options *ndo, dataend = bp + datalen; ND_TCHECK_4(op->ospf6_routerid); - ND_PRINT("\n\tRouter-ID %s", ipaddr_string(ndo, &op->ospf6_routerid)); + ND_PRINT("\n\tRouter-ID %s", ipaddr_string(ndo, op->ospf6_routerid)); ND_TCHECK_4(op->ospf6_areaid); if (EXTRACT_BE_U_4(op->ospf6_areaid) != 0) - ND_PRINT(", Area %s", ipaddr_string(ndo, &op->ospf6_areaid)); + ND_PRINT(", Area %s", ipaddr_string(ndo, op->ospf6_areaid)); else ND_PRINT(", Backbone Area"); ND_TCHECK_1(op->ospf6_instanceid); diff --git a/print-pgm.c b/print-pgm.c index 171acce9..e7bad48a 100644 --- a/print-pgm.c +++ b/print-pgm.c @@ -168,12 +168,12 @@ pgm_print(netdissect_options *ndo, if (!ND_TTEST_2(pgm->pgm_dport)) { if (ip6) { ND_PRINT("%s > %s: [|pgm]", - ip6addr_string(ndo, &ip6->ip6_src), - ip6addr_string(ndo, &ip6->ip6_dst)); + ip6addr_string(ndo, ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_dst)); } else { ND_PRINT("%s > %s: [|pgm]", - ipaddr_string(ndo, &ip->ip_src), - ipaddr_string(ndo, &ip->ip_dst)); + ipaddr_string(ndo, ip->ip_src), + ipaddr_string(ndo, ip->ip_dst)); } return; } @@ -184,9 +184,9 @@ pgm_print(netdissect_options *ndo, if (ip6) { if (EXTRACT_U_1(ip6->ip6_nxt) == IPPROTO_PGM) { ND_PRINT("%s.%s > %s.%s: ", - ip6addr_string(ndo, &ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_src), tcpport_string(ndo, sport), - ip6addr_string(ndo, &ip6->ip6_dst), + ip6addr_string(ndo, ip6->ip6_dst), tcpport_string(ndo, dport)); } else { ND_PRINT("%s > %s: ", @@ -195,9 +195,9 @@ pgm_print(netdissect_options *ndo, } else { if (EXTRACT_U_1(ip->ip_p) == IPPROTO_PGM) { ND_PRINT("%s.%s > %s.%s: ", - ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, ip->ip_src), tcpport_string(ndo, sport), - ipaddr_string(ndo, &ip->ip_dst), + ipaddr_string(ndo, ip->ip_dst), tcpport_string(ndo, dport)); } else { ND_PRINT("%s > %s: ", diff --git a/print-pim.c b/print-pim.c index d30cf8f4..49c9f465 100644 --- a/print-pim.c +++ b/print-pim.c @@ -898,8 +898,8 @@ pimv2_print(netdissect_options *ndo, case 0: /* Null header */ ND_TCHECK_4(ip->ip_dst); ND_PRINT("IP-Null-header %s > %s", - ipaddr_string(ndo, &ip->ip_src), - ipaddr_string(ndo, &ip->ip_dst)); + ipaddr_string(ndo, ip->ip_src), + ipaddr_string(ndo, ip->ip_dst)); break; case 4: /* IPv4 */ diff --git a/print-rip.c b/print-rip.c index 50557c4d..ad913aca 100644 --- a/print-rip.c +++ b/print-rip.c @@ -205,12 +205,12 @@ rip_entry_print_v1(netdissect_options *ndo, const u_char *p, } if (family == 0) { ND_PRINT("\n\t AFI 0, %s, metric: %u", - ipaddr_string(ndo, &ni->rip_dest), + ipaddr_string(ndo, ni->rip_dest), EXTRACT_BE_U_4(ni->rip_metric)); return (RIP_ROUTELEN); } /* BSD_AFNUM_INET */ ND_PRINT("\n\t %s, metric: %u", - ipaddr_string(ndo, &ni->rip_dest), + ipaddr_string(ndo, ni->rip_dest), EXTRACT_BE_U_4(ni->rip_metric)); return (RIP_ROUTELEN); } @@ -267,12 +267,12 @@ rip_entry_print_v2(netdissect_options *ndo, const u_char *p, return (0); ND_PRINT("\n\t AFI %s, %15s/%-2d, tag 0x%04x, metric: %u, next-hop: ", tok2str(bsd_af_values, "%u", family), - ipaddr_string(ndo, &ni->rip_dest), + ipaddr_string(ndo, ni->rip_dest), mask2plen(EXTRACT_BE_U_4(ni->rip_dest_mask)), EXTRACT_BE_U_2(ni->rip_tag), EXTRACT_BE_U_4(ni->rip_metric)); if (EXTRACT_BE_U_4(ni->rip_router)) - ND_PRINT("%s", ipaddr_string(ndo, &ni->rip_router)); + ND_PRINT("%s", ipaddr_string(ndo, ni->rip_router)); else ND_PRINT("self"); } diff --git a/print-ripng.c b/print-ripng.c index 12c88159..3ff43dc7 100644 --- a/print-ripng.c +++ b/print-ripng.c @@ -97,7 +97,7 @@ rip6_entry_print(netdissect_options *ndo, const struct netinfo6 *ni, u_int metri int l; uint16_t tag; - l = ND_PRINT("%s/%u", ip6addr_string(ndo, &ni->rip6_dest), EXTRACT_U_1(ni->rip6_plen)); + l = ND_PRINT("%s/%u", ip6addr_string(ndo, ni->rip6_dest), EXTRACT_U_1(ni->rip6_plen)); tag = EXTRACT_BE_U_2(ni->rip6_tag); if (tag) l += ND_PRINT(" [%u]", tag); diff --git a/print-sctp.c b/print-sctp.c index bee474d8..f8d51c96 100644 --- a/print-sctp.c +++ b/print-sctp.c @@ -485,16 +485,16 @@ sctp_print(netdissect_options *ndo, if (ip6) { ND_PRINT("%s.%u > %s.%u: sctp", - ip6addr_string(ndo, &ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_src), sourcePort, - ip6addr_string(ndo, &ip6->ip6_dst), + ip6addr_string(ndo, ip6->ip6_dst), destPort); } else { ND_PRINT("%s.%u > %s.%u: sctp", - ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, ip->ip_src), sourcePort, - ipaddr_string(ndo, &ip->ip_dst), + ipaddr_string(ndo, ip->ip_dst), destPort); } diff --git a/print-sunrpc.c b/print-sunrpc.c index 74e9db38..9c62728f 100644 --- a/print-sunrpc.c +++ b/print-sunrpc.c @@ -183,14 +183,14 @@ sunrpc_print(netdissect_options *ndo, const u_char *bp, case 4: ip = (const struct ip *)bp2; ND_PRINT("%s.%s > %s.%s: %u", - ipaddr_string(ndo, &ip->ip_src), srcid, - ipaddr_string(ndo, &ip->ip_dst), dstid, length); + ipaddr_string(ndo, ip->ip_src), srcid, + ipaddr_string(ndo, ip->ip_dst), dstid, length); break; case 6: ip6 = (const struct ip6_hdr *)bp2; ND_PRINT("%s.%s > %s.%s: %u", - ip6addr_string(ndo, &ip6->ip6_src), srcid, - ip6addr_string(ndo, &ip6->ip6_dst), dstid, length); + ip6addr_string(ndo, ip6->ip6_src), srcid, + ip6addr_string(ndo, ip6->ip6_dst), dstid, length); break; default: ND_PRINT("%s.%s > %s.%s: %u", "?", srcid, "?", dstid, length); diff --git a/print-tcp.c b/print-tcp.c index 5d350f87..66579aab 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -181,9 +181,15 @@ tcp_print(netdissect_options *ndo, ip6 = NULL; ch = '\0'; if (!ND_TTEST_2(tp->th_dport)) { - ND_PRINT("%s > %s: [|tcp]", - ipaddr_string(ndo, &ip->ip_src), - ipaddr_string(ndo, &ip->ip_dst)); + if (ip6) { + ND_PRINT("%s > %s: ", + ip6addr_string(ndo, ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_dst)); + } else { + ND_PRINT("%s > %s: [|tcp]", + ipaddr_string(ndo, ip->ip_src), + ipaddr_string(ndo, ip->ip_dst)); + } return; } @@ -193,9 +199,9 @@ tcp_print(netdissect_options *ndo, if (ip6) { if (EXTRACT_U_1(ip6->ip6_nxt) == IPPROTO_TCP) { ND_PRINT("%s.%s > %s.%s: ", - ip6addr_string(ndo, &ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_src), tcpport_string(ndo, sport), - ip6addr_string(ndo, &ip6->ip6_dst), + ip6addr_string(ndo, ip6->ip6_dst), tcpport_string(ndo, dport)); } else { ND_PRINT("%s > %s: ", @@ -204,9 +210,9 @@ tcp_print(netdissect_options *ndo, } else { if (EXTRACT_U_1(ip->ip_p) == IPPROTO_TCP) { ND_PRINT("%s.%s > %s.%s: ", - ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, ip->ip_src), tcpport_string(ndo, sport), - ipaddr_string(ndo, &ip->ip_dst), + ipaddr_string(ndo, ip->ip_dst), tcpport_string(ndo, dport)); } else { ND_PRINT("%s > %s: ", diff --git a/print-udp.c b/print-udp.c index a9f5cf99..2bb5eac5 100644 --- a/print-udp.c +++ b/print-udp.c @@ -340,13 +340,13 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo if (EXTRACT_U_1(ip6->ip6_nxt) == IPPROTO_UDP) { if (sport == -1) { ND_PRINT("%s > %s: ", - ip6addr_string(ndo, &ip6->ip6_src), - ip6addr_string(ndo, &ip6->ip6_dst)); + ip6addr_string(ndo, ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_dst)); } else { ND_PRINT("%s.%s > %s.%s: ", - ip6addr_string(ndo, &ip6->ip6_src), + ip6addr_string(ndo, ip6->ip6_src), udpport_string(ndo, sport), - ip6addr_string(ndo, &ip6->ip6_dst), + ip6addr_string(ndo, ip6->ip6_dst), udpport_string(ndo, dport)); } } else { @@ -360,13 +360,13 @@ udpipaddr_print(netdissect_options *ndo, const struct ip *ip, int sport, int dpo if (EXTRACT_U_1(ip->ip_p) == IPPROTO_UDP) { if (sport == -1) { ND_PRINT("%s > %s: ", - ipaddr_string(ndo, &ip->ip_src), - ipaddr_string(ndo, &ip->ip_dst)); + ipaddr_string(ndo, ip->ip_src), + ipaddr_string(ndo, ip->ip_dst)); } else { ND_PRINT("%s.%s > %s.%s: ", - ipaddr_string(ndo, &ip->ip_src), + ipaddr_string(ndo, ip->ip_src), udpport_string(ndo, sport), - ipaddr_string(ndo, &ip->ip_dst), + ipaddr_string(ndo, ip->ip_dst), udpport_string(ndo, dport)); } } else { @@ -193,10 +193,10 @@ wb_id(netdissect_options *ndo, ND_PRINT(" %u/%s:%u (max %u/%s:%u) ", EXTRACT_BE_U_4(id->pi_ps.slot), - ipaddr_string(ndo, &id->pi_ps.page.p_sid), + ipaddr_string(ndo, id->pi_ps.page.p_sid), EXTRACT_BE_U_4(id->pi_ps.page.p_uid), EXTRACT_BE_U_4(id->pi_mslot), - ipaddr_string(ndo, &id->pi_mpage.p_sid), + ipaddr_string(ndo, id->pi_mpage.p_sid), EXTRACT_BE_U_4(id->pi_mpage.p_uid)); nid = EXTRACT_BE_U_2(id->pi_ps.nid); @@ -212,7 +212,7 @@ wb_id(netdissect_options *ndo, c = '<'; for (i = 0; i < nid && ND_TTEST_SIZE(io); ++io, ++i) { ND_PRINT("%c%s:%u", - c, ipaddr_string(ndo, &io->id), EXTRACT_BE_U_4(io->off)); + c, ipaddr_string(ndo, io->id), EXTRACT_BE_U_4(io->off)); c = ','; } if (i >= nid) { @@ -231,8 +231,8 @@ wb_rreq(netdissect_options *ndo, return (-1); ND_PRINT(" please repair %s %s:%u<%u:%u>", - ipaddr_string(ndo, &rreq->pr_id), - ipaddr_string(ndo, &rreq->pr_page.p_sid), + ipaddr_string(ndo, rreq->pr_id), + ipaddr_string(ndo, rreq->pr_page.p_sid), EXTRACT_BE_U_4(rreq->pr_page.p_uid), EXTRACT_BE_U_4(rreq->pr_sseq), EXTRACT_BE_U_4(rreq->pr_eseq)); @@ -249,7 +249,7 @@ wb_preq(netdissect_options *ndo, ND_PRINT(" need %u/%s:%u", EXTRACT_BE_U_4(preq->pp_low), - ipaddr_string(ndo, &preq->pp_page.p_sid), + ipaddr_string(ndo, preq->pp_page.p_sid), EXTRACT_BE_U_4(preq->pp_page.p_uid)); return (0); } @@ -273,11 +273,11 @@ wb_prep(netdissect_options *ndo, ND_PRINT(" %u/%s:%u", EXTRACT_BE_U_4(ps->slot), - ipaddr_string(ndo, &ps->page.p_sid), + ipaddr_string(ndo, ps->page.p_sid), EXTRACT_BE_U_4(ps->page.p_uid)); io = (const struct id_off *)(ps + 1); for (ie = io + EXTRACT_U_1(ps->nid); io < ie && ND_TTEST_SIZE(io); ++io) { - ND_PRINT("%c%s:%u", c, ipaddr_string(ndo, &io->id), + ND_PRINT("%c%s:%u", c, ipaddr_string(ndo, io->id), EXTRACT_BE_U_4(io->off)); c = ','; } @@ -357,8 +357,8 @@ wb_rrep(netdissect_options *ndo, len -= sizeof(*rrep); ND_PRINT(" for %s %s:%u<%u:%u>", - ipaddr_string(ndo, &rrep->pr_id), - ipaddr_string(ndo, &dop->pd_page.p_sid), + ipaddr_string(ndo, rrep->pr_id), + ipaddr_string(ndo, dop->pd_page.p_sid), EXTRACT_BE_U_4(dop->pd_page.p_uid), EXTRACT_BE_U_4(dop->pd_sseq), EXTRACT_BE_U_4(dop->pd_eseq)); @@ -380,7 +380,7 @@ wb_drawop(netdissect_options *ndo, len -= sizeof(*dop); ND_PRINT(" %s:%u<%u:%u>", - ipaddr_string(ndo, &dop->pd_page.p_sid), + ipaddr_string(ndo, dop->pd_page.p_sid), EXTRACT_BE_U_4(dop->pd_page.p_uid), EXTRACT_BE_U_4(dop->pd_sseq), EXTRACT_BE_U_4(dop->pd_eseq)); |