forgot the case to avoid
# ifconfig vether0 netmask google.com

Index: ifconfig.c
===================================================================
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.226
diff -u -p -r1.226 ifconfig.c
--- ifconfig.c  14 Dec 2009 17:22:58 -0000      1.226
+++ ifconfig.c  19 Dec 2009 15:36:56 -0000
@@ -4438,10 +4438,10 @@ in_getaddr(const char *s, int which)
                in_getprefix(p, MASK);
                memcpy(&sin->sin_addr, &tsin.sin_addr, sizeof(sin->sin_addr));
        } else if (inet_aton(s, &sin->sin_addr) == 0) {
-               if ((hp = gethostbyname(s)))
-                       memcpy(&sin->sin_addr, hp->h_addr, hp->h_length);
-               else if ((np = getnetbyname(s)))
+               if (which == MASK && (np = getnetbyname(s)))
                        sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY);
+               else if (which != MASK && (hp = gethostbyname2(s, AF_INET)))
+                       memcpy(&sin->sin_addr, hp->h_addr, hp->h_length);
                else
                        errx(1, "%s: bad value", s);
        }

Reply via email to