diff options
author | David S. Miller <davem@davemloft.net> | 2019-05-22 17:48:44 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-22 17:48:44 -0700 |
commit | e38f7cbd36e4d8ef6c1c56f9643adf8898cb3cb9 (patch) | |
tree | b66942b0d1654d4b0d4b26694fd4cd4b5fb557e7 /net/ipv6/route.c | |
parent | 26b1b8d7f27bfb02cc4d115c48478e02594e318e (diff) | |
parent | 06c77c3e67b0352473345a162ab17729a132e7db (diff) | |
download | lwn-e38f7cbd36e4d8ef6c1c56f9643adf8898cb3cb9.tar.gz lwn-e38f7cbd36e4d8ef6c1c56f9643adf8898cb3cb9.zip |
Merge branch 'net-Export-functions-for-nexthop-code'
David Ahern says:
====================
net: Export functions for nexthop code
This set exports ipv4 and ipv6 fib functions for use by the nexthop
code. It also adds new ones to send route notifications if a nexthop
configuration changes.
v2
- repost of patches dropped at the end of the last dev window
added patch 8 which exports nh_update_mtu since it is inline with
the other patches
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r-- | net/ipv6/route.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 7a014ca877ed..c52a7f49d096 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -5123,6 +5123,38 @@ errout: rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); } +void fib6_rt_update(struct net *net, struct fib6_info *rt, + struct nl_info *info) +{ + u32 seq = info->nlh ? info->nlh->nlmsg_seq : 0; + struct sk_buff *skb; + int err = -ENOBUFS; + + /* call_fib6_entry_notifiers will be removed when in-kernel notifier + * is implemented and supported for nexthop objects + */ + call_fib6_entry_notifiers(net, FIB_EVENT_ENTRY_REPLACE, rt, NULL); + + skb = nlmsg_new(rt6_nlmsg_size(rt), gfp_any()); + if (!skb) + goto errout; + + err = rt6_fill_node(net, skb, rt, NULL, NULL, NULL, 0, + RTM_NEWROUTE, info->portid, seq, NLM_F_REPLACE); + if (err < 0) { + /* -EMSGSIZE implies BUG in rt6_nlmsg_size() */ + WARN_ON(err == -EMSGSIZE); + kfree_skb(skb); + goto errout; + } + rtnl_notify(skb, net, info->portid, RTNLGRP_IPV6_ROUTE, + info->nlh, gfp_any()); + return; +errout: + if (err < 0) + rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err); +} + static int ip6_route_dev_notify(struct notifier_block *this, unsigned long event, void *ptr) { |