Assigning multiple IPs in the same network to an interface

Gleb Smirnoff glebius at FreeBSD.org
Tue Feb 21 11:44:30 UTC 2012


On Sat, Feb 18, 2012 at 05:28:22AM +0000, Li, Qing wrote:
L> Yes, what you are trying to do is allowed and is supported. In fact several bugs 
L> were fixed to support such configuration properly. For example, see these commits:
L> 
L> 	http://svnweb.freebsd.org/base?view=revision&revision=225947
L> 
L> 	http://svnweb.freebsd.org/base?view=revision&revision=225223
L> 
L> I vague remember fixing a bug with this exact description but I am having
L> a bit difficult locating the patch.

btw, the more I look into the code that does supporting this kind of
configuration, the more I think that it should be redesigned.

I have an idea of making a chain of 'struct rtentry' which have the
same radix key. Only top member of chain is active rtentry.

For a normal route, a chain consist of single struct rtentry.

If we have several interfaces sharing a prefix, then we just have more
members in the chain. Each 'struct ifaddr' references its rtentry,
when an ifaddr is being removed, its rtentry is removed too, and in
this case another rtentry can be popped to the top of chain.

Meanwhile this is also going to fix a problem with installing a
prefix when it is already in kernel. Currently, if I run OSPF (quagga)
and receive all my local routes, and they are installed into kernel,
I can't ifconfig an arbitrary interface to a prefix matching one of
my local networks, since this prefix already exist in routing table.

With chained rtentries, we can store both OSPF and static route and
we can introduce sorting in this chain, according to route origin,
or configurable by user.

No code yet been written, just thoughts.

-- 
Totus tuus, Glebius.


More information about the freebsd-net mailing list