• Ido Schimmel's avatar
    ipv6: fib: Dump tables during registration to FIB chain · e1ee0a5b
    Ido Schimmel authored
    Dump all the FIB tables in each net namespace upon registration to the
    FIB notification chain so that the callee will have a complete view of
    the tables.
    
    The integrity of the dump is ensured by a per-table sequence counter
    that is incremented (under write lock) whenever a route is added or
    deleted from the table.
    
    All the sequence counters are read (under each table's read lock) and
    summed, prior and after the dump. In case the counters differ, then the
    dump is either restarted or the registration fails.
    
    While it's possible for a table to be modified after its counter has
    been read, this isn't really a problem. In case it happened before it
    was read the second time, then the comparison at the end will fail. If
    it happened afterwards, then we're guaranteed to be notified about the
    change, as the notification block is registered prior to the second
    read.
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e1ee0a5b
ip6_fib.c 48.5 KB