]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
IPv6: Extend 'fib_notify_on_flag_change' sysctl
authorAmit Cohen <amcohen@nvidia.com>
Sun, 7 Feb 2021 08:22:53 +0000 (10:22 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Feb 2021 00:47:03 +0000 (16:47 -0800)
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.

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>
Documentation/networking/ip-sysctl.rst
net/ipv6/route.c
net/ipv6/sysctl_net_ipv6.c

index cd0ec577a5b5f87a4ab4c02422f110f8f97739e9..83ff5158005af523f7b7464313a1c7f1f3b3ae05 100644 (file)
@@ -1798,7 +1798,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,
@@ -1815,6 +1815,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:
 
index bc75b705f54b910b322d507edd141e6d135c41ff..1536f4948e86a50b8273573b10a5d8b4d3c5078a 100644 (file)
@@ -6083,6 +6083,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))
index 392ef01e336674005fbbdf1564006c9782cddbf8..263ab43ed06bc964431235df8ff524ce74be5922 100644 (file)
@@ -167,7 +167,7 @@ static struct ctl_table ipv6_table_template[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec_minmax,
                .extra1         = SYSCTL_ZERO,
-               .extra2         = SYSCTL_ONE,
+               .extra2         = &two,
        },
        { }
 };