summaryrefslogtreecommitdiffstats
path: root/sys/netipsec
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/netipsec
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/netipsec')
-rw-r--r--sys/netipsec/ipsec.c6
-rw-r--r--sys/netipsec/ipsec_input.c12
2 files changed, 15 insertions, 3 deletions
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)));
OpenPOWER on IntegriCloud