BACKPORT: IPv6: Extend 'fib_notify_on_flag_change' sysctl

Add the value '2' to 'fib_notify_on_flag_change' to allow sending
notifications only for failed route installation.

Separate value is added for such notifications because there are less of
them, so they do not impact performance and some users will find them more
important.

Change-Id: Ib68e37314e962fca24eb894befb2152babaa3740
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Amit Cohen
2021-02-07 10:22:53 +02:00
committed by Thomas Turner
parent 8872c4f273
commit c18991a941
3 changed files with 9 additions and 2 deletions

View File

@ -1515,7 +1515,7 @@ nexthop_compat_mode - BOOLEAN
fib_notify_on_flag_change - INTEGER
Whether to emit RTM_NEWROUTE notifications whenever RTM_F_OFFLOAD/
RTM_F_TRAP flags are changed.
RTM_F_TRAP/RTM_F_OFFLOAD_FAILED flags are changed.
After installing a route to the kernel, user space receives an
acknowledgment, which means the route was installed in the kernel,
@ -1532,6 +1532,7 @@ fib_notify_on_flag_change - INTEGER
- 0 - Do not emit notifications.
- 1 - Emit notifications.
- 2 - Emit notifications only for RTM_F_OFFLOAD_FAILED flag change.
IPv6 Fragmentation:

View File

@ -6140,6 +6140,12 @@ void fib6_info_hw_flags_set(struct net *net, struct fib6_info *f6i,
f6i->offload = offload;
f6i->trap = trap;
/* 2 means send notifications only if offload_failed was changed. */
if (net->ipv6.sysctl.fib_notify_on_flag_change == 2 &&
f6i->offload_failed == offload_failed)
return;
f6i->offload_failed = offload_failed;
if (!rcu_access_pointer(f6i->fib6_node))

View File

@ -166,7 +166,7 @@ static struct ctl_table ipv6_table_template[] = {
.mode = 0644,
.proc_handler = proc_dointvec_minmax,
.extra1 = &zero,
.extra2 = &one,
.extra2 = &two,
},
{ }
};