From: brian Date: Wed, 29 Mar 2000 09:32:26 +0000 (+0000) Subject: Allow the use of hostnames instead of (and as well as) IP X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4f5e5e878e84342aacec3f7fba9ff9162a15e028;p=openbsd Allow the use of hostnames instead of (and as well as) IP numbers in all commands. If people use hostnames and have dodgy resolvers or try to resolve the hostname before the link is up, they get what they deserve.... Requested by: ru --- diff --git a/usr.sbin/ppp/ppp/filter.c b/usr.sbin/ppp/ppp/filter.c index b37ca51c074..bffcfd8555e 100644 --- a/usr.sbin/ppp/ppp/filter.c +++ b/usr.sbin/ppp/ppp/filter.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: filter.c,v 1.13 2000/03/19 10:33:33 brian Exp $ + * $OpenBSD: filter.c,v 1.14 2000/03/29 09:32:26 brian Exp $ * * TODO: Should send ICMP error message when we discard packets. */ @@ -106,13 +106,14 @@ ParseAddr(struct ipcp *ipcp, const char *data, *paddr = ipcp->ns.dns[0]; else if (ipcp && strncasecmp(data, "DNS1", len) == 0) *paddr = ipcp->ns.dns[1]; - else if (len > 15) - log_Printf(LogWARN, "ParseAddr: %s: Bad address\n", data); else { - char s[16]; + char *s; + + s = (char *)alloca(len + 1); strncpy(s, data, len); s[len] = '\0'; - if (inet_aton(s, paddr) == 0) { + *paddr = GetIpAddr(s); + if (paddr->s_addr == INADDR_ANY || paddr->s_addr == INADDR_NONE) { log_Printf(LogWARN, "ParseAddr: %s: Bad address\n", s); return 0; }