Skip to content

Commit

Permalink
IPv4: Extend 'fib_notify_on_flag_change' sysctl
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Amit Cohen authored and davem330 committed Feb 9, 2021
1 parent 36c5100 commit 648106c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Documentation/networking/ip-sysctl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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:

Expand Down
6 changes: 6 additions & 0 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
{ }
};
Expand Down

0 comments on commit 648106c

Please sign in to comment.