summaryrefslogtreecommitdiff
path: root/sbin/ifconfig/ifconfig.c
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2011-05-26 13:10:12 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2011-05-26 13:10:12 +0000
commitd06e536f7f8822a8b040747b57b6105e80ec84b8 (patch)
tree53536006604c97a78bc2ec88bb9be050247d02c2 /sbin/ifconfig/ifconfig.c
parentb725a072014653e609ba2fa74c4aee6efcca79bc (diff)
Don't provide an af hint to getaddrinfo in settunnel(), this function
already checks that families of source and destination addresses match and that's all we need. This allows "ifconfig foo tunnel 1::1 2::2" syntax rather than requiring "ifconfig foo inet6 tunnel 1::1 2::2", which in turn allows hostname.if files to create an IPv4-in-IPv6 tunnel without games with shell escapes. ok dcoppa@, seems ok todd@, "Yes, yes and yes" claudio@
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r--sbin/ifconfig/ifconfig.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 52a0b66149f..b8e1e8fa362 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.246 2011/03/23 18:36:41 jsg Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.247 2011/05/26 13:10:11 sthen Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -3155,19 +3155,15 @@ in6_status(int force)
void
settunnel(const char *src, const char *dst)
{
- struct addrinfo hints, *srcres, *dstres;
+ struct addrinfo *srcres, *dstres;
int ecode;
struct if_laddrreq req;
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = afp->af_af;
- hints.ai_socktype = SOCK_DGRAM; /*dummy*/
-
- if ((ecode = getaddrinfo(src, NULL, &hints, &srcres)) != 0)
+ if ((ecode = getaddrinfo(src, NULL, NULL, &srcres)) != 0)
errx(1, "error in parsing address string: %s",
gai_strerror(ecode));
- if ((ecode = getaddrinfo(dst, NULL, &hints, &dstres)) != 0)
+ if ((ecode = getaddrinfo(dst, NULL, NULL, &dstres)) != 0)
errx(1, "error in parsing address string: %s",
gai_strerror(ecode));