• David Ahern's avatar
    nexthops: add support for replace · 7bf4796d
    David Ahern authored
    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: default avatarDavid Ahern <dsahern@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7bf4796d
nexthop.c 40.1 KB