netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 3/4] ipv4: remove the routes on secondary promotion
@ 2011-03-19 22:13 Julian Anastasov
  2011-03-22  8:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Julian Anastasov @ 2011-03-19 22:13 UTC (permalink / raw)
  To: netdev; +Cc: David Miller

	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>
---
 net/ipv4/devinet.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff -urp net-next-2.6-bef55ae/linux/net/ipv4/devinet.c linux/net/ipv4/devinet.c
--- net-next-2.6-bef55ae/linux/net/ipv4/devinet.c	2011-03-13 01:08:55.000000000 +0200
+++ linux/net/ipv4/devinet.c	2011-03-16 10:54:42.669192601 +0200
@@ -345,6 +345,17 @@ static void __inet_del_ifa(struct in_dev
 		}
 	}
 
+	/* On promotion all secondaries from subnet are changing
+	 * the primary IP, we must remove all their routes silently
+	 * and later to add them back with new prefsrc. Do this
+	 * while all addresses are on the device list.
+	 */
+	for (ifa = promote; ifa; ifa = ifa->ifa_next) {
+		if (ifa1->ifa_mask == ifa->ifa_mask &&
+		    inet_ifa_match(ifa1->ifa_address, ifa))
+			fib_del_ifaddr(ifa, ifa1);
+	}
+
 	/* 2. Unlink it */
 
 	*ifap = ifa1->ifa_next;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 3/4] ipv4: remove the routes on secondary promotion
  2011-03-19 22:13 [PATCH v2 3/4] ipv4: remove the routes on secondary promotion Julian Anastasov
@ 2011-03-22  8:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-03-22  8:07 UTC (permalink / raw)
  To: ja; +Cc: netdev

From: Julian Anastasov <ja@ssi.bg>
Date: Sun, 20 Mar 2011 00:13:52 +0200

> 	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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-22  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-19 22:13 [PATCH v2 3/4] ipv4: remove the routes on secondary promotion Julian Anastasov
2011-03-22  8:07 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).