lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071206115350.18e9204f@freepuppy.rosehill>
Date:	Thu, 6 Dec 2007 11:53:50 -0800
From:	Stephen Hemminger <shemminger@...ux-foundation.org>
To:	Andreas Henriksson <andreas@...al.se>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] iproute2: support dotted-quad netmask notation.

On Tue, 4 Dec 2007 14:58:18 +0100
Andreas Henriksson <andreas@...al.se> wrote:

> Suggested patch for allowing netmask to be specified in dotted quad format.
> See http://bugs.debian.org/357172
> 
> (Known problem: this will not prevent some invalid syntaxes,
> ie. "255.0.255.0" will be treated as "255.255.255.0")
> 
> Comments? Suggestions? Improvements?

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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ