mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
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
This commit is contained in:
parent
7da240d003
commit
6578fcf3f3
1 changed files with 5 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue