From 6578fcf3f30e43ee5158cfaae33956ce50f4c5cc Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Wed, 29 Mar 2000 09:31:27 +0000 Subject: [PATCH] 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 --- usr.sbin/ppp/filter.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.sbin/ppp/filter.c b/usr.sbin/ppp/filter.c index 6e6f5f9e5d3..8fca40fc896 100644 --- a/usr.sbin/ppp/filter.c +++ b/usr.sbin/ppp/filter.c @@ -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; }