On Tue, 4 Dec 2007 14:58:18 +0100
Andreas Henriksson <andreas@fatal.se> wrote:
Fix the bug you mentioned?
/* a valid netmask must be 2^n - 1 (n = 1..31) */
static int is_valid_netmask(const inet_prefix *addr)
{
uint32_t host;
if (addr->family != AF_INET)
return 0;
host = ~ntohl(addr->data[0]);
if (host == 0 || ~host == 0)
return 0;
return (host & (host + 1)) == 0;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html