summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2006-12-12 12:17:58 +0000
committerbz <bz@FreeBSD.org>2006-12-12 12:17:58 +0000
commit297206ec2ac5b34686aaf531476b1b737df9bbd7 (patch)
tree262eb78fb028423e6796d76401691a45b39b496a /sys
parentdc3e4a0741ba505defdc796a954461de7aa856e3 (diff)
downloadFreeBSD-src-297206ec2ac5b34686aaf531476b1b737df9bbd7.zip
FreeBSD-src-297206ec2ac5b34686aaf531476b1b737df9bbd7.tar.gz
MFp4: 92972, 98913 + one more change
In ip6_sprintf no longer use and return one of eight static buffers for printing/logging ipv6 addresses. The caller now has to hand in a sufficiently large buffer as first argument.
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_spppsubr.c16
-rw-r--r--sys/netinet/ip_fw2.c10
-rw-r--r--sys/netinet/tcp_hostcache.c5
-rw-r--r--sys/netinet/tcp_input.c10
-rw-r--r--sys/netinet/tcp_reass.c10
-rw-r--r--sys/netinet6/frag6.c7
-rw-r--r--sys/netinet6/icmp6.c27
-rw-r--r--sys/netinet6/in6.c41
-rw-r--r--sys/netinet6/in6_gif.c3
-rw-r--r--sys/netinet6/in6_src.c7
-rw-r--r--sys/netinet6/in6_var.h2
-rw-r--r--sys/netinet6/ip6_forward.c13
-rw-r--r--sys/netinet6/ip6_input.c6
-rw-r--r--sys/netinet6/ip6_mroute.c98
-rw-r--r--sys/netinet6/ipsec.c12
-rw-r--r--sys/netinet6/mld6.c5
-rw-r--r--sys/netinet6/nd6.c18
-rw-r--r--sys/netinet6/nd6_nbr.c58
-rw-r--r--sys/netinet6/nd6_rtr.c77
-rw-r--r--sys/netinet6/scope6.c3
-rw-r--r--sys/netinet6/udp6_usrreq.c10
-rw-r--r--sys/netipsec/ipsec.c6
-rw-r--r--sys/netipsec/ipsec_input.c12
-rw-r--r--sys/nfsserver/nfs_syscalls.c22
24 files changed, 297 insertions, 181 deletions
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 1b44370..6071e06 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -3502,6 +3502,7 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
int ifidcount;
int type;
int collision, nohisaddr;
+ char ip6buf[INET6_ADDRSTRLEN];
len -= 4;
origlen = len;
@@ -3595,8 +3596,8 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
if (debug) {
log(-1, " %s [%s]",
- ip6_sprintf(&desiredaddr),
- sppp_cp_type_name(type));
+ ip6_sprintf(ip6buf, &desiredaddr),
+ sppp_cp_type_name(type));
}
continue;
}
@@ -3617,8 +3618,9 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
bcopy(&suggestaddr.s6_addr[8], &p[2], 8);
}
if (debug)
- log(-1, " %s [%s]", ip6_sprintf(&desiredaddr),
- sppp_cp_type_name(type));
+ log(-1, " %s [%s]",
+ ip6_sprintf(ip6buf, &desiredaddr),
+ sppp_cp_type_name(type));
break;
}
/* Add the option to nak'ed list. */
@@ -3639,7 +3641,8 @@ sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
if (debug) {
log(-1, " send %s suggest %s\n",
- sppp_cp_type_name(type), ip6_sprintf(&suggestaddr));
+ sppp_cp_type_name(type),
+ ip6_sprintf(ip6buf, &suggestaddr));
}
sppp_cp_send (sp, PPP_IPV6CP, type, h->ident, rlen, buf);
}
@@ -3706,6 +3709,7 @@ sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
struct ifnet *ifp = SP2IFP(sp);
int debug = ifp->if_flags & IFF_DEBUG;
struct in6_addr suggestaddr;
+ char ip6buf[INET6_ADDRSTRLEN];
len -= 4;
buf = malloc (len, M_TEMP, M_NOWAIT);
@@ -3738,7 +3742,7 @@ sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
sp->ipv6cp.opts |= (1 << IPV6CP_OPT_IFID);
if (debug)
log(-1, " [suggestaddr %s]",
- ip6_sprintf(&suggestaddr));
+ ip6_sprintf(ip6buf, &suggestaddr));
#ifdef IPV6CP_MYIFID_DYN
/*
* When doing dynamic address assignment,
diff --git a/sys/netinet/ip_fw2.c b/sys/netinet/ip_fw2.c
index a435d03..591e6ff 100644
--- a/sys/netinet/ip_fw2.c
+++ b/sys/netinet/ip_fw2.c
@@ -886,10 +886,11 @@ ipfw_log(struct ip_fw *f, u_int hlen, struct ip_fw_args *args,
dst[0] = '\0';
#ifdef INET6
if (IS_IP6_FLOW_ID(&(args->f_id))) {
+ char ip6buf[INET6_ADDRSTRLEN];
snprintf(src, sizeof(src), "[%s]",
- ip6_sprintf(&args->f_id.src_ip6));
+ ip6_sprintf(ip6buf, &args->f_id.src_ip6));
snprintf(dst, sizeof(dst), "[%s]",
- ip6_sprintf(&args->f_id.dst_ip6));
+ ip6_sprintf(ip6buf, &args->f_id.dst_ip6));
ip6 = (struct ip6_hdr *)mtod(m, struct ip6_hdr *);
tcp = (struct tcphdr *)(mtod(args->m, char *) + hlen);
@@ -1529,11 +1530,12 @@ install_state(struct ip_fw *rule, ipfw_insn_limit *cmd,
* supported yet.
*/
if (IS_IP6_FLOW_ID(&(args->f_id))) {
+ char ip6buf[INET6_ADDRSTRLEN];
snprintf(src, sizeof(src),
- "[%s]", ip6_sprintf(
+ "[%s]", ip6_sprintf(ip6buf,
&args->f_id.src_ip6));
snprintf(dst, sizeof(dst),
- "[%s]", ip6_sprintf(
+ "[%s]", ip6_sprintf(ip6buf,
&args->f_id.dst_ip6));
} else
#endif
diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c
index 7535d31..f4c7a68 100644
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -587,6 +587,9 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
char *p, *buf;
int len, i, error;
struct hc_metrics *hc_entry;
+#ifdef INET6
+ char ip6buf[INET6_ADDRSTRLEN];
+#endif
bufsize = linesize * (tcp_hostcache.cache_count + 1);
@@ -607,7 +610,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
"%4lu %4lu %4i\n",
hc_entry->ip4.s_addr ? inet_ntoa(hc_entry->ip4) :
#ifdef INET6
- ip6_sprintf(&hc_entry->ip6),
+ ip6_sprintf(ip6buf, &hc_entry->ip6),
#else
"IPv6?",
#endif
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 9aef64b..79d5e86 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -454,6 +454,7 @@ tcp_input(m, off0)
struct ip6_hdr *ip6 = NULL;
#ifdef INET6
int isipv6;
+ char ip6buf[INET6_ADDRSTRLEN];
#else
const int isipv6 = 0;
#endif
@@ -712,8 +713,10 @@ findpcb:
#ifdef INET6
strcpy(dbuf, "[");
strcpy(sbuf, "[");
- strcat(dbuf, ip6_sprintf(&ip6->ip6_dst));
- strcat(sbuf, ip6_sprintf(&ip6->ip6_src));
+ strcat(dbuf,
+ ip6_sprintf(ip6buf, &ip6->ip6_dst));
+ strcat(sbuf,
+ ip6_sprintf(ip6buf, &ip6->ip6_src));
strcat(dbuf, "]");
strcat(sbuf, "]");
#endif
@@ -1069,7 +1072,8 @@ after_listen:
"dropping connection\n",
#ifdef INET6
isipv6 ?
- ip6_sprintf(&inp->inp_inc.inc6_faddr) :
+ ip6_sprintf(ip6buf,
+ &inp->inp_inc.inc6_faddr) :
#endif
inet_ntoa(inp->inp_inc.inc_faddr),
inp->inp_inc.inc_fport,
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index 9aef64b..79d5e86 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -454,6 +454,7 @@ tcp_input(m, off0)
struct ip6_hdr *ip6 = NULL;
#ifdef INET6
int isipv6;
+ char ip6buf[INET6_ADDRSTRLEN];
#else
const int isipv6 = 0;
#endif
@@ -712,8 +713,10 @@ findpcb:
#ifdef INET6
strcpy(dbuf, "[");
strcpy(sbuf, "[");
- strcat(dbuf, ip6_sprintf(&ip6->ip6_dst));
- strcat(sbuf, ip6_sprintf(&ip6->ip6_src));
+ strcat(dbuf,
+ ip6_sprintf(ip6buf, &ip6->ip6_dst));
+ strcat(sbuf,
+ ip6_sprintf(ip6buf, &ip6->ip6_src));
strcat(dbuf, "]");
strcat(sbuf, "]");
#endif
@@ -1069,7 +1072,8 @@ after_listen:
"dropping connection\n",
#ifdef INET6
isipv6 ?
- ip6_sprintf(&inp->inp_inc.inc6_faddr) :
+ ip6_sprintf(ip6buf,
+ &inp->inp_inc.inc6_faddr) :
#endif
inet_ntoa(inp->inp_inc.inc_faddr),
inp->inp_inc.inc_fport,
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c
index 883ad2a..7403e13 100644
--- a/sys/netinet6/frag6.c
+++ b/sys/netinet6/frag6.c
@@ -157,6 +157,9 @@ frag6_input(mp, offp, proto)
int fragoff, frgpartlen; /* must be larger than u_int16_t */
struct ifnet *dstifp;
u_int8_t ecn, ecn0;
+#if 0
+ char ip6buf[INET6_ADDRSTRLEN];
+#endif
ip6 = mtod(m, struct ip6_hdr *);
#ifndef PULLDOWN_TEST
@@ -433,7 +436,7 @@ frag6_input(mp, offp, proto)
#if 0 /* suppress the noisy log */
log(LOG_ERR, "%d bytes of a fragment from %s "
"overlaps the previous fragment\n",
- i, ip6_sprintf(&q6->ip6q_src));
+ i, ip6_sprintf(ip6buf, &q6->ip6q_src));
#endif
free(ip6af, M_FTABLE);
goto dropfrag;
@@ -445,7 +448,7 @@ frag6_input(mp, offp, proto)
#if 0 /* suppress the noisy log */
log(LOG_ERR, "%d bytes of a fragment from %s "
"overlaps the succeeding fragment",
- i, ip6_sprintf(&q6->ip6q_src));
+ i, ip6_sprintf(ip6buf, &q6->ip6q_src));
#endif
free(ip6af, M_FTABLE);
goto dropfrag;
diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c
index 21d4b3b..9ab0741 100644
--- a/sys/netinet6/icmp6.c
+++ b/sys/netinet6/icmp6.c
@@ -404,6 +404,7 @@ icmp6_input(mp, offp, proto)
int off = *offp;
int icmp6len = m->m_pkthdr.len - *offp;
int code, sum, noff;
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE);
@@ -438,7 +439,8 @@ icmp6_input(mp, offp, proto)
if ((sum = in6_cksum(m, IPPROTO_ICMPV6, off, icmp6len)) != 0) {
nd6log((LOG_ERR,
"ICMP6 checksum error(%d|%x) %s\n",
- icmp6->icmp6_type, sum, ip6_sprintf(&ip6->ip6_src)));
+ icmp6->icmp6_type, sum,
+ ip6_sprintf(ip6bufs, &ip6->ip6_src)));
icmp6stat.icp6s_checksum++;
goto freeit;
}
@@ -822,8 +824,8 @@ icmp6_input(mp, offp, proto)
default:
nd6log((LOG_DEBUG,
"icmp6_input: unknown type %d(src=%s, dst=%s, ifid=%d)\n",
- icmp6->icmp6_type, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst),
+ icmp6->icmp6_type, ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
m->m_pkthdr.rcvif ? m->m_pkthdr.rcvif->if_index : 0));
if (icmp6->icmp6_type < ICMP6_ECHO_REQUEST) {
/* ICMPv6 error: MUST deliver it by spec... */
@@ -2136,10 +2138,11 @@ icmp6_reflect(m, off)
if (ro.ro_rt)
RTFREE(ro.ro_rt); /* XXX: we could use this */
if (src == NULL) {
+ char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG,
"icmp6_reflect: source can't be determined: "
"dst=%s, error=%d\n",
- ip6_sprintf(&sin6.sin6_addr), e));
+ ip6_sprintf(ip6buf, &sin6.sin6_addr), e));
goto bad;
}
}
@@ -2192,8 +2195,12 @@ icmp6_redirect_diag(src6, dst6, tgt6)
struct in6_addr *tgt6;
{
static char buf[1024];
+ char ip6bufs[INET6_ADDRSTRLEN];
+ char ip6bufd[INET6_ADDRSTRLEN];
+ char ip6buft[INET6_ADDRSTRLEN];
snprintf(buf, sizeof(buf), "(src=%s dst=%s tgt=%s)",
- ip6_sprintf(src6), ip6_sprintf(dst6), ip6_sprintf(tgt6));
+ ip6_sprintf(ip6bufs, src6), ip6_sprintf(ip6bufd, dst6),
+ ip6_sprintf(ip6buft, tgt6));
return buf;
}
@@ -2217,6 +2224,7 @@ icmp6_redirect_input(m, off)
struct in6_addr redtgt6;
struct in6_addr reddst6;
union nd_opts ndopts;
+ char ip6buf[INET6_ADDRSTRLEN];
if (!m || !ifp)
return;
@@ -2250,14 +2258,14 @@ icmp6_redirect_input(m, off)
nd6log((LOG_ERR,
"ICMP6 redirect sent from %s rejected; "
"must be from linklocal\n",
- ip6_sprintf(&src6)));
+ ip6_sprintf(ip6buf, &src6)));
goto bad;
}
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
"ICMP6 redirect sent from %s rejected; "
"hlim=%d (must be 255)\n",
- ip6_sprintf(&src6), ip6->ip6_hlim));
+ ip6_sprintf(ip6buf, &src6), ip6->ip6_hlim));
goto bad;
}
{
@@ -2287,7 +2295,7 @@ icmp6_redirect_input(m, off)
"ICMP6 redirect rejected; "
"not equal to gw-for-src=%s (must be same): "
"%s\n",
- ip6_sprintf(gw6),
+ ip6_sprintf(ip6buf, gw6),
icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
RTFREE_LOCKED(rt);
goto bad;
@@ -2348,7 +2356,8 @@ icmp6_redirect_input(m, off)
nd6log((LOG_INFO,
"icmp6_redirect_input: lladdrlen mismatch for %s "
"(if %d, icmp6 packet %d): %s\n",
- ip6_sprintf(&redtgt6), ifp->if_addrlen, lladdrlen - 2,
+ ip6_sprintf(ip6buf, &redtgt6),
+ ifp->if_addrlen, lladdrlen - 2,
icmp6_redirect_diag(&src6, &reddst6, &redtgt6)));
goto bad;
}
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 52b57aa..a2dc235 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -140,6 +140,7 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
struct sockaddr_in6 all1_sa;
struct rtentry *nrt = NULL;
int e;
+ char ip6buf[INET6_ADDRSTRLEN];
bzero(&all1_sa, sizeof(all1_sa));
all1_sa.sin6_family = AF_INET6;
@@ -158,11 +159,12 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
(struct sockaddr *)&all1_sa, RTF_UP|RTF_HOST|RTF_LLINFO, &nrt);
if (e != 0) {
/* XXX need more descriptive message */
+
log(LOG_ERR, "in6_ifloop_request: "
"%s operation failed for %s (errno=%d)\n",
cmd == RTM_ADD ? "ADD" : "DELETE",
- ip6_sprintf(&((struct in6_ifaddr *)ifa)->ia_addr.sin6_addr),
- e);
+ ip6_sprintf(ip6buf,
+ &((struct in6_ifaddr *)ifa)->ia_addr.sin6_addr), e);
}
/*
@@ -807,6 +809,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
struct in6_multi *in6m_sol;
struct rtentry *rt;
int delay;
+ char ip6buf[INET6_ADDRSTRLEN];
/* Validate parameters */
if (ifp == NULL || ifra == NULL) /* this maybe redundant */
@@ -901,7 +904,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
*/
nd6log((LOG_INFO,
"in6_update_ifa: valid lifetime is 0 for %s\n",
- ip6_sprintf(&ifra->ifra_addr.sin6_addr)));
+ ip6_sprintf(ip6buf, &ifra->ifra_addr.sin6_addr)));
if (ia == NULL)
return (0); /* there's nothing to do */
@@ -968,7 +971,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL) != plen) {
nd6log((LOG_INFO, "in6_update_ifa: the prefix length of an"
" existing (%s) address should not be changed\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr)));
error = EINVAL;
goto unlink;
}
@@ -988,7 +991,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
(e = rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST)) != 0) {
nd6log((LOG_ERR, "in6_update_ifa: failed to remove "
"a route to the old destination: %s\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr)));
/* proceed anyway... */
} else
ia->ia_flags &= ~IFA_ROUTE;
@@ -1084,7 +1087,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
nd6log((LOG_WARNING,
"in6_update_ifa: addmulti failed for "
"%s on %s (errno=%d)\n",
- ip6_sprintf(&llsol), if_name(ifp),
+ ip6_sprintf(ip6buf, &llsol), if_name(ifp),
error));
in6_purgeaddr((struct ifaddr *)ia);
return (error);
@@ -1166,7 +1169,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
nd6log((LOG_WARNING,
"in6_update_ifa: addmulti failed for "
"%s on %s (errno=%d)\n",
- ip6_sprintf(&mltaddr.sin6_addr),
+ ip6_sprintf(ip6buf, &mltaddr.sin6_addr),
if_name(ifp), error));
goto cleanup;
}
@@ -1192,7 +1195,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
nd6log((LOG_WARNING, "in6_update_ifa: "
"addmulti failed for %s on %s "
"(errno=%d)\n",
- ip6_sprintf(&mltaddr.sin6_addr),
+ ip6_sprintf(ip6buf, &mltaddr.sin6_addr),
if_name(ifp), error));
/* XXX not very fatal, go on... */
}
@@ -1253,7 +1256,7 @@ in6_update_ifa(ifp, ifra, ia, flags)
nd6log((LOG_WARNING, "in6_update_ifa: "
"addmulti failed for %s on %s "
"(errno=%d)\n",
- ip6_sprintf(&mltaddr.sin6_addr),
+ ip6_sprintf(ip6buf, &mltaddr.sin6_addr),
if_name(ifp), error));
goto cleanup;
}
@@ -1320,6 +1323,7 @@ in6_purgeaddr(ifa)
{
struct ifnet *ifp = ifa->ifa_ifp;
struct in6_ifaddr *ia = (struct in6_ifaddr *) ifa;
+ char ip6buf[INET6_ADDRSTRLEN];
/* stop DAD processing */
nd6_dad_stop(ifa);
@@ -1336,8 +1340,8 @@ in6_purgeaddr(ifa)
log(LOG_ERR, "in6_purgeaddr: failed to remove "
"a route to the p2p destination: %s on %s, "
"errno=%d\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr), if_name(ifp),
- e);
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
+ if_name(ifp), e);
/* proceed anyway... */
} else
ia->ia_flags &= ~IFA_ROUTE;
@@ -1889,23 +1893,20 @@ in6ifa_ifpwithaddr(ifp, addr)
}
/*
- * Convert IP6 address to printable (loggable) representation.
+ * Convert IP6 address to printable (loggable) representation. Caller
+ * has to make sure that ip6buf is at least INET6_ADDRSTRLEN long.
*/
static char digits[] = "0123456789abcdef";
-static int ip6round = 0;
char *
-ip6_sprintf(addr)
- const struct in6_addr *addr;
+ip6_sprintf(char *ip6buf, const struct in6_addr *addr)
{
- static char ip6buf[8][48];
int i;
char *cp;
const u_int16_t *a = (const u_int16_t *)addr;
const u_int8_t *d;
int dcolon = 0;
- ip6round = (ip6round + 1) & 7;
- cp = ip6buf[ip6round];
+ cp = ip6buf;
for (i = 0; i < 8; i++) {
if (dcolon == 1) {
@@ -1938,8 +1939,8 @@ ip6_sprintf(addr)
*cp++ = ':';
a++;
}
- *--cp = 0;
- return (ip6buf[ip6round]);
+ *--cp = '\0';
+ return (ip6buf);
}
int
diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c
index 2d31f38..d3236dc 100644
--- a/sys/netinet6/in6_gif.c
+++ b/sys/netinet6/in6_gif.c
@@ -369,9 +369,10 @@ gif_validate6(ip6, sc, ifp)
rt = rtalloc1((struct sockaddr *)&sin6, 0, 0UL);
if (!rt || rt->rt_ifp != ifp) {
#if 0
+ char ip6buf[INET6_ADDRSTRLEN];
log(LOG_WARNING, "%s: packet from %s dropped "
"due to ingress filter\n", if_name(GIF2IFP(sc)),
- ip6_sprintf(&sin6.sin6_addr));
+ ip6_sprintf(ip6buf, &sin6.sin6_addr));
#endif
if (rt)
rtfree(rt);
diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c
index b9457dc..f7a6ff7 100644
--- a/sys/netinet6/in6_src.c
+++ b/sys/netinet6/in6_src.c
@@ -446,16 +446,17 @@ selectroute(dstsock, opts, mopts, ro, retifp, retrt, clone, norouteok)
struct sockaddr_in6 *sin6_next;
struct in6_pktinfo *pi = NULL;
struct in6_addr *dst = &dstsock->sin6_addr;
-
#if 0
+ char ip6buf[INET6_ADDRSTRLEN];
+
if (dstsock->sin6_addr.s6_addr32[0] == 0 &&
dstsock->sin6_addr.s6_addr32[1] == 0 &&
!IN6_IS_ADDR_LOOPBACK(&dstsock->sin6_addr)) {
printf("in6_selectroute: strange destination %s\n",
- ip6_sprintf(&dstsock->sin6_addr));
+ ip6_sprintf(ip6buf, &dstsock->sin6_addr));
} else {
printf("in6_selectroute: destination = %s%%%d\n",
- ip6_sprintf(&dstsock->sin6_addr),
+ ip6_sprintf(ip6buf, &dstsock->sin6_addr),
dstsock->sin6_scope_id); /* for debug */
}
#endif
diff --git a/sys/netinet6/in6_var.h b/sys/netinet6/in6_var.h
index faa3e62..641f475 100644
--- a/sys/netinet6/in6_var.h
+++ b/sys/netinet6/in6_var.h
@@ -608,7 +608,7 @@ void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
void in6_purgemkludge __P((struct ifnet *));
struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int));
struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, struct in6_addr *));
-char *ip6_sprintf __P((const struct in6_addr *));
+char *ip6_sprintf __P((char *, const struct in6_addr *));
int in6_addr2zoneid __P((struct ifnet *, struct in6_addr *, u_int32_t *));
int in6_matchlen __P((struct in6_addr *, struct in6_addr *));
int in6_are_prefix_equal __P((struct in6_addr *, struct in6_addr *, int));
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index 4893cd1..ece39b1 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -114,6 +114,7 @@ ip6_forward(m, srcrt)
struct secpolicy *sp = NULL;
int ipsecrt = 0;
#endif
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
GIANT_REQUIRED; /* XXX bz: ip6_forward_rt */
@@ -150,8 +151,8 @@ ip6_forward(m, srcrt)
log(LOG_DEBUG,
"cannot forward "
"from %s to %s nxt %d received on %s\n",
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
ip6->ip6_nxt,
if_name(m->m_pkthdr.rcvif));
}
@@ -443,8 +444,8 @@ ip6_forward(m, srcrt)
log(LOG_DEBUG,
"cannot forward "
"src %s, dst %s, nxt %d, rcvif %s, outif %s\n",
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
ip6->ip6_nxt,
if_name(m->m_pkthdr.rcvif), if_name(rt->rt_ifp));
}
@@ -575,8 +576,8 @@ ip6_forward(m, srcrt)
{
printf("ip6_forward: outgoing interface is loopback. "
"src %s, dst %s, nxt %d, rcvif %s, outif %s\n",
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
ip6->ip6_nxt, if_name(m->m_pkthdr.rcvif),
if_name(rt->rt_ifp));
}
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index e27656f..981c43a 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -548,11 +548,13 @@ passin:
ia6->ia_ifa.if_ibytes += m->m_pkthdr.len;
goto hbhcheck;
} else {
+ char ip6bufs[INET6_ADDRSTRLEN];
+ char ip6bufd[INET6_ADDRSTRLEN];
/* address is not ready, so discard the packet. */
nd6log((LOG_INFO,
"ip6_input: packet to an unready address %s->%s\n",
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst)));
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst)));
goto bad;
}
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 3bbc1e0..1f86754 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -725,6 +725,7 @@ add_m6fc(mfccp)
struct rtdetq *rte;
u_short nstl;
int s;
+ char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
MF6CFIND(mfccp->mf6cc_origin.sin6_addr,
mfccp->mf6cc_mcastgrp.sin6_addr, rt);
@@ -732,12 +733,13 @@ add_m6fc(mfccp)
/* If an entry already exists, just update the fields */
if (rt) {
#ifdef MRT6DEBUG
- if (mrt6debug & DEBUG_MFC)
- log(LOG_DEBUG,
- "add_m6fc no upcall h %d o %s g %s p %x\n",
- ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr),
- ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr),
- mfccp->mf6cc_parent);
+ if (mrt6debug & DEBUG_MFC) {
+ log(LOG_DEBUG,
+ "add_m6fc no upcall h %d o %s g %s p %x\n",
+ ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr),
+ ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr),
+ mfccp->mf6cc_parent);
+ }
#endif
s = splnet();
@@ -764,16 +766,20 @@ add_m6fc(mfccp)
log(LOG_ERR,
"add_m6fc: %s o %s g %s p %x dbx %p\n",
"multiple kernel entries",
- ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr),
- ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr),
+ ip6_sprintf(ip6bufo,
+ &mfccp->mf6cc_origin.sin6_addr),
+ ip6_sprintf(ip6bufg,
+ &mfccp->mf6cc_mcastgrp.sin6_addr),
mfccp->mf6cc_parent, rt->mf6c_stall);
#ifdef MRT6DEBUG
if (mrt6debug & DEBUG_MFC)
log(LOG_DEBUG,
"add_m6fc o %s g %s p %x dbg %x\n",
- ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr),
- ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr),
+ ip6_sprintf(ip6bufo,
+ &mfccp->mf6cc_origin.sin6_addr),
+ ip6_sprintf(ip6bufg,
+ &mfccp->mf6cc_mcastgrp.sin6_addr),
mfccp->mf6cc_parent, rt->mf6c_stall);
#endif
@@ -810,12 +816,12 @@ add_m6fc(mfccp)
if (nstl == 0) {
#ifdef MRT6DEBUG
if (mrt6debug & DEBUG_MFC)
- log(LOG_DEBUG,
- "add_mfc no upcall h %d o %s g %s p %x\n",
- hash,
- ip6_sprintf(&mfccp->mf6cc_origin.sin6_addr),
- ip6_sprintf(&mfccp->mf6cc_mcastgrp.sin6_addr),
- mfccp->mf6cc_parent);
+ log(LOG_DEBUG,
+ "add_mfc no upcall h %d o %s g %s p %x\n",
+ hash,
+ ip6_sprintf(ip6bufo, &mfccp->mf6cc_origin.sin6_addr),
+ ip6_sprintf(ip6bufg, &mfccp->mf6cc_mcastgrp.sin6_addr),
+ mfccp->mf6cc_parent);
#endif
for (rt = mf6ctable[hash]; rt; rt = rt->mf6c_next) {
@@ -915,10 +921,12 @@ del_m6fc(mfccp)
hash = MF6CHASH(origin.sin6_addr, mcastgrp.sin6_addr);
#ifdef MRT6DEBUG
- if (mrt6debug & DEBUG_MFC)
+ if (mrt6debug & DEBUG_MFC) {
+ char ip6bufo[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
log(LOG_DEBUG,"del_m6fc orig %s mcastgrp %s\n",
- ip6_sprintf(&origin.sin6_addr),
- ip6_sprintf(&mcastgrp.sin6_addr));
+ ip6_sprintf(ip6bufo, &origin.sin6_addr),
+ ip6_sprintf(ip6bufg, &mcastgrp.sin6_addr));
+ }
#endif
s = splnet();
@@ -995,11 +1003,13 @@ ip6_mforward(ip6, ifp, m)
struct mbuf *mm;
int s;
mifi_t mifi;
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
#ifdef MRT6DEBUG
if (mrt6debug & DEBUG_FORWARD)
log(LOG_DEBUG, "ip6_mforward: src %s, dst %s, ifindex %d\n",
- ip6_sprintf(&ip6->ip6_src), ip6_sprintf(&ip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
ifp->if_index);
#endif
@@ -1026,8 +1036,8 @@ ip6_mforward(ip6, ifp, m)
log(LOG_DEBUG,
"cannot forward "
"from %s to %s nxt %d received on %s\n",
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
ip6->ip6_nxt,
if_name(m->m_pkthdr.rcvif));
}
@@ -1065,8 +1075,8 @@ ip6_mforward(ip6, ifp, m)
#ifdef MRT6DEBUG
if (mrt6debug & (DEBUG_FORWARD | DEBUG_MFC))
log(LOG_DEBUG, "ip6_mforward: no rte s %s g %s\n",
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst));
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst));
#endif
/*
@@ -1275,10 +1285,13 @@ expire_upcalls(unused)
mfc->mf6c_expire != 0 &&
--mfc->mf6c_expire == 0) {
#ifdef MRT6DEBUG
- if (mrt6debug & DEBUG_EXPIRE)
+ if (mrt6debug & DEBUG_EXPIRE) {
+ char ip6bufo[INET6_ADDRSTRLEN];
+ char ip6bufg[INET6_ADDRSTRLEN];
log(LOG_DEBUG, "expire_upcalls: expiring (%s %s)\n",
- ip6_sprintf(&mfc->mf6c_origin.sin6_addr),
- ip6_sprintf(&mfc->mf6c_mcastgrp.sin6_addr));
+ ip6_sprintf(ip6bufo, &mfc->mf6c_origin.sin6_addr),
+ ip6_sprintf(ip6bufg, &mfc->mf6c_mcastgrp.sin6_addr));
+ }
#endif
/*
* drop all the packets
@@ -1588,14 +1601,17 @@ phyint_send(ip6, mifp, m)
icmp6_error(mb_copy, ICMP6_PACKET_TOO_BIG, 0, linkmtu);
else {
#ifdef MRT6DEBUG
- if (mrt6debug & DEBUG_XMIT)
+ if (mrt6debug & DEBUG_XMIT) {
+ char ip6bufs[INET6_ADDRSTRLEN];
+ char ip6bufd[INET6_ADDRSTRLEN];
log(LOG_DEBUG,
"phyint_send: packet too big on %s o %s "
"g %s size %d(discarded)\n",
if_name(ifp),
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
mb_copy->m_pkthdr.len);
+ }
#endif /* MRT6DEBUG */
m_freem(mb_copy); /* simply discard the packet */
}
@@ -1616,9 +1632,12 @@ register_send(ip6, mif, m)
struct mrt6msg *im6;
#ifdef MRT6DEBUG
- if (mrt6debug)
+ if (mrt6debug) {
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
log(LOG_DEBUG, "** IPv6 register_send **\n src %s dst %s\n",
- ip6_sprintf(&ip6->ip6_src), ip6_sprintf(&ip6->ip6_dst));
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst));
+ }
#endif
++pim6stat.pim6s_snd_registers;
@@ -1786,6 +1805,9 @@ pim6_input(mp, offp, proto)
struct ip6_hdr *eip6;
u_int32_t *reghdr;
int rc;
+#ifdef MRT6DEBUG
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
+#endif
++pim6stat.pim6s_rcv_registers;
@@ -1815,7 +1837,7 @@ pim6_input(mp, offp, proto)
log(LOG_ERR,
"pim6_input: register packet size too "
"small %d from %s\n",
- pimlen, ip6_sprintf(&ip6->ip6_src));
+ pimlen, ip6_sprintf(ip6bufs, &ip6->ip6_src));
#endif
m_freem(m);
return (IPPROTO_DONE);
@@ -1827,8 +1849,8 @@ pim6_input(mp, offp, proto)
log(LOG_DEBUG,
"pim6_input[register], eip6: %s -> %s, "
"eip6 plen %d\n",
- ip6_sprintf(&eip6->ip6_src),
- ip6_sprintf(&eip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &eip6->ip6_src),
+ ip6_sprintf(ip6bufd, &eip6->ip6_dst),
ntohs(eip6->ip6_plen));
#endif
@@ -1852,7 +1874,7 @@ pim6_input(mp, offp, proto)
log(LOG_DEBUG,
"pim6_input: inner packet of register "
"is not multicast %s\n",
- ip6_sprintf(&eip6->ip6_dst));
+ ip6_sprintf(ip6bufd, &eip6->ip6_dst));
#endif
m_freem(m);
return (IPPROTO_DONE);
@@ -1881,8 +1903,8 @@ pim6_input(mp, offp, proto)
log(LOG_DEBUG,
"pim6_input: forwarding decapsulated register: "
"src %s, dst %s, mif %d\n",
- ip6_sprintf(&eip6->ip6_src),
- ip6_sprintf(&eip6->ip6_dst),
+ ip6_sprintf(ip6bufs, &eip6->ip6_src),
+ ip6_sprintf(ip6bufd, &eip6->ip6_dst),
reg_mif_num);
}
#endif
diff --git a/sys/netinet6/ipsec.c b/sys/netinet6/ipsec.c
index a0b356b..3dcadc0 100644
--- a/sys/netinet6/ipsec.c
+++ b/sys/netinet6/ipsec.c
@@ -2494,6 +2494,7 @@ ipsec6_logpacketstr(ip6, spi)
u_int32_t spi;
{
static char buf[256];
+ char ip6buf[INET6_ADDRSTRLEN];
char *p;
p = buf;
@@ -2501,11 +2502,11 @@ ipsec6_logpacketstr(ip6, spi)
while (*p)
p++;
snprintf(p, sizeof(buf) - (p - buf), "src=%s",
- ip6_sprintf(&ip6->ip6_src));
+ ip6_sprintf(ip6buf, &ip6->ip6_src));
while (*p)
p++;
snprintf(p, sizeof(buf) - (p - buf), " dst=%s",
- ip6_sprintf(&ip6->ip6_dst));
+ ip6_sprintf(ip6buf, &ip6->ip6_dst));
while (*p)
p++;
snprintf(p, sizeof(buf) - (p - buf), ")");
@@ -2541,14 +2542,17 @@ ipsec_logsastr(sav)
}
#ifdef INET6
else if (((struct sockaddr *)&saidx->src)->sa_family == AF_INET6) {
+ char ip6buf[INET6_ADDRSTRLEN];
snprintf(p, sizeof(buf) - (p - buf),
"src=%s",
- ip6_sprintf(&((struct sockaddr_in6 *)&saidx->src)->sin6_addr));
+ ip6_sprintf(ip6buf,
+ &((struct sockaddr_in6 *)&saidx->src)->sin6_addr));
while (*p)
p++;
snprintf(p, sizeof(buf) - (p - buf),
" dst=%s",
- ip6_sprintf(&((struct sockaddr_in6 *)&saidx->dst)->sin6_addr));
+ ip6_sprintf(ip6buf,
+ &((struct sockaddr_in6 *)&saidx->dst)->sin6_addr));
}
#endif
while (*p)
diff --git a/sys/netinet6/mld6.c b/sys/netinet6/mld6.c
index bc8a7c3..19371c5 100644
--- a/sys/netinet6/mld6.c
+++ b/sys/netinet6/mld6.c
@@ -296,10 +296,11 @@ mld6_input(m, off)
/* source address validation */
ip6 = mtod(m, struct ip6_hdr *); /* in case mpullup */
if (!IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src)) {
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufg[INET6_ADDRSTRLEN];
log(LOG_ERR,
"mld6_input: src %s is not link-local (grp=%s)\n",
- ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&mldh->mld_addr));
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufg, &mldh->mld_addr));
/*
* spec (RFC2710) does not explicitly
* specify to discard the packet from a non link-local
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index 39782e8..2661c80 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -824,6 +824,7 @@ nd6_lookup(addr6, create, ifp)
{
struct rtentry *rt;
struct sockaddr_in6 sin6;
+ char ip6buf[INET6_ADDRSTRLEN];
bzero(&sin6, sizeof(sin6));
sin6.sin6_len = sizeof(struct sockaddr_in6);
@@ -871,7 +872,7 @@ nd6_lookup(addr6, create, ifp)
log(LOG_ERR,
"nd6_lookup: failed to add route for a "
"neighbor(%s), errno=%d\n",
- ip6_sprintf(addr6), e);
+ ip6_sprintf(ip6buf, addr6), e);
}
if (rt == NULL)
return (NULL);
@@ -908,7 +909,7 @@ nd6_lookup(addr6, create, ifp)
if (create) {
nd6log((LOG_DEBUG,
"nd6_lookup: failed to lookup %s (if = %s)\n",
- ip6_sprintf(addr6),
+ ip6_sprintf(ip6buf, addr6),
ifp ? if_name(ifp) : "unspec"));
}
RT_UNLOCK(rt);
@@ -1387,9 +1388,11 @@ nd6_rtrequest(req, rt, info)
break;
if (in6_addmulti(&llsol, ifp,
&error, 0) == NULL) {
+ char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_ERR, "%s: failed to join "
"%s (errno=%d)\n", if_name(ifp),
- ip6_sprintf(&llsol), error));
+ ip6_sprintf(ip6buf, &llsol),
+ error));
}
}
}
@@ -2054,10 +2057,11 @@ again:
if (ln == NULL || rt == NULL) {
if ((ifp->if_flags & IFF_POINTOPOINT) == 0 &&
!(ND_IFINFO(ifp)->flags & ND6_IFF_PERFORMNUD)) {
+ char ip6buf[INET6_ADDRSTRLEN];
log(LOG_DEBUG,
"nd6_output: can't allocate llinfo for %s "
"(ln=%p, rt=%p)\n",
- ip6_sprintf(&dst->sin6_addr), ln, rt);
+ ip6_sprintf(ip6buf, &dst->sin6_addr), ln, rt);
senderr(EIO); /* XXX: good error? */
}
@@ -2347,6 +2351,7 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
char buf[1024];
struct in6_prefix *p, *pe;
struct nd_prefix *pr;
+ char ip6buf[INET6_ADDRSTRLEN];
if (req->newptr)
return EPERM;
@@ -2369,7 +2374,7 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
if (sa6_recoverscope(&p->prefix)) {
log(LOG_ERR,
"scope error in prefix list (%s)\n",
- ip6_sprintf(&p->prefix.sin6_addr));
+ ip6_sprintf(ip6buf, &p->prefix.sin6_addr));
/* XXX: press on... */
}
p->raflags = pr->ndpr_raf;
@@ -2412,7 +2417,8 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
log(LOG_ERR,
"scope error in "
"prefix list (%s)\n",
- ip6_sprintf(&pfr->router->rtaddr));
+ ip6_sprintf(ip6buf,
+ &pfr->router->rtaddr));
}
advrtrs++;
}
diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c
index 81123fe..fefcc99 100644
--- a/sys/netinet6/nd6_nbr.c
+++ b/sys/netinet6/nd6_nbr.c
@@ -107,6 +107,7 @@ nd6_ns_input(m, off, icmp6len)
int tlladdr;
union nd_opts ndopts;
struct sockaddr_dl *proxydl = NULL;
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
#ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, icmp6len,);
@@ -126,8 +127,8 @@ nd6_ns_input(m, off, icmp6len)
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
"nd6_ns_input: invalid hlim (%d) from %s to %s on %s\n",
- ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp)));
goto bad;
}
@@ -247,14 +248,14 @@ nd6_ns_input(m, off, icmp6len)
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
nd6log((LOG_INFO, "nd6_ns_input: lladdrlen mismatch for %s "
"(if %d, NS packet %d)\n",
- ip6_sprintf(&taddr6),
+ ip6_sprintf(ip6bufs, &taddr6),
ifp->if_addrlen, lladdrlen - 2));
goto bad;
}
if (IN6_ARE_ADDR_EQUAL(&myaddr6, &saddr6)) {
nd6log((LOG_INFO, "nd6_ns_input: duplicate IP6 address %s\n",
- ip6_sprintf(&saddr6)));
+ ip6_sprintf(ip6bufs, &saddr6)));
goto freeit;
}
@@ -317,9 +318,12 @@ nd6_ns_input(m, off, icmp6len)
return;
bad:
- nd6log((LOG_ERR, "nd6_ns_input: src=%s\n", ip6_sprintf(&saddr6)));
- nd6log((LOG_ERR, "nd6_ns_input: dst=%s\n", ip6_sprintf(&daddr6)));
- nd6log((LOG_ERR, "nd6_ns_input: tgt=%s\n", ip6_sprintf(&taddr6)));
+ nd6log((LOG_ERR, "nd6_ns_input: src=%s\n",
+ ip6_sprintf(ip6bufs, &saddr6)));
+ nd6log((LOG_ERR, "nd6_ns_input: dst=%s\n",
+ ip6_sprintf(ip6bufs, &daddr6)));
+ nd6log((LOG_ERR, "nd6_ns_input: tgt=%s\n",
+ ip6_sprintf(ip6bufs, &taddr6)));
icmp6stat.icp6s_badns++;
m_freem(m);
}
@@ -454,10 +458,12 @@ nd6_ns_output(ifp, daddr6, taddr6, ln, dad)
src = in6_selectsrc(&dst_sa, NULL,
NULL, &ro, NULL, NULL, &error);
if (src == NULL) {
+ char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG,
"nd6_ns_output: source can't be "
"determined: dst=%s, error=%d\n",
- ip6_sprintf(&dst_sa.sin6_addr), error));
+ ip6_sprintf(ip6buf, &dst_sa.sin6_addr),
+ error));
goto bad;
}
}
@@ -561,12 +567,13 @@ nd6_na_input(m, off, icmp6len)
struct rtentry *rt;
struct sockaddr_dl *sdl;
union nd_opts ndopts;
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
"nd6_na_input: invalid hlim (%d) from %s to %s on %s\n",
- ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp)));
goto bad;
}
@@ -593,7 +600,7 @@ nd6_na_input(m, off, icmp6len)
if (IN6_IS_ADDR_MULTICAST(&taddr6)) {
nd6log((LOG_ERR,
"nd6_na_input: invalid target address %s\n",
- ip6_sprintf(&taddr6)));
+ ip6_sprintf(ip6bufs, &taddr6)));
goto bad;
}
if (IN6_IS_ADDR_MULTICAST(&daddr6))
@@ -638,13 +645,13 @@ nd6_na_input(m, off, icmp6len)
if (ifa) {
log(LOG_ERR,
"nd6_na_input: duplicate IP6 address %s\n",
- ip6_sprintf(&taddr6));
+ ip6_sprintf(ip6bufs, &taddr6));
goto freeit;
}
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
nd6log((LOG_INFO, "nd6_na_input: lladdrlen mismatch for %s "
- "(if %d, NA packet %d)\n", ip6_sprintf(&taddr6),
+ "(if %d, NA packet %d)\n", ip6_sprintf(ip6bufs, &taddr6),
ifp->if_addrlen, lladdrlen - 2));
goto bad;
}
@@ -936,9 +943,10 @@ nd6_na_output(ifp, daddr6_0, taddr6, flags, tlladdr, sdl0)
bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa));
src = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, NULL, &error);
if (src == NULL) {
+ char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_DEBUG, "nd6_na_output: source can't be "
"determined: dst=%s, error=%d\n",
- ip6_sprintf(&dst_sa.sin6_addr), error));
+ ip6_sprintf(ip6buf, &dst_sa.sin6_addr), error));
goto bad;
}
ip6->ip6_src = *src;
@@ -1099,6 +1107,7 @@ nd6_dad_start(ifa, delay)
{
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
struct dadq *dp;
+ char ip6buf[INET6_ADDRSTRLEN];
if (!dad_init) {
TAILQ_INIT(&dadq);
@@ -1115,7 +1124,7 @@ nd6_dad_start(ifa, delay)
log(LOG_DEBUG,
"nd6_dad_start: called with non-tentative address "
"%s(%s)\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr),
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???");
return;
}
@@ -1141,7 +1150,7 @@ nd6_dad_start(ifa, delay)
if (dp == NULL) {
log(LOG_ERR, "nd6_dad_start: memory allocation failed for "
"%s(%s)\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr),
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???");
return;
}
@@ -1150,7 +1159,7 @@ nd6_dad_start(ifa, delay)
TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list);
nd6log((LOG_DEBUG, "%s: starting DAD for %s\n", if_name(ifa->ifa_ifp),
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr)));
/*
* Send NS packet for DAD, ip6_dad_count times.
@@ -1204,6 +1213,7 @@ nd6_dad_timer(ifa)
int s;
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
struct dadq *dp;
+ char ip6buf[INET6_ADDRSTRLEN];
s = splnet(); /* XXX */
@@ -1220,14 +1230,14 @@ nd6_dad_timer(ifa)
if (ia->ia6_flags & IN6_IFF_DUPLICATED) {
log(LOG_ERR, "nd6_dad_timer: called with duplicated address "
"%s(%s)\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr),
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???");
goto done;
}
if ((ia->ia6_flags & IN6_IFF_TENTATIVE) == 0) {
log(LOG_ERR, "nd6_dad_timer: called with non-tentative address "
"%s(%s)\n",
- ip6_sprintf(&ia->ia_addr.sin6_addr),
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
ifa->ifa_ifp ? if_name(ifa->ifa_ifp) : "???");
goto done;
}
@@ -1288,7 +1298,7 @@ nd6_dad_timer(ifa)
nd6log((LOG_DEBUG,
"%s: DAD complete for %s - no duplicates found\n",
if_name(ifa->ifa_ifp),
- ip6_sprintf(&ia->ia_addr.sin6_addr)));
+ ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr)));
TAILQ_REMOVE(&dadq, (struct dadq *)dp, dad_list);
free(dp, M_IP6NDP);
@@ -1308,6 +1318,7 @@ nd6_dad_duplicated(ifa)
struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa;
struct ifnet *ifp;
struct dadq *dp;
+ char ip6buf[INET6_ADDRSTRLEN];
dp = nd6_dad_find(ifa);
if (dp == NULL) {
@@ -1317,7 +1328,7 @@ nd6_dad_duplicated(ifa)
log(LOG_ERR, "%s: DAD detected duplicate IPv6 address %s: "
"NS in/out=%d/%d, NA in=%d\n",
- if_name(ifa->ifa_ifp), ip6_sprintf(&ia->ia_addr.sin6_addr),
+ if_name(ifa->ifa_ifp), ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr),
dp->dad_ns_icount, dp->dad_ns_ocount, dp->dad_na_icount);
ia->ia6_flags &= ~IN6_IFF_TENTATIVE;
@@ -1328,7 +1339,7 @@ nd6_dad_duplicated(ifa)
ifp = ifa->ifa_ifp;
log(LOG_ERR, "%s: DAD complete for %s - duplicate found\n",
- if_name(ifp), ip6_sprintf(&ia->ia_addr.sin6_addr));
+ if_name(ifp), ip6_sprintf(ip6buf, &ia->ia_addr.sin6_addr));
log(LOG_ERR, "%s: manual intervention required\n",
if_name(ifp));
@@ -1413,9 +1424,10 @@ nd6_dad_ns_input(ifa)
/* Quickhack - completely ignore DAD NS packets */
if (dad_ignore_ns) {
+ char ip6buf[INET6_ADDRSTRLEN];
nd6log((LOG_INFO,
"nd6_dad_ns_input: ignoring DAD NS packet for "
- "address %s(%s)\n", ip6_sprintf(taddr6),
+ "address %s(%s)\n", ip6_sprintf(ip6buf, taddr6),
if_name(ifa->ifa_ifp)));
return;
}
diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c
index 8f05346..ea9eb4b 100644
--- a/sys/netinet6/nd6_rtr.c
+++ b/sys/netinet6/nd6_rtr.c
@@ -125,6 +125,7 @@ nd6_rs_input(m, off, icmp6len)
char *lladdr = NULL;
int lladdrlen = 0;
union nd_opts ndopts;
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
/* If I'm not a router, ignore it. */
if (ip6_accept_rtadv != 0 || ip6_forwarding != 1)
@@ -134,8 +135,8 @@ nd6_rs_input(m, off, icmp6len)
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
"nd6_rs_input: invalid hlim (%d) from %s to %s on %s\n",
- ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp)));
goto bad;
}
@@ -175,7 +176,7 @@ nd6_rs_input(m, off, icmp6len)
nd6log((LOG_INFO,
"nd6_rs_input: lladdrlen mismatch for %s "
"(if %d, RS packet %d)\n",
- ip6_sprintf(&saddr6),
+ ip6_sprintf(ip6bufs, &saddr6),
ifp->if_addrlen, lladdrlen - 2));
goto bad;
}
@@ -211,6 +212,7 @@ nd6_ra_input(m, off, icmp6len)
int mcast = 0;
union nd_opts ndopts;
struct nd_defrouter *dr;
+ char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
/*
* We only accept RAs only when
@@ -225,15 +227,15 @@ nd6_ra_input(m, off, icmp6len)
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
"nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n",
- ip6->ip6_hlim, ip6_sprintf(&ip6->ip6_src),
- ip6_sprintf(&ip6->ip6_dst), if_name(ifp)));
+ ip6->ip6_hlim, ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst), if_name(ifp)));
goto bad;
}
if (!IN6_IS_ADDR_LINKLOCAL(&saddr6)) {
nd6log((LOG_ERR,
"nd6_ra_input: src %s is not link-local\n",
- ip6_sprintf(&saddr6)));
+ ip6_sprintf(ip6bufs, &saddr6)));
goto bad;
}
@@ -325,7 +327,8 @@ nd6_ra_input(m, off, icmp6len)
nd6log((LOG_INFO,
"nd6_ra_input: invalid prefix "
"%s, ignored\n",
- ip6_sprintf(&pi->nd_opt_pi_prefix)));
+ ip6_sprintf(ip6bufs,
+ &pi->nd_opt_pi_prefix)));
continue;
}
@@ -359,7 +362,7 @@ nd6_ra_input(m, off, icmp6len)
if (mtu < IPV6_MMTU) {
nd6log((LOG_INFO, "nd6_ra_input: bogus mtu option "
"mtu=%lu sent from %s, ignoring\n",
- mtu, ip6_sprintf(&ip6->ip6_src)));
+ mtu, ip6_sprintf(ip6bufs, &ip6->ip6_src)));
goto skip;
}
@@ -376,7 +379,7 @@ nd6_ra_input(m, off, icmp6len)
nd6log((LOG_INFO, "nd6_ra_input: bogus mtu "
"mtu=%lu sent from %s; "
"exceeds maxmtu %lu, ignoring\n",
- mtu, ip6_sprintf(&ip6->ip6_src), maxmtu));
+ mtu, ip6_sprintf(ip6bufs, &ip6->ip6_src), maxmtu));
}
}
@@ -397,7 +400,7 @@ nd6_ra_input(m, off, icmp6len)
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
nd6log((LOG_INFO,
"nd6_ra_input: lladdrlen mismatch for %s "
- "(if %d, RA packet %d)\n", ip6_sprintf(&saddr6),
+ "(if %d, RA packet %d)\n", ip6_sprintf(ip6bufs, &saddr6),
ifp->if_addrlen, lladdrlen - 2));
goto bad;
}
@@ -879,6 +882,7 @@ nd6_prelist_add(pr, dr, newp)
struct nd_prefix *new = NULL;
int error = 0;
int i, s;
+ char ip6buf[INET6_ADDRSTRLEN];
new = (struct nd_prefix *)malloc(sizeof(*new), M_IP6NDP, M_NOWAIT);
if (new == NULL)
@@ -918,7 +922,7 @@ nd6_prelist_add(pr, dr, newp)
if ((e = nd6_prefix_onlink(new)) != 0) {
nd6log((LOG_ERR, "nd6_prelist_add: failed to make "
"the prefix %s/%d on-link on %s (errno=%d)\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
+ ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
/* proceed anyway. XXX: is it correct? */
}
@@ -936,6 +940,7 @@ prelist_remove(pr)
{
struct nd_pfxrouter *pfr, *next;
int e, s;
+ char ip6buf[INET6_ADDRSTRLEN];
/* make sure to invalidate the prefix until it is really freed. */
pr->ndpr_vltime = 0;
@@ -951,7 +956,7 @@ prelist_remove(pr)
(e = nd6_prefix_offlink(pr)) != 0) {
nd6log((LOG_ERR, "prelist_remove: failed to make %s/%d offlink "
"on %s, errno=%d\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
+ ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
/* what should we do? */
}
@@ -993,6 +998,7 @@ prelist_update(new, dr, m, mcast)
int newprefix = 0;
int auth;
struct in6_addrlifetime lt6_tmp;
+ char ip6buf[INET6_ADDRSTRLEN];
auth = 0;
if (m) {
@@ -1037,7 +1043,8 @@ prelist_update(new, dr, m, mcast)
"prelist_update: failed to make "
"the prefix %s/%d on-link on %s "
"(errno=%d)\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
+ ip6_sprintf(ip6buf,
+ &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(pr->ndpr_ifp), e));
/* proceed anyway. XXX: is it correct? */
}
@@ -1060,7 +1067,7 @@ prelist_update(new, dr, m, mcast)
nd6log((LOG_NOTICE, "prelist_update: "
"nd6_prelist_add failed for %s/%d on %s "
"errno=%d, returnpr=%p\n",
- ip6_sprintf(&new->ndpr_prefix.sin6_addr),
+ ip6_sprintf(ip6buf, &new->ndpr_prefix.sin6_addr),
new->ndpr_plen, if_name(new->ndpr_ifp),
error, newpr));
goto end; /* we should just give up in this case. */
@@ -1438,6 +1445,7 @@ pfxlist_onlink_check()
*/
for (pr = nd_prefix.lh_first; pr; pr = pr->ndpr_next) {
int e;
+ char ip6buf[INET6_ADDRSTRLEN];
if (IN6_IS_ADDR_LINKLOCAL(&pr->ndpr_prefix.sin6_addr))
continue;
@@ -1451,8 +1459,9 @@ pfxlist_onlink_check()
nd6log((LOG_ERR,
"pfxlist_onlink_check: failed to "
"make %s/%d offlink, errno=%d\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, e));
+ ip6_sprintf(ip6buf,
+ &pr->ndpr_prefix.sin6_addr),
+ pr->ndpr_plen, e));
}
}
if ((pr->ndpr_stateflags & NDPRF_DETACHED) == 0 &&
@@ -1462,8 +1471,9 @@ pfxlist_onlink_check()
nd6log((LOG_ERR,
"pfxlist_onlink_check: failed to "
"make %s/%d onlink, errno=%d\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
- pr->ndpr_plen, e));
+ ip6_sprintf(ip6buf,
+ &pr->ndpr_prefix.sin6_addr),
+ pr->ndpr_plen, e));
}
}
}
@@ -1537,12 +1547,14 @@ nd6_prefix_onlink(pr)
u_long rtflags;
int error = 0;
struct rtentry *rt = NULL;
+ char ip6buf[INET6_ADDRSTRLEN];
/* sanity check */
if ((pr->ndpr_stateflags & NDPRF_ONLINK) != 0) {
nd6log((LOG_ERR,
"nd6_prefix_onlink: %s/%d is already on-link\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen));
+ ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
+ pr->ndpr_plen));
return (EEXIST);
}
@@ -1590,7 +1602,7 @@ nd6_prefix_onlink(pr)
nd6log((LOG_NOTICE,
"nd6_prefix_onlink: failed to find any ifaddr"
" to add route for a prefix(%s/%d) on %s\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
+ ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(ifp)));
return (0);
}
@@ -1619,13 +1631,14 @@ nd6_prefix_onlink(pr)
nd6_rtmsg(RTM_ADD, rt);
pr->ndpr_stateflags |= NDPRF_ONLINK;
} else {
+ char ip6bufg[INET6_ADDRSTRLEN], ip6bufm[INET6_ADDRSTRLEN];
nd6log((LOG_ERR, "nd6_prefix_onlink: failed to add route for a"
" prefix (%s/%d) on %s, gw=%s, mask=%s, flags=%lx "
"errno = %d\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr),
+ ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
pr->ndpr_plen, if_name(ifp),
- ip6_sprintf(&((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr),
- ip6_sprintf(&mask6.sin6_addr), rtflags, error));
+ ip6_sprintf(ip6bufg, &((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr),
+ ip6_sprintf(ip6bufm, &mask6.sin6_addr), rtflags, error));
}
if (rt != NULL) {
@@ -1646,12 +1659,14 @@ nd6_prefix_offlink(pr)
struct nd_prefix *opr;
struct sockaddr_in6 sa6, mask6;
struct rtentry *rt = NULL;
+ char ip6buf[INET6_ADDRSTRLEN];
/* sanity check */
if ((pr->ndpr_stateflags & NDPRF_ONLINK) == 0) {
nd6log((LOG_ERR,
"nd6_prefix_offlink: %s/%d is already off-link\n",
- ip6_sprintf(&pr->ndpr_prefix.sin6_addr), pr->ndpr_plen));
+ ip6_sprintf(ip6buf, &pr->ndpr_prefix.sin6_addr),
+ pr->ndpr_plen));
return (EEXIST);
}
@@ -1704,7 +1719,8 @@ nd6_prefix_offlink(pr)
"nd6_prefix_offlink: failed to "
"recover a prefix %s/%d from %s "
"to %s (errno = %d)\n",
- ip6_sprintf(&opr->ndpr_prefix.sin6_addr),
+ ip6_sprintf(ip6buf,
+ &opr->ndpr_prefix.sin6_addr),
opr->ndpr_plen, if_name(ifp),
if_name(opr->ndpr_ifp), e));
}
@@ -1715,8 +1731,8 @@ nd6_prefix_offlink(pr)
nd6log((LOG_ERR,
"nd6_prefix_offlink: failed to delete route: "
"%s/%d on %s (errno = %d)\n",
- ip6_sprintf(&sa6.sin6_addr), pr->ndpr_plen, if_name(ifp),
- error));
+ ip6_sprintf(ip6buf, &sa6.sin6_addr), pr->ndpr_plen,
+ if_name(ifp), error));
}
if (rt != NULL) {
@@ -1739,6 +1755,7 @@ in6_ifadd(pr, mcast)
struct in6_addr mask;
int prefixlen = pr->ndpr_plen;
int updateflags;
+ char ip6buf[INET6_ADDRSTRLEN];
in6_prefixlen2mask(&mask, prefixlen);
@@ -1826,7 +1843,7 @@ in6_ifadd(pr, mcast)
if (in6ifa_ifpwithaddr(ifp, &ifra.ifra_addr.sin6_addr) != NULL) {
/* this should be rare enough to make an explicit log */
log(LOG_INFO, "in6_ifadd: %s is already configured\n",
- ip6_sprintf(&ifra.ifra_addr.sin6_addr));
+ ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr));
return (NULL);
}
@@ -1842,8 +1859,8 @@ in6_ifadd(pr, mcast)
if ((error = in6_update_ifa(ifp, &ifra, NULL, updateflags)) != 0) {
nd6log((LOG_ERR,
"in6_ifadd: failed to make ifaddr %s on %s (errno=%d)\n",
- ip6_sprintf(&ifra.ifra_addr.sin6_addr), if_name(ifp),
- error));
+ ip6_sprintf(ip6buf, &ifra.ifra_addr.sin6_addr),
+ if_name(ifp), error));
return (NULL); /* ifaddr must not have been allocated. */
}
diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c
index 0594f905..06ef215 100644
--- a/sys/netinet6/scope6.c
+++ b/sys/netinet6/scope6.c
@@ -369,12 +369,13 @@ int
sa6_recoverscope(sin6)
struct sockaddr_in6 *sin6;
{
+ char ip6buf[INET6_ADDRSTRLEN];
u_int32_t zoneid;
if (sin6->sin6_scope_id != 0) {
log(LOG_NOTICE,
"sa6_recoverscope: assumption failure (non 0 ID): %s%%%d\n",
- ip6_sprintf(&sin6->sin6_addr), sin6->sin6_scope_id);
+ ip6_sprintf(ip6buf, &sin6->sin6_addr), sin6->sin6_scope_id);
/* XXX: proceed anyway... */
}
if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr) ||
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index b91f9b6..33cdb59 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -327,13 +327,15 @@ udp6_input(mp, offp, proto)
m->m_pkthdr.rcvif);
if (in6p == NULL) {
if (log_in_vain) {
- char buf[INET6_ADDRSTRLEN];
+ char ip6bufs[INET6_ADDRSTRLEN];
+ char ip6bufd[INET6_ADDRSTRLEN];
- strcpy(buf, ip6_sprintf(&ip6->ip6_dst));
log(LOG_INFO,
"Connection attempt to UDP [%s]:%d from [%s]:%d\n",
- buf, ntohs(uh->uh_dport),
- ip6_sprintf(&ip6->ip6_src), ntohs(uh->uh_sport));
+ ip6_sprintf(ip6bufd, &ip6->ip6_dst),
+ ntohs(uh->uh_dport),
+ ip6_sprintf(ip6bufs, &ip6->ip6_src),
+ ntohs(uh->uh_sport));
}
udpstat.udps_noport++;
if (m->m_flags & M_MCAST) {
diff --git a/sys/netipsec/ipsec.c b/sys/netipsec/ipsec.c
index 834712e..7f604ed 100644
--- a/sys/netipsec/ipsec.c
+++ b/sys/netipsec/ipsec.c
@@ -1832,6 +1832,7 @@ inet_ntoa4(struct in_addr ina)
unsigned char *ucp = (unsigned char *) &ina;
static int i = 3;
+ /* XXX-BZ returns static buffer. */
i = (i + 1) % 4;
sprintf(buf[i], "%d.%d.%d.%d", ucp[0] & 0xff, ucp[1] & 0xff,
ucp[2] & 0xff, ucp[3] & 0xff);
@@ -1842,6 +1843,9 @@ inet_ntoa4(struct in_addr ina)
char *
ipsec_address(union sockaddr_union* sa)
{
+#if INET6
+ char ip6buf[INET6_ADDRSTRLEN];
+#endif
switch (sa->sa.sa_family) {
#ifdef INET
case AF_INET:
@@ -1850,7 +1854,7 @@ ipsec_address(union sockaddr_union* sa)
#ifdef INET6
case AF_INET6:
- return ip6_sprintf(&sa->sin6.sin6_addr);
+ return ip6_sprintf(ip6buf, &sa->sin6.sin6_addr);
#endif /* INET6 */
default:
diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c
index 24bc1c3..ef007ef 100644
--- a/sys/netipsec/ipsec_input.c
+++ b/sys/netipsec/ipsec_input.c
@@ -277,6 +277,11 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,
struct tdb_ident *tdbi;
struct secasindex *saidx;
int error;
+#if INET6
+#ifdef notyet
+ char ip6buf[INET6_ADDRSTRLEN];
+#endif
+#endif
IPSEC_SPLASSERT_SOFTNET(__func__);
@@ -396,7 +401,7 @@ ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,
DPRINTF(("%s: inner source address %s doesn't "
"correspond to expected proxy source %s, "
"SA %s/%08lx\n", __func__,
- ip6_sprintf(&ip6n.ip6_src),
+ ip6_sprintf(ip6buf, &ip6n.ip6_src),
ipsec_address(&saidx->proxy),
ipsec_address(&saidx->dst),
(u_long) ntohl(sav->spi)));
@@ -542,6 +547,9 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int proto
int nxt;
u_int8_t nxt8;
int error, nest;
+#ifdef notyet
+ char ip6buf[INET6_ADDRSTRLEN];
+#endif
IPSEC_ASSERT(m != NULL, ("null mbuf"));
IPSEC_ASSERT(sav != NULL, ("null SA"));
@@ -654,7 +662,7 @@ ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav, int skip, int proto
DPRINTF(("%s: inner source address %s doesn't "
"correspond to expected proxy source %s, "
"SA %s/%08lx\n", __func__,
- ip6_sprintf(&ip6n.ip6_src),
+ ip6_sprintf(ip6buf, &ip6n.ip6_src),
ipsec_address(&saidx->proxy),
ipsec_address(&saidx->dst),
(u_long) ntohl(sav->spi)));
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c
index 4d6391e..5b551f0 100644
--- a/sys/nfsserver/nfs_syscalls.c
+++ b/sys/nfsserver/nfs_syscalls.c
@@ -430,27 +430,31 @@ nfssvc_nfsd(struct thread *td)
port = ntohs(sin->sin_port);
if (port >= IPPORT_RESERVED &&
nd->nd_procnum != NFSPROC_NULL) {
-#if defined(INET6) && defined(KLD_MODULE)
- /* do not use ip6_sprintf: the nfs module should work without INET6 */
- char b6[INET6_ADDRSTRLEN];
-#define ip6_sprintf(a) \
- (sprintf(b6, "%x:%x:%x:%x:%x:%x:%x:%x", \
+#ifdef INET6
+ char b6[INET6_ADDRSTRLEN];
+#if defined(KLD_MODULE)
+ /* Do not use ip6_sprintf: the nfs module should work without INET6. */
+#define ip6_sprintf(buf, a) \
+ (sprintf((buf), "%x:%x:%x:%x:%x:%x:%x:%x", \
(a)->s6_addr16[0], (a)->s6_addr16[1], \
(a)->s6_addr16[2], (a)->s6_addr16[3], \
(a)->s6_addr16[4], (a)->s6_addr16[5], \
(a)->s6_addr16[6], (a)->s6_addr16[7]), \
- b6)
+ (buf))
+#endif
#endif
nd->nd_procnum = NFSPROC_NOOP;
nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK);
cacherep = RC_DOIT;
printf("NFS request from unprivileged port (%s:%d)\n",
#ifdef INET6
- sin->sin_family == AF_INET6 ?
- ip6_sprintf(&satosin6(sin)->sin6_addr) :
+ sin->sin_family == AF_INET6 ?
+ ip6_sprintf(b6, &satosin6(sin)->sin6_addr) :
+#if defined(KLD_MODULE)
#undef ip6_sprintf
#endif
- inet_ntoa(sin->sin_addr), port);
+#endif
+ inet_ntoa(sin->sin_addr), port);
}
}
OpenPOWER on IntegriCloud