• David S. Miller's avatar
    ipv4: Cache source address in nexthop entries. · 1fc050a1
    David S. Miller authored
    When doing output route lookups, we have to select the source address
    if the user has not specified an explicit one.
    
    First, if the route has an explicit preferred source address
    specified, then we use that.
    
    Otherwise we search the route's outgoing interface for a suitable
    address.
    
    This search can be precomputed and cached at route insertion time.
    
    The only missing part is that we have to refresh this precomputed
    value any time addresses are added or removed from the interface, and
    this is accomplished by fib_update_nh_saddrs().
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    1fc050a1
fib_frontend.c 23.8 KB