]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
IPv4: Extend 'fib_notify_on_flag_change' sysctl
authorAmit Cohen <amcohen@nvidia.com>
Sun, 7 Feb 2021 08:22:51 +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/ipv4/fib_trie.c
net/ipv4/sysctl_net_ipv4.c

index 61a358301f12b2d268d69c13713b3625b14f9ffc..cd0ec577a5b5f87a4ab4c02422f110f8f97739e9 100644 (file)
@@ -180,7 +180,7 @@ min_adv_mss - INTEGER
 
 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,
@@ -197,6 +197,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.
 
 IP Fragmentation:
 
index 80147caa9bfd3d229cb2f9f551e5328145560657..25cf387cca5b2dd2eadd731359e620615910c11d 100644 (file)
@@ -1053,6 +1053,12 @@ void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri)
 
        fa_match->offload = fri->offload;
        fa_match->trap = fri->trap;
+
+       /* 2 means send notifications only if offload_failed was changed. */
+       if (net->ipv4.sysctl_fib_notify_on_flag_change == 2 &&
+           fa_match->offload_failed == fri->offload_failed)
+               goto out;
+
        fa_match->offload_failed = fri->offload_failed;
 
        if (!net->ipv4.sysctl_fib_notify_on_flag_change)
index e5798b3b59d23207a470900deea63065c9445586..f55095d3ed1656fdb8badaed7eb58832c5063299 100644 (file)
@@ -1361,7 +1361,7 @@ static struct ctl_table ipv4_net_table[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec_minmax,
                .extra1         = SYSCTL_ZERO,
-               .extra2         = SYSCTL_ONE,
+               .extra2         = &two,
        },
        { }
 };