Subject: Re: /etc/ifaliases, or $ifaliases_ne0
To: Luke Mewburn <lukem@goanna.cs.rmit.edu.au>
From: None <itojun@iijlab.net>
List: tech-userlevel
Date: 11/28/1999 21:57:22
>> 	/etc/netstart can parse /etc/ifaliases and $ifaliases_ifname.
>> 	The parsing code in /etc/netstart is hardcoded to IPv4 (I mean,
>> 	use of "inet").  Isn't it more correct to let user specify the address
>> 	family portion?  I would like to allow "inet6" at least.
>> 	It would be nice if we can say "prefixlen" instead of "netmask".
>> 
>> 	I admit there will be backward compatibility issue in
>> 	$ifaliases_ifname case (because it chops the string into tokens
>> 	and use every two pairs as argument).  Let me know this should be
>> 	modified.  $ifaliases6_ifname is not nice...
>
>how hard is it to determine if it's an ipv6 vs ipv4 address?  i suppose
>that doesn't help you're using names instead of addresses.

	Basically I wouldn't try to determine them in script.
	There may be some other address families as well...

	Also, you are right about FQDN case.  And it gets tricky for
	ifconfig(8) if a FQDN resolves to multiple addresses. 
	Current ifconfig(8) code behaves like this:
	- if we are in "inet" family, it picks the first IPv4 address returned
	  from gethostbyname(3).
	- if we are in "inet6" family, it accepts FQDN only if it resolves to
	  single IPv6 address.  It barks if the FQDN resolves to multiple
	  IPv6 addresses (it doesn't care if the FQDN resolves to any IPv4
	  address, as the user already qualifies the address family to use).
	- if no family is specified we're in "inet" family.
	I believe "inet" case should bark if a FQDN resolves to multiple
	IPv4 address.

>it's a shame that /etc/ifaliases wasn't as flexible as the /etc/ifconfig.XXX
>format.
>how about supporting /etc/ifaliases.XXX, with syntax of
>	family aliasaddress [optional parameters]
>where optional parameters includes netmask, prefixlen, etc...
>that doesn't help on the variable side (e.g $ifalias_XXX). however,
>since you may have a number of aliases per interface, it would make
>it tricky to support a variable number of args *and* multiple aliases
>per interface in the one shell variable, so don't try and support
>extending the $if* syntax in your rework.

	Actually we can have "alias" configuration into /etc/ifconfig.XXX
	(not ifaliases.XXX) like:
		inet 10.0.0.1 netmask 0xffffff00 	<-- first address
		inet 10.0.0.2 netmask 0xffffff00 alias	<-- alias
	so we'd better make the use of /etc/ifaliases obsolete.

itojun