Skip to content

Commit

Permalink
ipv4: Only Replay routes of interest to new listeners
Browse files Browse the repository at this point in the history
When a new listener is registered to the FIB notification chain it
receives a dump of all the available routes in the system. Instead, make
sure to only replay the IPv4 routes that are actually used in the data
path and are of any interest to the new listener.

Signed-off-by: Ido Schimmel <[email protected]>
Reviewed-by: David Ahern <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
idosch authored and davem330 committed Dec 17, 2019
1 parent 525bc34 commit 20d1565
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -2080,6 +2080,7 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb,
struct netlink_ext_ack *extack)
{
struct fib_alias *fa;
int last_slen = -1;
int err;

hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) {
Expand All @@ -2099,6 +2100,16 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb,
fa, extack);
if (err)
return err;

if (fa->fa_slen == last_slen)
continue;

last_slen = fa->fa_slen;
err = call_fib_entry_notifier(nb, FIB_EVENT_ENTRY_REPLACE_TMP,
l->key, KEYLENGTH - fa->fa_slen,
fa, extack);
if (err)
return err;
}
return 0;
}
Expand Down

0 comments on commit 20d1565

Please sign in to comment.