range spec support in ifconfig_IF_aliasN
Hiroki Sato
hrs at FreeBSD.org
Sat Jun 15 16:01:30 UTC 2013
Hi all,
Can anyone test the attached patch? It implements range
specification for IPv6 address block like 2001:db8:1::1-5 in rc.conf
$ifconfig* variable. This arises as a feature request repeatedly
(conf/174225, for example).
Adding ipv6_addrs_IF similar to ipv4_addrs_IF is possible, but I
think adding range spec support in ifconfig_IF_alisesN is easier for
users to understand and we should not add new variables which are
specific to an address family. After applying the patch, all of the
following will work:
ifconfig_em0="inet 192.168.0.1" # IPv4 configuration
ifconfig_em0_ipv6="inet6 2001:db8::1/64" # IPv6 configuration
ipv4_addr_em0="10.2.1.1-10" # IPv4 address range spec. Now deprecated.
ifconfig_em0_alias0="inet6 2001:db8:5::1 prefixlen 70" # IPv6 alias.
ifconfig_em0_alias1="inet 10.2.2.1/24" # IPv4 alias with range spec (backward compat).
ifconfig_em0_alias2="10.3.1.1-10/32" # IPv4 alias with range spec.
ifconfig_em0_alias3="inet6 2001:db8:20-2f::1/64" # IPv6 alias with range spec.
# ifconfig_IF_aliases is just like ifconfig_IF_aliasN.
# It can have all of entries in one line.
ifconfig_em0_aliases="inet 10.3.3.201-204/24 inet6 2001:db8:210-213::1/64 inet 10.1.1.1/24"
ipv6_ifconfig_em0_alias0="inet6 2001:db8:f::1/64" # IPv6 alias (backward compat)
ipv6_ifconfig_em0_alias1="2001:db8:f:1::1/64" # IPv6 alias (backward compat)
This example should include all possible combinations of the existing
variables to configure IP aliases. There should be no functional
degradation. The differences are:
1. ifconfig_IF_aliasN supports address range specification.
2. ifconfig_IF_aliases has been added.
I think ipv4_addr_IF should be deprecated in favor of
ifconfig_IF_aliaseN.
The implementation includes re-factoring the alias handing in a
address family independent manner and IPv6 DAD treatment due to
multiple address configurations in a short period. Also, range
specification in IPv6 can generate a lot of addresses, so the number
of expanded address is limited to 31 (set as _IPEXPANDMAX at the top
of network.subr) per entry.
-- Hiroki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: if_aliases_20130616-1.diff
Type: text/x-patch
Size: 26050 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20130616/85a6c8c4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20130616/85a6c8c4/attachment.sig>
More information about the freebsd-rc
mailing list