Commit c0d46405 authored by Bernd Eckenfels's avatar Bernd Eckenfels

Show symbolic default only for 0.0.0.0/0 (which fixes Suse Bug#821077)

parent 0348310b
......@@ -159,20 +159,30 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *sin,
#ifdef DEBUG
fprintf (stderr, "rresolve: %08lx, mask %08x, num %08x \n", ad, netmask, numeric);
#endif
// if no symbolic names are requested we shortcut with ntoa
if (numeric & 0x0FFF) {
safe_strncpy(name, inet_ntoa(sin->sin_addr), len);
return (0);
}
// we skip getnetbyaddr for 0.0.0.0/0 and 0.0.0.0/~0
if (ad == INADDR_ANY) {
if ((numeric & 0x0FFF) == 0) {
if (netmask == INADDR_ANY) {
// for 0.0.0.0/0 we hardcode symbolic name
if (numeric & 0x8000)
safe_strncpy(name, "default", len);
else
safe_strncpy(name, "*", len);
return (0);
} else {
// for 0.0.0.0/1 we skip getnetbyname()
safe_strncpy(name, "0.0.0.0", len);
return (0);
}
}
if (numeric & 0x0FFF) {
safe_strncpy(name, inet_ntoa(sin->sin_addr), len);
return (0);
}
// it is a host address if flagged or any host bits set
if ((ad & (~netmask)) != 0 || (numeric & 0x4000))
host = 1;
#if 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment