mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-14 20:31:54 +00:00
87 lines
2.4 KiB
Diff
87 lines
2.4 KiB
Diff
From ce18a6fdff6a39a01111d74f513d2ef66142047c Mon Sep 17 00:00:00 2001
|
|
From: Murat Sezgin <msezgin@codeaurora.org>
|
|
Date: Wed, 5 Aug 2020 13:21:27 -0700
|
|
Subject: [PATCH 246/281] net:ipv6: Fix IPv6 user route change event calls
|
|
|
|
These events should be called only when the route table is
|
|
changed by the userspace. So, we should call them in the
|
|
ioctl and the netlink message handler function.
|
|
|
|
Change-Id: If7ec615014cfc79d5fa72878e49eaf99c2560c32
|
|
Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
|
|
---
|
|
net/ipv6/route.c | 31 +++++++++++++++++++++----------
|
|
1 file changed, 21 insertions(+), 10 deletions(-)
|
|
|
|
--- a/net/ipv6/route.c
|
|
+++ b/net/ipv6/route.c
|
|
@@ -3867,10 +3867,6 @@ int ip6_route_add(struct fib6_config *cf
|
|
return PTR_ERR(rt);
|
|
|
|
err = __ip6_ins_rt(rt, &cfg->fc_nlinfo, extack);
|
|
- if (!err)
|
|
- atomic_notifier_call_chain(&ip6route_chain,
|
|
- RTM_NEWROUTE, rt);
|
|
-
|
|
fib6_info_release(rt);
|
|
|
|
return err;
|
|
@@ -3892,9 +3888,6 @@ static int __ip6_del_rt(struct fib6_info
|
|
err = fib6_del(rt, info);
|
|
spin_unlock_bh(&table->tb6_lock);
|
|
|
|
- if (!err)
|
|
- atomic_notifier_call_chain(&ip6route_chain,
|
|
- RTM_DELROUTE, rt);
|
|
out:
|
|
fib6_info_release(rt);
|
|
return err;
|
|
@@ -4500,6 +4493,10 @@ int ipv6_route_ioctl(struct net *net, un
|
|
break;
|
|
}
|
|
rtnl_unlock();
|
|
+ if (!err)
|
|
+ atomic_notifier_call_chain(&ip6route_chain,
|
|
+ (cmd == SIOCADDRT) ? RTM_NEWROUTE : RTM_DELROUTE, &cfg);
|
|
+
|
|
return err;
|
|
}
|
|
|
|
@@ -5518,11 +5515,17 @@ static int inet6_rtm_delroute(struct sk_
|
|
}
|
|
|
|
if (cfg.fc_mp)
|
|
- return ip6_route_multipath_del(&cfg, extack);
|
|
+ err = ip6_route_multipath_del(&cfg, extack);
|
|
else {
|
|
cfg.fc_delete_all_nh = 1;
|
|
- return ip6_route_del(&cfg, extack);
|
|
+ err = ip6_route_del(&cfg, extack);
|
|
}
|
|
+
|
|
+ if (!err)
|
|
+ atomic_notifier_call_chain(&ip6route_chain,
|
|
+ RTM_DELROUTE, &cfg);
|
|
+
|
|
+ return err;
|
|
}
|
|
|
|
static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
@@ -5539,9 +5542,15 @@ static int inet6_rtm_newroute(struct sk_
|
|
cfg.fc_metric = IP6_RT_PRIO_USER;
|
|
|
|
if (cfg.fc_mp)
|
|
- return ip6_route_multipath_add(&cfg, extack);
|
|
+ err = ip6_route_multipath_add(&cfg, extack);
|
|
else
|
|
- return ip6_route_add(&cfg, GFP_KERNEL, extack);
|
|
+ err = ip6_route_add(&cfg, GFP_KERNEL, extack);
|
|
+
|
|
+ if (!err)
|
|
+ atomic_notifier_call_chain(&ip6route_chain,
|
|
+ RTM_NEWROUTE, &cfg);
|
|
+
|
|
+ return err;
|
|
}
|
|
|
|
/* add the overhead of this fib6_nh to nexthop_len */
|