Skip to content

Commit 20d1565

Browse files
idoschdavem330
authored andcommitted
ipv4: Only Replay routes of interest to new listeners
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]>
1 parent 525bc34 commit 20d1565

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

net/ipv4/fib_trie.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,7 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb,
20802080
struct netlink_ext_ack *extack)
20812081
{
20822082
struct fib_alias *fa;
2083+
int last_slen = -1;
20832084
int err;
20842085

20852086
hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) {
@@ -2099,6 +2100,16 @@ static int fib_leaf_notify(struct key_vector *l, struct fib_table *tb,
20992100
fa, extack);
21002101
if (err)
21012102
return err;
2103+
2104+
if (fa->fa_slen == last_slen)
2105+
continue;
2106+
2107+
last_slen = fa->fa_slen;
2108+
err = call_fib_entry_notifier(nb, FIB_EVENT_ENTRY_REPLACE_TMP,
2109+
l->key, KEYLENGTH - fa->fa_slen,
2110+
fa, extack);
2111+
if (err)
2112+
return err;
21022113
}
21032114
return 0;
21042115
}

0 commit comments

Comments
 (0)