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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 14 Oct 2008 20:38:10 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Stephen Hemminger <shemminger@...tta.com>
Cc:	Krzysztof Oledzki <ole@....pl>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	netdev@...r.kernel.org
Subject: Re: Error: an inet prefix is expected rather than "0/0".

On Tue, 2008-10-14 at 12:18 -0700, Stephen Hemminger wrote:
> On Tue, 14 Oct 2008 21:15:18 +0200 (CEST)
> Krzysztof Oledzki <ole@....pl> wrote:
> 
> > 
> > 
> > On Tue, 14 Oct 2008, Stephen Hemminger wrote:
[...]
> > > Busted cases:
> > >                           correct           incorrect
> > > Original code: 127.2   =>  127.0.0.2         127.2.0.0
> > > inet_pton:     10.0    =>  10.0.0.0          fails invalid
> > > inet_aton:     10      =>  10.0.0.0          0.0.0.10
> > >
> > > The problem was Alexey (or Jamal) invented their own abbreviation format
> > > and did not follow unix standard conventions.
> > 
> > It seems that the original code followed the unix standard:
> > 
> > # telnet 127.2
> > Trying 127.0.0.2...
> > telnet: connect to address 127.0.0.2: Connection refused
> 
> The incorrect column lists the actual result for each of the routines.
> Original code converted 127.2 to 127.2.0.0
[...]

If only the one-component case needs to be treated specially then you
should be able to use something like:

	/* For backward compatibility, if name is all digits we treat it as
	 * the top 8 bits of an IPv4 address. */
	if (strspn(name, "0123456789") == strlen(name))
		addr->data[0] = atoi(name);
	else if (inet_aton(name, addr->data) > 0)
		;
	else
 		return -1;

But if people also rely on e.g. 192.168/16 working then it gets
trickier.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
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