• David Ahern's avatar
    net: Use passed in table for nexthop lookups · 3bfd8472
    David Ahern authored
    If a user passes in a table for new routes use that table for nexthop
    lookups. Specifically, this solves the case where a connected route does
    not exist in the main table, but only another table and then a subsequent
    route is added with a next hop using the connected route. ie.,
    
    $ ip route ls
    default via 10.0.2.2 dev eth0
    10.0.2.0/24 dev eth0  proto kernel  scope link  src 10.0.2.15
    169.254.0.0/16 dev eth0  scope link  metric 1003
    192.168.56.0/24 dev eth1  proto kernel  scope link  src 192.168.56.51
    
    $ ip route ls table 10
    1.1.1.0/24 dev eth2  scope link
    
    Without this patch adding a nexthop route fails:
    
    $ ip route add table 10 2.2.2.0/24 via 1.1.1.10
    RTNETLINK answers: Network is unreachable
    
    With this patch the route is added successfully.
    Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    3bfd8472
fib_semantics.c 35.6 KB