summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2017-11-25 17:14:34 +0100
committerFrancois-Xavier Le Bail <devel.fx.lebail@orange.fr>2017-11-25 18:21:18 +0100
commit575188b5bf4fc1c26a2766319fcb7ca57d393868 (patch)
tree887096c16d0cbeddfe8f0339621d16fcfbca6294
parent39c8c55aa9ff84244cf558b9a957b78933babf0a (diff)
downloadtcpdump-575188b5bf4fc1c26a2766319fcb7ca57d393868.tar.gz
Use pointer expressions like in most similar cases
-rw-r--r--print-dhcp6.c12
-rw-r--r--print-hncp.c2
-rw-r--r--print-icmp6.c8
-rw-r--r--print-igmp.c16
-rw-r--r--print-ip.c4
-rw-r--r--print-ip6opts.c2
-rw-r--r--print-mobility.c4
-rw-r--r--print-pim.c32
8 files changed, 40 insertions, 40 deletions
diff --git a/print-dhcp6.c b/print-dhcp6.c
index e2caa58a..2894ea8d 100644
--- a/print-dhcp6.c
+++ b/print-dhcp6.c
@@ -370,7 +370,7 @@ dhcp6opt_print(netdissect_options *ndo,
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0])));
+ ND_PRINT((ndo, " %s", ip6addr_string(ndo, tp)));
ND_PRINT((ndo, " pltime:%u vltime:%u",
EXTRACT_BE_U_4(tp + 16),
EXTRACT_BE_U_4(tp + 20)));
@@ -560,7 +560,7 @@ dhcp6opt_print(netdissect_options *ndo,
}
tp = (const u_char *)(dh6o + 1);
for (i = 0; i < optlen; i += 16)
- ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[i])));
+ ND_PRINT((ndo, " %s", ip6addr_string(ndo, tp + i)));
ND_PRINT((ndo, ")"));
break;
case DH6OPT_SIP_SERVER_D:
@@ -617,7 +617,7 @@ dhcp6opt_print(netdissect_options *ndo,
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, &tp[9]), tp[8]));
+ ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, tp + 9), tp[8]));
ND_PRINT((ndo, " pltime:%u vltime:%u",
EXTRACT_BE_U_4(tp),
EXTRACT_BE_U_4(tp + 4)));
@@ -668,7 +668,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " type_%u", dh6_lq_query_type));
break;
}
- ND_PRINT((ndo, " %s", ip6addr_string(ndo, &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);
@@ -689,7 +689,7 @@ dhcp6opt_print(netdissect_options *ndo,
break;
}
tp = (const u_char *)(dh6o + 1);
- ND_PRINT((ndo, " %s ", ip6addr_string(ndo, &tp[0])));
+ ND_PRINT((ndo, " %s ", ip6addr_string(ndo, tp)));
/*
* Print hex dump first 10 characters.
*/
@@ -718,7 +718,7 @@ dhcp6opt_print(netdissect_options *ndo,
ND_PRINT((ndo, " ?"));
break;
}
- ND_PRINT((ndo, " %s", ip6addr_string(ndo, &tp[0])));
+ ND_PRINT((ndo, " %s", ip6addr_string(ndo, tp)));
break;
case DH6OPT_NTP_SUBOPTION_SRV_FQDN:
ND_PRINT((ndo, " "));
diff --git a/print-hncp.c b/print-hncp.c
index 560f5b7d..1b5ed5d4 100644
--- a/print-hncp.c
+++ b/print-hncp.c
@@ -207,7 +207,7 @@ print_prefix(netdissect_options *ndo, const u_char *prefix, u_int max_length)
char buf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx::/128")];
if (prefix[0] >= 96 && max_length >= IPV4_MAPPED_HEADING_LEN + 1 &&
- is_ipv4_mapped_address(&prefix[1])) {
+ is_ipv4_mapped_address(prefix + 1)) {
struct in_addr addr;
u_int plen;
diff --git a/print-icmp6.c b/print-icmp6.c
index bf17993c..f7e26ec4 100644
--- a/print-icmp6.c
+++ b/print-icmp6.c
@@ -1430,7 +1430,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(ndo, &bp[group + 4])));
+ ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + group + 4)));
ND_PRINT((ndo," %s", tok2str(mldv2report2str, " [v2-report-#%d]",
EXTRACT_U_1(bp + group))));
nsrcs = (bp[group + 2] << 8) + bp[group + 3];
@@ -1447,7 +1447,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(ndo, &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," }"));
}
@@ -1487,7 +1487,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(ndo, &bp[8])));
+ ND_PRINT((ndo," [gaddr %s", ip6addr_string(ndo, bp + 8)));
if (ndo->ndo_vflag) {
ND_TCHECK(bp[25]);
@@ -1515,7 +1515,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(ndo, &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
diff --git a/print-igmp.c b/print-igmp.c
index 1c672775..4fb89068 100644
--- a/print-igmp.c
+++ b/print-igmp.c
@@ -176,7 +176,7 @@ print_igmpv3_report(netdissect_options *ndo,
return;
}
ND_TCHECK_4(bp + (group + 4));
- ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[group+4])));
+ ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, bp + group + 4)));
ND_PRINT((ndo, " %s", tok2str(igmpv3report2str, " [v3-report-#%d]",
EXTRACT_U_1(bp + group))));
nsrcs = EXTRACT_BE_U_2(bp + group + 2);
@@ -192,7 +192,7 @@ print_igmpv3_report(netdissect_options *ndo,
ND_PRINT((ndo, " {"));
for (j=0; j<nsrcs; j++) {
ND_TCHECK_4(bp + (group + 8 + (j << 2)));
- ND_PRINT((ndo, " %s", ipaddr_string(ndo, &bp[group+8+(j<<2)])));
+ ND_PRINT((ndo, " %s", ipaddr_string(ndo, bp + group + 8 + (j << 2))));
}
ND_PRINT((ndo, " }"));
}
@@ -240,7 +240,7 @@ print_igmpv3_query(netdissect_options *ndo,
ND_TCHECK_4(bp + 4);
if (EXTRACT_BE_U_4(bp + 4) == 0)
return;
- ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, &bp[4])));
+ ND_PRINT((ndo, " [gaddr %s", ipaddr_string(ndo, bp + 4)));
ND_TCHECK_2(bp + 10);
nsrcs = EXTRACT_BE_U_2(bp + 10);
if (nsrcs > 0) {
@@ -250,7 +250,7 @@ print_igmpv3_query(netdissect_options *ndo,
ND_PRINT((ndo, " {"));
for (i=0; i<nsrcs; i++) {
ND_TCHECK_4(bp + (12 + (i << 2)));
- ND_PRINT((ndo, " %s", ipaddr_string(ndo, &bp[12+(i<<2)])));
+ ND_PRINT((ndo, " %s", ipaddr_string(ndo, bp + 12 + (i << 2))));
}
ND_PRINT((ndo, " }"));
} else
@@ -289,20 +289,20 @@ igmp_print(netdissect_options *ndo,
ND_PRINT((ndo, " v1"));
ND_TCHECK_4(bp + 4);
if (EXTRACT_BE_U_4(bp + 4))
- ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, &bp[4])));
+ ND_PRINT((ndo, " [gaddr %s]", ipaddr_string(ndo, bp + 4)));
if (len != 8)
ND_PRINT((ndo, " [len %d]", len));
}
break;
case 0x12:
ND_TCHECK_4(bp + 4);
- ND_PRINT((ndo, "igmp v1 report %s", ipaddr_string(ndo, &bp[4])));
+ ND_PRINT((ndo, "igmp v1 report %s", ipaddr_string(ndo, bp + 4)));
if (len != 8)
ND_PRINT((ndo, " [len %d]", len));
break;
case 0x16:
ND_TCHECK_4(bp + 4);
- ND_PRINT((ndo, "igmp v2 report %s", ipaddr_string(ndo, &bp[4])));
+ ND_PRINT((ndo, "igmp v2 report %s", ipaddr_string(ndo, bp + 4)));
break;
case 0x22:
ND_PRINT((ndo, "igmp v3 report"));
@@ -310,7 +310,7 @@ igmp_print(netdissect_options *ndo,
break;
case 0x17:
ND_TCHECK_4(bp + 4);
- ND_PRINT((ndo, "igmp leave %s", ipaddr_string(ndo, &bp[4])));
+ ND_PRINT((ndo, "igmp leave %s", ipaddr_string(ndo, bp + 4)));
break;
case 0x13:
ND_PRINT((ndo, "igmp dvmrp"));
diff --git a/print-ip.c b/print-ip.c
index de278aad..33ef44c2 100644
--- a/print-ip.c
+++ b/print-ip.c
@@ -74,7 +74,7 @@ ip_printroute(netdissect_options *ndo,
for (len = 3; len < length; len += 4) {
ND_TCHECK_4(cp + len);
- ND_PRINT((ndo, " %s", ipaddr_string(ndo, &cp[len])));
+ ND_PRINT((ndo, " %s", ipaddr_string(ndo, cp + len)));
if (ptr > len)
ND_PRINT((ndo, ","));
}
@@ -221,7 +221,7 @@ ip_printts(netdissect_options *ndo,
type = " ^ ";
ND_TCHECK2(cp[len], hoplen);
ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_BE_U_4(cp + len + hoplen - 4),
- hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len])));
+ hoplen!=8 ? "" : ipaddr_string(ndo, cp + len)));
type = " ";
}
diff --git a/print-ip6opts.c b/print-ip6opts.c
index d3cac60c..21d8b510 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(ndo, &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-mobility.c b/print-mobility.c
index 8b93df17..3c0bd268 100644
--- a/print-mobility.c
+++ b/print-mobility.c
@@ -160,7 +160,7 @@ mobility_opt_print(netdissect_options *ndo,
goto trunc;
}
ND_TCHECK_16(bp + i + 2);
- ND_PRINT((ndo, "(alt-CoA: %s)", ip6addr_string(ndo, &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) {
@@ -324,7 +324,7 @@ mobility_print(netdissect_options *ndo,
/* Reserved */
hlen = IP6M_MINLEN;
ND_TCHECK_16(bp + hlen);
- ND_PRINT((ndo, " homeaddr %s", ip6addr_string(ndo, &bp[hlen])));
+ ND_PRINT((ndo, " homeaddr %s", ip6addr_string(ndo, bp + hlen)));
hlen += 16;
break;
default:
diff --git a/print-pim.c b/print-pim.c
index 5c5cdf40..4e1708f2 100644
--- a/print-pim.c
+++ b/print-pim.c
@@ -158,10 +158,10 @@ pimv1_join_prune_print(netdissect_options *ndo,
unsigned_relts_print(ndo, hold);
}
ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune",
- ipaddr_string(ndo, &bp[26]), bp[25] & 0x3f,
- ipaddr_string(ndo, &bp[12])));
+ ipaddr_string(ndo, bp + 26), bp[25] & 0x3f,
+ ipaddr_string(ndo, bp + 12)));
if (EXTRACT_BE_U_4(bp + 16) != 0xffffffff)
- ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &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" : "",
@@ -210,7 +210,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
goto trunc;
ND_TCHECK2(bp[0], sizeof(struct in_addr));
if (EXTRACT_BE_U_4(bp) != 0xffffffff)
- ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[0])));
+ ND_PRINT((ndo, "/%s", ipaddr_string(ndo, bp)));
bp += 4;
len -= 4;
if (len < 4)
@@ -235,7 +235,7 @@ pimv1_join_prune_print(netdissect_options *ndo,
(bp[0] & 0x01) ? "Sparse " : "Dense ",
(bp[1] & 0x80) ? "WC " : "",
(bp[1] & 0x40) ? "RP " : "SPT ",
- ipaddr_string(ndo, &bp[2]),
+ ipaddr_string(ndo, bp + 2),
bp[1] & 0x3f));
bp += 6;
len -= 6;
@@ -285,30 +285,30 @@ pimv1_print(netdissect_options *ndo,
case PIMV1_TYPE_REGISTER:
ND_TCHECK2(bp[8], 20); /* ip header */
- ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[20]),
- ipaddr_string(ndo, &bp[24])));
+ ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, bp + 20),
+ ipaddr_string(ndo, bp + 24)));
break;
case PIMV1_TYPE_REGISTER_STOP:
ND_TCHECK2(bp[12], sizeof(struct in_addr));
- ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[8]),
- ipaddr_string(ndo, &bp[12])));
+ ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, bp + 8),
+ ipaddr_string(ndo, bp + 12)));
break;
case PIMV1_TYPE_RP_REACHABILITY:
if (ndo->ndo_vflag) {
ND_TCHECK_2(bp + 22);
- ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8])));
+ ND_PRINT((ndo, " group %s", ipaddr_string(ndo, bp + 8)));
if (EXTRACT_BE_U_4(bp + 12) != 0xffffffff)
- ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
- ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16])));
+ ND_PRINT((ndo, "/%s", ipaddr_string(ndo, bp + 12)));
+ ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, bp + 16)));
unsigned_relts_print(ndo, EXTRACT_BE_U_2(bp + 22));
}
break;
case PIMV1_TYPE_ASSERT:
ND_TCHECK2(bp[16], sizeof(struct in_addr));
- ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]),
- ipaddr_string(ndo, &bp[8])));
+ ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, bp + 16),
+ ipaddr_string(ndo, bp + 8)));
if (EXTRACT_BE_U_4(bp + 12) != 0xffffffff)
- ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
+ ND_PRINT((ndo, "/%s", ipaddr_string(ndo, bp + 12)));
ND_TCHECK_4(bp + 24);
ND_PRINT((ndo, " %s pref %d metric %d",
(bp[20] & 0x80) ? "RP-tree" : "SPT",
@@ -433,7 +433,7 @@ cisco_autorp_print(netdissect_options *ndo,
goto trunc;
ND_TCHECK_6(bp);
ND_PRINT((ndo, "%c%s%s/%d", s, bp[0] & 1 ? "!" : "",
- ipaddr_string(ndo, &bp[2]), bp[1]));
+ ipaddr_string(ndo, bp + 2), bp[1]));
if (bp[0] & 0x02) {
ND_PRINT((ndo, " bidir"));
}