summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-06-25 19:42:39 +0000
committerRyan Thomas McBride <mcbride@cvs.openbsd.org>2004-06-25 19:42:39 +0000
commita13d35b02784ccf014ed0bffbdafa8923c5f93c6 (patch)
tree49da6ccf4a20676429e737aa332aeb1a2abcef59
parent8fcce6450e9a864014f4e8c0f0c17baecb3820f9 (diff)
Remove HAVE_GETNAMEINFO alternate code. Compiled binary is unchanged.
ok msf@ hshoexer@ itojun@ ho@
-rw-r--r--sbin/isakmpd/udp.c7
-rw-r--r--sbin/isakmpd/util.c62
2 files changed, 2 insertions, 67 deletions
diff --git a/sbin/isakmpd/udp.c b/sbin/isakmpd/udp.c
index 2f3c53fa20f..20c2ce42a88 100644
--- a/sbin/isakmpd/udp.c
+++ b/sbin/isakmpd/udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp.c,v 1.76 2004/06/21 13:09:01 ho Exp $ */
+/* $OpenBSD: udp.c,v 1.77 2004/06/25 19:42:38 mcbride Exp $ */
/* $EOM: udp.c,v 1.57 2001/01/26 10:09:57 niklas Exp $ */
/*
@@ -530,7 +530,6 @@ udp_decode_ids(struct transport *t)
t->vtbl->get_src(t, &src);
t->vtbl->get_dst(t, &dst);
-#ifdef HAVE_GETNAMEINFO
if (getnameinfo(src, sysdep_sa_len(src), idsrc, sizeof idsrc, NULL, 0,
NI_NUMERICHOST) != 0) {
log_print("udp_decode_ids: getnameinfo () failed for 'src'");
@@ -541,10 +540,6 @@ udp_decode_ids(struct transport *t)
log_print("udp_decode_ids: getnameinfo () failed for 'dst'");
strlcpy(iddst, "<error>", 256);
}
-#else
- strlcpy(idsrc, inet_ntoa(src->sin_addr), 256);
- strlcpy(iddst, inet_ntoa(dst->sin_addr), 256);
-#endif /* HAVE_GETNAMEINFO */
snprintf(result, sizeof result, "src: %s dst: %s", idsrc, iddst);
return result;
diff --git a/sbin/isakmpd/util.c b/sbin/isakmpd/util.c
index cfa3f8b4d31..6d15ca201f5 100644
--- a/sbin/isakmpd/util.c
+++ b/sbin/isakmpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.45 2004/06/23 03:01:53 hshoexer Exp $ */
+/* $OpenBSD: util.c,v 1.46 2004/06/25 19:42:38 mcbride Exp $ */
/* $EOM: util.c,v 1.23 2000/11/23 12:22:08 niklas Exp $ */
/*
@@ -242,7 +242,6 @@ hex2raw(char *s, u_int8_t *buf, size_t sz)
int
text2sockaddr(char *address, char *port, struct sockaddr **sa)
{
-#ifdef HAVE_GETNAMEINFO
struct addrinfo *ai, hints;
memset(&hints, 0, sizeof hints);
@@ -264,44 +263,6 @@ text2sockaddr(char *address, char *port, struct sockaddr **sa)
memcpy(*sa, ai->ai_addr, sysdep_sa_len(ai->ai_addr));
freeaddrinfo(ai);
return 0;
-#else
- int af = strchr(address, ':') != NULL ? AF_INET6 : AF_INET;
- size_t sz = af == AF_INET ? sizeof(struct sockaddr_in) :
- sizeof(struct sockaddr_in6);
- long lport;
- struct servent *sp;
- char *ep;
-
- *sa = calloc(1, sz);
- if (!*sa)
- return -1;
-
-#ifndef USE_OLD_SOCKADDR
- (*sa)->sa_len = sz;
-#endif
- (*sa)->sa_family = af;
- if (inet_pton(af, address, sockaddr_addrdata(*sa)) != 1) {
- free(*sa);
- return -1;
- }
- if (!port)
- return 0;
- sp = getservbyname(port, "udp");
- if (!sp) {
- lport = strtol(port, &ep, 10);
- if (ep == port || lport < 0 || lport > (long)USHRT_MAX) {
- free(*sa);
- return -1;
- }
- lport = htons(lport);
- } else
- lport = sp->s_port;
- if ((*sa)->sa_family == AF_INET)
- ((struct sockaddr_in *)*sa)->sin_port = lport;
- else
- ((struct sockaddr_in6 *)*sa)->sin6_port = lport;
- return 0;
-#endif
}
/*
@@ -315,30 +276,9 @@ sockaddr2text(struct sockaddr *sa, char **address, int zflag)
int addrlen, i, j;
long val;
-#ifdef HAVE_GETNAMEINFO
if (getnameinfo(sa, sysdep_sa_len(sa), buf, sizeof buf, 0, 0,
allow_name_lookups ? 0 : NI_NUMERICHOST))
return -1;
-#else
- switch (sa->sa_family) {
- case AF_INET:
- case AF_INET6:
- if (inet_ntop(sa->sa_family, sa->sa_data, buf, NI_MAXHOST - 1)
- == NULL) {
- log_error("sockaddr2text: inet_ntop (%d, %p, %p, %d) "
- "failed", sa->sa_family, sa->sa_data, buf,
- NI_MAXHOST - 1);
- return -1;
- }
- buf[NI_MAXHOST - 1] = '\0';
- break;
-
- default:
- log_print("sockaddr2text: unsupported protocol family %d\n",
- sa->sa_family);
- return -1;
- }
-#endif
if (zflag == 0) {
*address = strdup(buf);