diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-06-18 19:05:51 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-06-18 19:05:51 +0000 |
commit | a525da4b1476c0455345ccc7b72c04edb9d99772 (patch) | |
tree | 2b99db870c7cdd72b2fb66ac3b90bfc944cbe04e /sys | |
parent | 170a550d4aaa0f4a81b5eb0d5f9cf5d132bd3c66 (diff) |
Use ip6_sprintf() rather than the home-cooked inet6_ntoa4()
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_ipsp.c | 28 | ||||
-rw-r--r-- | sys/netinet/ip_ipsp.h | 6 | ||||
-rw-r--r-- | sys/netinet/ipsec_input.c | 6 |
3 files changed, 8 insertions, 32 deletions
diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c index b711ce4c2c2..96e4a307210 100644 --- a/sys/netinet/ip_ipsp.c +++ b/sys/netinet/ip_ipsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.c,v 1.92 2000/06/18 05:54:37 angelos Exp $ */ +/* $OpenBSD: ip_ipsp.c,v 1.93 2000/06/18 19:05:46 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -37,10 +37,6 @@ * PURPOSE. */ -/* - * IPSP Processing - */ - #include <sys/param.h> #include <sys/systm.h> #include <sys/malloc.h> @@ -332,7 +328,7 @@ check_ipsec_policy(struct inpcb *inp, void *daddr) #ifdef INET6 case SENT_IP6: - DPRINTF(("ipsec: send SA request (%d), remote IPv6 address: %s, SA type: %d\n", i + 1, inet6_ntoa4(dst->sen_ip6_dst), sa_require)); + DPRINTF(("ipsec: send SA request (%d), remote IPv6 address: %s, SA type: %d\n", i + 1, ip6_sprintf(dst->sen_ip6_dst), sa_require)); break; #endif /* INET6 */ @@ -1619,22 +1615,6 @@ inet_ntoa4(struct in_addr ina) return (buf[i]); } -#ifdef INET6 -char * -inet6_ntoa4(struct in6_addr ina) -{ - static char buf[4][8 * sizeof "abcd" + 8]; - unsigned char *ucp = (unsigned char *) &ina; - static int i = 3; - - i = (i + 1) % 4; - sprintf(buf[i], "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - ucp[0] & 0xff, ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff, - ucp[4] & 0xff, ucp[5] & 0xff, ucp[6] & 0xff, ucp[7] & 0xff); - return (buf[i]); -} -#endif /* INET6 */ - char * ipsp_address(union sockaddr_union sa) { @@ -1645,7 +1625,7 @@ ipsp_address(union sockaddr_union sa) #if INET6 case AF_INET6: - return inet6_ntoa4(sa.sin6.sin6_addr); + return ip6_sprintf(sa.sin6.sin6_addr); #endif /* INET6 */ default: @@ -2181,7 +2161,7 @@ ipsp_spd_lookup(struct mbuf *m, int af, int hlen, int *error) #ifdef INET6 if (gw->sen_type == SENT_IPSP6) DPRINTF(("ipsp_spd_lookup(): non-existant TDB for SA %s/%08x/%u\n", - inet6_ntoa4(gw->sen_ipsp6_dst), ntohl(gw->sen_ipsp6_spi), + ip6_sprintf(gw->sen_ipsp6_dst), ntohl(gw->sen_ipsp6_spi), gw->sen_ipsp6_sproto)); #endif /* INET6 */ diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h index 4228307df3d..450c18ee2e1 100644 --- a/sys/netinet/ip_ipsp.h +++ b/sys/netinet/ip_ipsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.h,v 1.68 2000/06/18 05:58:46 itojun Exp $ */ +/* $OpenBSD: ip_ipsp.h,v 1.69 2000/06/18 19:05:49 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -447,10 +447,6 @@ extern struct xformsw xformsw[], *xformswNXFORMSW; /* Misc. */ extern char *inet_ntoa4(struct in_addr); -#ifdef INET6 -extern char *inet6_ntoa4(struct in6_addr); -#endif /* INET6 */ - extern char *ipsp_address(union sockaddr_union); /* TDB management routines */ diff --git a/sys/netinet/ipsec_input.c b/sys/netinet/ipsec_input.c index ff0d3c40c7b..9efa20dcc8f 100644 --- a/sys/netinet/ipsec_input.c +++ b/sys/netinet/ipsec_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipsec_input.c,v 1.25 2000/06/18 05:58:46 itojun Exp $ */ +/* $OpenBSD: ipsec_input.c,v 1.26 2000/06/18 19:05:50 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -334,7 +334,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff) ((tdbp->tdb_proxy.sa.sa_family != AF_INET6) && (tdbp->tdb_proxy.sa.sa_family != 0))) { - DPRINTF(("ipsec_common_input_cb(): inner source address %s doesn't correspond to expected proxy source %s, SA %s/%08x\n", inet6_ntoa4(ip6n.ip6_src), ipsp_address(tdbp->tdb_proxy), ipsp_address(tdbp->tdb_dst), ntohl(tdbp->tdb_spi))); + DPRINTF(("ipsec_common_input_cb(): inner source address %s doesn't correspond to expected proxy source %s, SA %s/%08x\n", ip6_sprintf(ip6n.ip6_src), ipsp_address(tdbp->tdb_proxy), ipsp_address(tdbp->tdb_dst), ntohl(tdbp->tdb_spi))); m_freem(m); IPSEC_ISTAT(espstat.esps_pdrops, ahstat.ahs_pdrops); return EACCES; @@ -419,7 +419,7 @@ ipsec_common_input_cb(struct mbuf *m, struct tdb *tdbp, int skip, int protoff) ((tdbp->tdb_proxy.sa.sa_family != AF_INET6) && (tdbp->tdb_proxy.sa.sa_family != 0))) { - DPRINTF(("ipsec_common_input_cb(): inner source address %s doesn't correspond to expected proxy source %s, SA %s/%08x\n", inet6_ntoa4(ip6n.ip6_src), ipsp_address(tdbp->tdb_proxy), ipsp_address(tdbp->tdb_dst), ntohl(tdbp->tdb_spi))); + DPRINTF(("ipsec_common_input_cb(): inner source address %s doesn't correspond to expected proxy source %s, SA %s/%08x\n", ip6_sprintf(ip6n.ip6_src), ipsp_address(tdbp->tdb_proxy), ipsp_address(tdbp->tdb_dst), ntohl(tdbp->tdb_spi))); m_freem(m); IPSEC_ISTAT(espstat.esps_pdrops, ahstat.ahs_pdrops); return EACCES; |