From: stsp Date: Sun, 25 Jun 2017 22:22:06 +0000 (+0000) Subject: Make ifconfig(8) default to prefixlen 128 when setting an IPv6 destination X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=fab2d3df33c9bc48791de9fdd9076c35ad5f9849;p=openbsd Make ifconfig(8) default to prefixlen 128 when setting an IPv6 destination address on a point-to-point interface. Makes it easier to configure IPv6 on interfaces such as gif(4). Specifying 'prefixlen 128' is no longer required. This is consistent with IPv4 where a netmask is not required either. ok mpi@ bluhm@ benno@ --- diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index a9389975739..d99bcb34871 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.344 2017/06/08 19:23:39 tedu Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.345 2017/06/25 22:22:06 stsp Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -803,9 +803,13 @@ nextarg: /* * Aggregatable address architecture defines all prefixes * are 64. So, it is convenient to set prefixlen to 64 if - * it is not specified. + * it is not specified. If we are setting a destination + * address on a point-to-point interface, 128 is required. */ - setifprefixlen("64", 0); + if (setipdst && (flags & IFF_POINTOPOINT)) + setifprefixlen("128", 0); + else + setifprefixlen("64", 0); /* in6_getprefix("64", MASK) if MASK is available here... */ } @@ -1241,6 +1245,7 @@ void setifdstaddr(const char *addr, int param) { setaddr++; + setipdst++; afp->af_getaddr(addr, DSTADDR); }