Re: [PATCH] iproute2: support dotted-quad netmask notation.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stephen Hemminger
Date: Thursday, December 6, 2007 - 12:53 pm

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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] iproute2: support dotted-quad netmask notation., Andreas Henriksson, (Tue Dec 4, 6:58 am)
Re: [PATCH] iproute2: support dotted-quad netmask notation., Stephen Hemminger, (Thu Dec 6, 12:53 pm)
Re: [PATCH] iproute2: support dotted-quad netmask notation., Andreas Henriksson, (Fri Dec 7, 4:41 pm)
Re: [PATCH] iproute2: support dotted-quad netmask notation., Andreas Henriksson, (Sun Dec 9, 10:10 am)
Re: [PATCH] iproute2: support dotted-quad netmask notation., Stephen Hemminger, (Tue Dec 11, 6:14 pm)
Re: [PATCH] iproute2: support dotted-quad netmask notation., Andreas Henriksson, (Wed Dec 12, 4:55 am)
Re: [PATCH] iproute2: support dotted-quad netmask notation., Stephen Hemminger, (Wed Dec 12, 9:40 am)