• D
    ipv4: Fallback to FIB local table in __ip_dev_find(). · 406b6f97
    David S. Miller 提交于
    In commit 9435eb1c
    ("ipv4: Implement __ip_dev_find using new interface address hash.")
    we reimplemented __ip_dev_find() so that it doesn't have to
    do a full FIB table lookup.
    
    Instead, it consults a hash table of addresses configured to
    interfaces.
    
    This works identically to the old code in all except one case,
    and that is for loopback subnets.
    
    The old code would match the loopback device for any IP address
    that falls within a subnet configured to the loopback device.
    
    Handle this corner case by doing the FIB lookup.
    
    We could implement this via inet_addr_onlink() but:
    
    1) Someone could configure many addresses to loopback and
       inet_addr_onlink() is a simple list traversal.
    
    2) We know the old code works.
    Reported-by: NJulian Anastasov <ja@ssi.bg>
    Acked-by: NStephen Hemminger <shemminger@vyatta.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    406b6f97
devinet.c 43.6 KB