Re: Error: an inet prefix is expected rather than "0/0".

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Stephen Hemminger <shemminger@...>
Cc: Krzysztof Oledzki <ole@...>, Herbert Xu <herbert@...>, <netdev@...>
Date: Tuesday, October 14, 2008 - 3:38 pm

On Tue, 2008-10-14 at 12:18 -0700, Stephen Hemminger wrote:
[...]
[...]

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@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:
Error: an inet prefix is expected rather than "0/0"., Krzysztof Oledzki, (Wed Oct 8, 5:05 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Krzysztof Oledzki, (Wed Oct 8, 5:32 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Stephen Hemminger, (Tue Oct 14, 1:46 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Krzysztof Halasa, (Wed Oct 15, 11:35 am)
Re: Error: an inet prefix is expected rather than "0/0"., Ben Hutchings, (Wed Oct 15, 12:07 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Krzysztof Halasa, (Wed Oct 15, 2:52 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Stephen Hemminger, (Mon Oct 27, 1:39 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Patrick McHardy, (Tue Oct 14, 5:52 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Patrick McHardy, (Tue Oct 14, 5:54 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Krzysztof Oledzki, (Tue Oct 14, 3:15 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Stephen Hemminger, (Tue Oct 14, 3:18 pm)
Re: Error: an inet prefix is expected rather than "0/0"., Ben Hutchings, (Tue Oct 14, 3:38 pm)