On Tue, 18 Dec 2001, James R. Leu wrote:
> I think there needs to be a way for an IP interface to remember
> that it has an "addressless" address attached to it. To me if I do:
route without prefsrc from this device ...
> ifconfig eth1 0.0.0.0 up
> ip addr add 10.0.0.1/24 brd + dev eth1
> Then I should have to do:
> ip addr del 10.0.0.1/24 brd + dev eth1
> ip addr del 0.0.0.0 dev eth1
Hm, good idea. I forgot about inet_del_ifa and its flag
destroy. I see that inet_insert_ifa has check for 0.0.0.0. Can
we add similar check in the deletion path, i.e. only del 0.0.0.0 to
call inetdev_destroy. All other inet_del_ifa should not call
inetdev_destroy. The del 0.0.0.0 event should be propagated
somehow. ifconfig dev 0.0.0.0 will not work (only enable) but
ip addr del 0.0.0.0 works in this scheme. It will delete all present
addresses and routes. We will have symmetry when enabling and
disabling IP for interface.
What I don't know is who really relies on the fact that
the last address stops IP. In fact, the no_addr check in
fib_validate_source is enough to stop any incoming IP traffic
from device without addresses and routes. So, may be we have to
check the sending path, whether we break some expectations.
Another thing: may be we can teach fib_sync_down to
release ifa_local 0.0.0.0, i.e. all routes without prefsrc
when the last address is deleted, instead of disabling IP
but it is not very good. If the above way to stop IP
for interface works then fib_inetaddr_event simply will
call the evil 'fib_disable_ip(ifa->ifa_dev->dev, 1);' only
when someone deletes 0.0.0.0 (we will have to check
ifa->ifa_dev->dev->ip_ptr to know when IP is deleted or to
do it for ifa_local 0.0.0.0). And of course, on NETDEV_UNREGISTER.
So, may be we can find a way to officially enable and
disable IP? If such idea sounds good I can go further and to try it.
> (or some equivalent)
> Before IP is completly removed from the interface.
> I'll go back to lurking now.
Julian Anastasov <ja@xxxxxx>