mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-13 03:41:54 +00:00
89 lines
2.6 KiB
Diff
89 lines
2.6 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(-)
|
|
|
|
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
|
|
index df82117..4fb8247 100644
|
|
--- a/net/ipv6/route.c
|
|
+++ b/net/ipv6/route.c
|
|
@@ -3868,10 +3868,6 @@ int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
|
|
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;
|
|
@@ -3893,9 +3889,6 @@ static int __ip6_del_rt(struct fib6_info *rt, struct nl_info *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;
|
|
@@ -4501,6 +4494,10 @@ int ipv6_route_ioctl(struct net *net, unsigned int cmd, struct in6_rtmsg *rtmsg)
|
|
break;
|
|
}
|
|
rtnl_unlock();
|
|
+ if (!err)
|
|
+ atomic_notifier_call_chain(&ip6route_chain,
|
|
+ (cmd == SIOCADDRT) ? RTM_NEWROUTE : RTM_DELROUTE, &cfg);
|
|
+
|
|
return err;
|
|
}
|
|
|
|
@@ -5528,11 +5525,17 @@ static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
}
|
|
|
|
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,
|
|
@@ -5549,9 +5552,15 @@ static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
|
|
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 */
|