diff options
author | Julian Anastasov <ja@ssi.bg> | 2011-03-19 08:13:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-22 04:06:33 -0400 |
commit | 2d230e2b2c3111cf4a11619f60dcd158ae84e3ab (patch) | |
tree | 4e665cc5ac43116212b44af1f409ef8a140069ef /net/ipv4/devinet.c | |
parent | e6abbaa2725a43cf5d26c4c2a5dc6c0f6029ea19 (diff) |
ipv4: remove the routes on secondary promotion
The secondary address promotion relies on fib_sync_down_addr
to remove all routes created for the secondary addresses when
the old primary address is deleted. It does not happen for cases
when the primary address is also in another subnet. Fix that
by deleting local and broadcast routes for all secondaries while
they are on device list and by faking that all addresses from
this subnet are to be deleted. It relies on fib_del_ifaddr being
able to ignore the IPs from the concerned subnet while checking
for duplication.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 6d85800daeb7..2523001f4c9a 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -345,6 +345,17 @@ static void __inet_del_ifa(struct in_device *in_dev, struct in_ifaddr **ifap, | |||
345 | } | 345 | } |
346 | } | 346 | } |
347 | 347 | ||
348 | /* On promotion all secondaries from subnet are changing | ||
349 | * the primary IP, we must remove all their routes silently | ||
350 | * and later to add them back with new prefsrc. Do this | ||
351 | * while all addresses are on the device list. | ||
352 | */ | ||
353 | for (ifa = promote; ifa; ifa = ifa->ifa_next) { | ||
354 | if (ifa1->ifa_mask == ifa->ifa_mask && | ||
355 | inet_ifa_match(ifa1->ifa_address, ifa)) | ||
356 | fib_del_ifaddr(ifa, ifa1); | ||
357 | } | ||
358 | |||
348 | /* 2. Unlink it */ | 359 | /* 2. Unlink it */ |
349 | 360 | ||
350 | *ifap = ifa1->ifa_next; | 361 | *ifap = ifa1->ifa_next; |