* [PATCH net-next] net: ipv6/l3mdev: Move host route on saved address if necessary
@ 2016-02-27 17:59 David Ahern
2016-03-01 22:23 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2016-02-27 17:59 UTC (permalink / raw)
To: netdev; +Cc: David Ahern
Commit f1705ec197e70 allows IPv6 addresses to be retained on a link down.
The address can have a cached host route which can point to the wrong
FIB table if the L3 enslavement is changed (e.g., route can point to local
table instead of VRF table if device is added to an L3 domain).
On link up check the table of the cached host route against the FIB
table associated with the device and correct if needed.
Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
Normally the 'if CONFIG_NET_L3_MASTER_DEV is enabled' checks are all
done in l3mdev.h. In this case putting the functions in the l3mdev
header requires adding ipv6 header files which blows up compiles.
net/ipv6/addrconf.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a2d6f6c242af..afab4c359b5b 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3170,9 +3170,35 @@ static void addrconf_gre_config(struct net_device *dev)
}
#endif
+#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV)
+/* If the host route is cached on the addr struct make sure it is associated
+ * with the proper table. e.g., enslavement can change and if so the cached
+ * host route needs to move to the new table.
+ */
+static void l3mdev_check_host_rt(struct inet6_dev *idev,
+ struct inet6_ifaddr *ifp)
+{
+ if (ifp->rt) {
+ u32 tb_id = l3mdev_fib_table(idev->dev) ? : RT6_TABLE_LOCAL;
+
+ if (tb_id != ifp->rt->rt6i_table->tb6_id) {
+ ip6_del_rt(ifp->rt);
+ ifp->rt = NULL;
+ }
+ }
+}
+#else
+static void l3mdev_check_host_rt(struct inet6_dev *idev,
+ struct inet6_ifaddr *ifp)
+{
+}
+#endif
+
static int fixup_permanent_addr(struct inet6_dev *idev,
struct inet6_ifaddr *ifp)
{
+ l3mdev_check_host_rt(idev, ifp);
+
if (!ifp->rt) {
struct rt6_info *rt;
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: ipv6/l3mdev: Move host route on saved address if necessary
2016-02-27 17:59 [PATCH net-next] net: ipv6/l3mdev: Move host route on saved address if necessary David Ahern
@ 2016-03-01 22:23 ` David Miller
2016-03-02 1:46 ` David Ahern
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2016-03-01 22:23 UTC (permalink / raw)
To: dsa; +Cc: netdev
From: David Ahern <dsa@cumulusnetworks.com>
Date: Sat, 27 Feb 2016 09:59:17 -0800
> Commit f1705ec197e70 allows IPv6 addresses to be retained on a link down.
> The address can have a cached host route which can point to the wrong
> FIB table if the L3 enslavement is changed (e.g., route can point to local
> table instead of VRF table if device is added to an L3 domain).
>
> On link up check the table of the cached host route against the FIB
> table associated with the device and correct if needed.
>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
Ugly... but applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: ipv6/l3mdev: Move host route on saved address if necessary
2016-03-01 22:23 ` David Miller
@ 2016-03-02 1:46 ` David Ahern
2016-03-03 22:11 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: David Ahern @ 2016-03-02 1:46 UTC (permalink / raw)
To: David Miller; +Cc: netdev
On 3/1/16 2:23 PM, David Miller wrote:
> From: David Ahern <dsa@cumulusnetworks.com>
> Date: Sat, 27 Feb 2016 09:59:17 -0800
>
>> Commit f1705ec197e70 allows IPv6 addresses to be retained on a link down.
>> The address can have a cached host route which can point to the wrong
>> FIB table if the L3 enslavement is changed (e.g., route can point to local
>> table instead of VRF table if device is added to an L3 domain).
>>
>> On link up check the table of the cached host route against the FIB
>> table associated with the device and correct if needed.
>>
>> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
>
> Ugly... but applied, thanks.
>
This is an example of what I meant by complications with the suggestion
of stashing the prefix route. Would you prefer the host route always get
freed on a down and re-created on an up?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: ipv6/l3mdev: Move host route on saved address if necessary
2016-03-02 1:46 ` David Ahern
@ 2016-03-03 22:11 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-03-03 22:11 UTC (permalink / raw)
To: dsa; +Cc: netdev
From: David Ahern <dsa@cumulusnetworks.com>
Date: Tue, 1 Mar 2016 17:46:46 -0800
> Would you prefer the host route always get freed on a down and
> re-created on an up?
That would create yet another thing that can cause the re-up to fail
:-/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-03 22:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-27 17:59 [PATCH net-next] net: ipv6/l3mdev: Move host route on saved address if necessary David Ahern
2016-03-01 22:23 ` David Miller
2016-03-02 1:46 ` David Ahern
2016-03-03 22:11 ` 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).