summaryrefslogtreecommitdiff
path: root/sbin/ifconfig
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/ifconfig')
-rw-r--r--sbin/ifconfig/ifconfig.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c
index 693144fa77b..09e729dc0d3 100644
--- a/sbin/ifconfig/ifconfig.c
+++ b/sbin/ifconfig/ifconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ifconfig.c,v 1.306 2015/11/23 17:53:52 mpi Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.307 2015/11/25 10:52:25 mpi Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
@@ -789,7 +789,6 @@ nextarg:
* it is not specified.
*/
setifprefixlen("64", 0);
- /* in6_getprefix("64", MASK) if MASK is available here... */
}
if (clearaddr) {
@@ -1138,11 +1137,14 @@ setifaddr(const char *addr, int param)
* and the flags may change when the address is set.
*/
setaddr++;
- if (doalias >= 0)
+ if (doalias >= 0) {
newaddr = 1;
- if (doalias == 0)
+ afp->af_getaddr(addr, ADDR);
+ }
+ if (doalias == 0) {
clearaddr = 1;
- afp->af_getaddr(addr, (doalias >= 0 ? ADDR : RIDADDR));
+ afp->af_getaddr(addr, RIDADDR);
+ }
}
#ifndef SMALL
@@ -4885,7 +4887,7 @@ in_getaddr(const char *s, int which)
if (which != MASK)
sin->sin_family = AF_INET;
- if (which == ADDR && strrchr(s, '/') != NULL &&
+ if (which != MASK && strrchr(s, '/') != NULL &&
(bits = inet_net_pton(AF_INET, s, &tsin.sin_addr,
sizeof(tsin.sin_addr))) != -1) {
l = snprintf(p, sizeof(p), "%d", bits);
@@ -5005,7 +5007,7 @@ in6_getaddr(const char *s, int which)
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_DGRAM; /*dummy*/
- if (which == ADDR && strchr(s, '/') != NULL) {
+ if (which != MASK && strchr(s, '/') != NULL) {
if (strlcpy(buf, s, sizeof(buf)) >= sizeof(buf))
errx(1, "%s: bad value", s);
pfxlen = strchr(buf, '/');