]> git.baikalelectronics.ru Git - kernel.git/commit
nexthops: add support for replace
authorDavid Ahern <dsahern@gmail.com>
Sat, 8 Jun 2019 21:53:35 +0000 (14:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Jun 2019 17:44:57 +0000 (10:44 -0700)
commitc315f4b28470482f9156f5e31c587ebb67f622b1
tree3a146690b5c107fd54f6b4caa9b79b395ac2d4be
parent911eec9318edba1a9acf33f337c247aabc7b21e0
nexthops: add support for replace

Add support for atomically upating a nexthop config.

When updating a nexthop, walk the lists of associated fib entries and
verify the new config is valid. Replace is done by swapping nh_info
for single nexthops - new config is applied to old nexthop struct, and
old config is moved to new nexthop struct. For nexthop groups the same
applies but for nh_group. In addition for groups the nh_parent reference
needs to be updated. The old config is released by calling __remove_nexthop
on the 'new' nexthop which now has the old config. This is done to avoid
messing around with the list_heads that track which fib entries are
using the nexthop.

After the swap of config data, bump the sequence counters for FIB entries
to invalidate any dst entries and send notifications to userspace. The
notifications include the new nexthop spec as well as any fib entries
using the updated nexthop struct.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/nexthop.c