History

ipv6: add inet6_rt_del_notify()

Move the body of inet6_rt_notify() to __inet6_rt_notify() and give it the deletion reason. inet6_rt_notify() keeps its prototype, so the route addition path does not change. Add inet6_rt_del_notify() and call it from fib6_del_route(). RTA_DEL_REASON now reaches user space on RTM_DELROUTE for routes the kernel deleted on its own.

Yuyang Huang committed 3 months ago

Commit 09f19ce1 parent 1e6a83a3 files · +19 −5Browse files

Unified · Split

3 files
  1. include/net/ip6_fib.h +2 −0
  2. net/ipv6/ip6_fib.c +1 −1
  3. net/ipv6/route.c +16 −4
include/net/ip6_fib.h+2−0
@@ -533,6 +533,8 @@ static inline void fib6_rt_update(struct net *net, struct fib6_info *rt, · 532 unmodified lines
533#endif533#endif
534void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,534void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
535 unsigned int flags);535 unsigned int flags);
536void inet6_rt_del_notify(struct fib6_info *rt, struct nl_info *info,
537 enum rt_del_reason del_reason);
536 538
537void fib6_age_exceptions(struct fib6_info *rt, struct fib6_gc_args *gc_args,539void fib6_age_exceptions(struct fib6_info *rt, struct fib6_gc_args *gc_args,
538 unsigned long now);540 unsigned long now);
net/ipv6/ip6_fib.c+1−1
@@ -2057,7 +2057,7 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn, · 2056 unmodified lines
2057 call_fib6_entry_notifiers_replace(net, replace_rt);2057 call_fib6_entry_notifiers_replace(net, replace_rt);
2058 }2058 }
2059 if (!info->skip_notify)2059 if (!info->skip_notify)
2060 inet6_rt_notify(RTM_DELROUTE, rt, info, 0);2060 inet6_rt_del_notify(rt, info, del_reason);
2061 2061
2062 fib6_info_release(rt);2062 fib6_info_release(rt);
2063}2063}
net/ipv6/route.c+16−4
@@ -6378,8 +6378,9 @@ errout: · 6377 unmodified lines
6378 return err;6378 return err;
6379}6379}
6380 6380
6381void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,6381static void __inet6_rt_notify(int event, struct fib6_info *rt,
6382 unsigned int nlm_flags)6382 struct nl_info *info, unsigned int nlm_flags,
6383 enum rt_del_reason del_reason)
6383{6384{
6384 struct net *net = info->nl_net;6385 struct net *net = info->nl_net;
6385 struct sk_buff *skb;6386 struct sk_buff *skb;
@@ -6398,8 +6399,7 @@ retry: · 12 unmodified lines
6398 goto errout;6399 goto errout;
6399 6400
6400 err = rt6_fill_node(net, skb, rt, NULL, NULL, NULL, 0,6401 err = rt6_fill_node(net, skb, rt, NULL, NULL, NULL, 0,
6401 event, info->portid, seq, nlm_flags,6402 event, info->portid, seq, nlm_flags, del_reason);
6402 RT_DEL_REASON_UNSPEC);
6403 if (err < 0) {6403 if (err < 0) {
6404 kfree_skb(skb);6404 kfree_skb(skb);
6405 /* -EMSGSIZE implies needed space grew under us. */6405 /* -EMSGSIZE implies needed space grew under us. */
@@ -6420,6 +6420,18 @@ errout: · 14 unmodified lines
6420 rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);6420 rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);
6421}6421}
6422 6422
6423void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
6424 unsigned int nlm_flags)
6425{
6426 __inet6_rt_notify(event, rt, info, nlm_flags, RT_DEL_REASON_UNSPEC);
6427}
6428
6429void inet6_rt_del_notify(struct fib6_info *rt, struct nl_info *info,
6430 enum rt_del_reason del_reason)
6431{
6432 __inet6_rt_notify(RTM_DELROUTE, rt, info, 0, del_reason);
6433}
6434
6423void fib6_rt_update(struct net *net, struct fib6_info *rt,6435void fib6_rt_update(struct net *net, struct fib6_info *rt,
6424 struct nl_info *info)6436 struct nl_info *info)
6425{6437{

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t