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
533533 #endif
534534 void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
535535 unsigned int flags);
536+void inet6_rt_del_notify(struct fib6_info *rt, struct nl_info *info,
537+ enum rt_del_reason del_reason);
536538
537539 void fib6_age_exceptions(struct fib6_info *rt, struct fib6_gc_args *gc_args,
538540 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
20572057 call_fib6_entry_notifiers_replace(net, replace_rt);
20582058 }
20592059 if (!info->skip_notify)
2060− inet6_rt_notify(RTM_DELROUTE, rt, info, 0);
2060+ inet6_rt_del_notify(rt, info, del_reason);
20612061
20622062 fib6_info_release(rt);
20632063 }
net/ipv6/route.c+16−4
@@ -6378,8 +6378,9 @@ errout: · 6377 unmodified lines
63786378 return err;
63796379 }
63806380
6381−void inet6_rt_notify(int event, struct fib6_info *rt, struct nl_info *info,
6382− unsigned int nlm_flags)
6381+static void __inet6_rt_notify(int event, struct fib6_info *rt,
6382+ struct nl_info *info, unsigned int nlm_flags,
6383+ enum rt_del_reason del_reason)
63836384 {
63846385 struct net *net = info->nl_net;
63856386 struct sk_buff *skb;
@@ -6398,8 +6399,7 @@ retry: · 12 unmodified lines
63986399 goto errout;
63996400
64006401 err = rt6_fill_node(net, skb, rt, NULL, NULL, NULL, 0,
6401− event, info->portid, seq, nlm_flags,
6402− RT_DEL_REASON_UNSPEC);
6402+ event, info->portid, seq, nlm_flags, del_reason);
64036403 if (err < 0) {
64046404 kfree_skb(skb);
64056405 /* -EMSGSIZE implies needed space grew under us. */
@@ -6420,6 +6420,18 @@ errout: · 14 unmodified lines
64206420 rtnl_set_sk_err(net, RTNLGRP_IPV6_ROUTE, err);
64216421 }
64226422
6423+void 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+
6429+void 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+
64236435 void fib6_rt_update(struct net *net, struct fib6_info *rt,
64246436 struct nl_info *info)
64256437 {

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