diff options
author | bz <bz@FreeBSD.org> | 2006-12-12 12:17:58 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2006-12-12 12:17:58 +0000 |
commit | 297206ec2ac5b34686aaf531476b1b737df9bbd7 (patch) | |
tree | 262eb78fb028423e6796d76401691a45b39b496a /sys/netipsec/ipsec.c | |
parent | dc3e4a0741ba505defdc796a954461de7aa856e3 (diff) | |
download | FreeBSD-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/ipsec.c')
-rw-r--r-- | sys/netipsec/ipsec.c | 6 |
1 files changed, 5 insertions, 1 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: |