Skip to content
  • David Ahern's avatar
    net: ipv6: put host and anycast routes on device with address · 4832c30d
    David Ahern authored
    
    
    One nagging difference between ipv4 and ipv6 is host routes for ipv6
    addresses are installed using the loopback device or VRF / L3 Master
    device. e.g.,
    
        2001:db8:1::/120 dev veth0 proto kernel metric 256 pref medium
        local 2001:db8:1::1 dev lo table local proto kernel metric 0 pref medium
    
    Using the loopback device is convenient -- necessary for local tx, but
    has some nasty side effects, most notably setting the 'lo' device down
    causes all host routes for all local IPv6 address to be removed from the
    FIB and completely breaks IPv6 networking across all interfaces.
    
    This patch puts FIB entries for IPv6 routes against the device. This
    simplifies the routes in the FIB, for example by making dst->dev and
    rt6i_idev->dev the same (a future patch can look at removing the device
    reference taken for rt6i_idev for FIB entries).
    
    When copies are made on FIB lookups, the cloned route has dst->dev
    set to loopback (or the L3 master device). This is needed for the
    local Tx of packets to local addresses.
    
    With fib entries allocated against the real network device, the addrconf
    code that reinserts host routes on admin up of 'lo' is no longer needed.
    
    Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    4832c30d