summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ovsienko <denis@ovsienko.info>2016-07-11 10:26:01 +0100
committerDenis Ovsienko <denis@ovsienko.info>2016-07-11 11:56:29 +0100
commitd2aa4eec28a011b739a68cc1258a97d880215574 (patch)
tree66b5ae1f218f7a5fd80742f49280488b9734355f
parent5083bfccc0624861f921bb3a33f208e23f5bc2c2 (diff)
downloadtcpdump-d2aa4eec28a011b739a68cc1258a97d880215574.tar.gz
call ip6addr_string() instead of getname6()
This replaces a few explicit type casts with one type cast in the macro and makes the source code mean one thing with one term instead of two.
-rw-r--r--print-bgp.c12
-rw-r--r--print-icmp6.c8
-rw-r--r--print-lisp.c4
-rw-r--r--print-lldp.c1
4 files changed, 13 insertions, 12 deletions
diff --git a/print-bgp.c b/print-bgp.c
index fd25ba84..bcc3f715 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -1092,7 +1092,7 @@ decode_prefix6(netdissect_options *ndo,
addr.s6_addr[plenbytes - 1] &=
((0xff00 >> (plen % 8)) & 0xff);
}
- snprintf(buf, buflen, "%s/%d", getname6(ndo, (u_char *)&addr), plen);
+ snprintf(buf, buflen, "%s/%d", ip6addr_string(ndo, &addr), plen);
return 1 + plenbytes;
trunc:
@@ -1133,7 +1133,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(ndo, (u_char *)&addr),
+ ip6addr_string(ndo, &addr),
plen,
EXTRACT_24BITS(pptr+1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
@@ -1175,7 +1175,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(ndo, (u_char *)&addr),
+ ip6addr_string(ndo, &addr),
plen,
EXTRACT_24BITS(pptr+1)>>4,
((pptr[3]&1)==0) ? "(BOGUS: Bottom of Stack NOT set!)" : "(bottom)" );
@@ -1599,7 +1599,7 @@ bgp_attr_print(netdissect_options *ndo,
tlen = 0;
} else {
ND_TCHECK2(tptr[0], sizeof(struct in6_addr));
- ND_PRINT((ndo, "%s", getname6(ndo, tptr)));
+ ND_PRINT((ndo, "%s", ip6addr_string(ndo, tptr)));
tlen -= sizeof(struct in6_addr);
tptr += sizeof(struct in6_addr);
}
@@ -1614,7 +1614,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(ndo, tptr+BGP_VPN_RD_LEN)));
+ ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN)));
tlen -= (sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
tptr += (sizeof(struct in6_addr)+BGP_VPN_RD_LEN);
}
@@ -1658,7 +1658,7 @@ bgp_attr_print(netdissect_options *ndo,
ND_PRINT((ndo, " = %s", getname(ndo, tptr+BGP_VPN_RD_LEN+4)));
/* rfc1888 mapped IPv6 address ? */
else if (EXTRACT_24BITS(tptr+BGP_VPN_RD_LEN) == 0x350000)
- ND_PRINT((ndo, " = %s", getname6(ndo, tptr+BGP_VPN_RD_LEN+3)));
+ ND_PRINT((ndo, " = %s", ip6addr_string(ndo, tptr+BGP_VPN_RD_LEN+3)));
tptr += tlen;
tlen = 0;
}
diff --git a/print-icmp6.c b/print-icmp6.c
index bc8362ee..2db36a6d 100644
--- a/print-icmp6.c
+++ b/print-icmp6.c
@@ -1088,10 +1088,10 @@ icmp6_print(netdissect_options *ndo,
case ND_REDIRECT:
#define RDR(i) ((const struct nd_redirect *)(i))
ND_TCHECK(RDR(dp)->nd_rd_dst);
- ND_PRINT((ndo,", %s", getname6(ndo, (const u_char *)&RDR(dp)->nd_rd_dst)));
+ ND_PRINT((ndo,", %s", ip6addr_string(ndo, &RDR(dp)->nd_rd_dst)));
ND_TCHECK(RDR(dp)->nd_rd_target);
ND_PRINT((ndo," to %s",
- getname6(ndo, (const u_char*)&RDR(dp)->nd_rd_target)));
+ ip6addr_string(ndo, &RDR(dp)->nd_rd_target)));
#define REDIRECTLEN 40
if (ndo->ndo_vflag) {
icmp6_opt_print(ndo, (const u_char *)dp + REDIRECTLEN,
@@ -1657,7 +1657,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
break;
}
ND_PRINT((ndo,", subject=%s",
- getname6(ndo, (const u_char *)(ni6 + 1))));
+ ip6addr_string(ndo, ni6 + 1)));
break;
case ICMP6_NI_SUBJ_FQDN:
ND_PRINT((ndo,", subject=DNS name"));
@@ -1782,7 +1782,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(ndo, bp + i)));
+ ND_PRINT((ndo," %s", ip6addr_string(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-lisp.c b/print-lisp.c
index 757326dc..27cca1a7 100644
--- a/print-lisp.c
+++ b/print-lisp.c
@@ -311,7 +311,7 @@ void lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
break;
case IPv6_AFI:
ND_TCHECK2(*(packet_iterator + packet_offset), 16);
- ND_PRINT((ndo, " EID %s/%u,", getname6(ndo,
+ ND_PRINT((ndo, " EID %s/%u,", ip6addr_string(ndo,
packet_iterator + packet_offset), mask_len));
packet_offset += 16;
break;
@@ -343,7 +343,7 @@ void lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
break;
case IPv6_AFI:
ND_TCHECK2(*(packet_iterator + packet_offset), 16);
- ND_PRINT((ndo, " LOC %s", getname6(ndo, loc_ip_pointer)));
+ ND_PRINT((ndo, " LOC %s", ip6addr_string(ndo, loc_ip_pointer)));
packet_offset += 16;
break;
default:
diff --git a/print-lldp.c b/print-lldp.c
index 82b7ebec..458cf957 100644
--- a/print-lldp.c
+++ b/print-lldp.c
@@ -1283,6 +1283,7 @@ lldp_network_addr_print(netdissect_options *ndo, const u_char *tptr, u_int len)
case AFNUM_INET6:
if (len < 16)
return NULL;
+ /* This cannot be assigned to ip6addr_string(), which is a macro. */
pfunc = getname6;
break;
case AFNUM_802: