1. 09 1月, 2018 29 次提交
  2. 08 1月, 2018 11 次提交
    • D
      Merge branch 'ipv6-ipv4-nexthop-align' · f66faae2
      David S. Miller 提交于
      Ido Schimmel says:
      
      ====================
      ipv6: Align nexthop behaviour with IPv4
      
      This set tries to eliminate some differences between IPv4's and IPv6's
      treatment of nexthops. These differences are most likely a side effect
      of IPv6's data structures (specifically 'rt6_info') that incorporate
      both the route and the nexthop and the late addition of ECMP support in
      commit 51ebd318 ("ipv6: add support of equal cost multipath
      (ECMP)").
      
      IPv4 and IPv6 do not react the same to certain netdev events. For
      example, upon carrier change affected IPv4 nexthops are marked using the
      RTNH_F_LINKDOWN flag and the nexthop group is rebalanced accordingly.
      IPv6 on the other hand, does nothing which forces us to perform a
      carrier check during route lookup and dump. This makes it difficult to
      introduce features such as non-equal-cost multipath that are built on
      top of this set [1].
      
      In addition, when a netdev is put administratively down IPv4 nexthops
      are marked using the RTNH_F_DEAD flag, whereas IPv6 simply flushes all
      the routes using these nexthops. To be consistent with IPv4, multipath
      routes should only be flushed when all nexthops in the group are
      considered dead.
      
      The first 12 patches introduce non-functional changes that store the
      RTNH_F_DEAD and RTNH_F_LINKDOWN flags in IPv6 routes based on netdev
      events, in a similar fashion to IPv4. This allows us to remove the
      carrier check performed during route lookup and dump.
      
      The next three patches make sure we only flush a multipath route when
      all of its nexthops are dead.
      
      Last three patches add test cases for IPv4/IPv6 FIB. These verify that
      both address families react similarly to netdev events.
      
      Finally, this series also serves as a good first step towards David
      Ahern's goal of treating nexthops as standalone objects [2], as it makes
      the code more in line with IPv4 where the nexthop and the nexthop group
      are separate objects from the route itself.
      
      1. https://github.com/idosch/linux/tree/ipv6-nexthops
      2. http://vger.kernel.org/netconf2017_files/nexthop-objects.pdf
      
      Changes since RFC (feedback from David Ahern):
      * Remove redundant declaration of rt6_ifdown() in patch 4 and adjust
      comment referencing it accordingly
      * Drop patch to flush multipath routes upon NETDEV_UNREGISTER. Reword
      cover letter accordingly
      * Use a temporary variable to make code more readable in patch 15
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f66faae2
    • I
      selftests: fib_tests: Add test cases for netdev carrier change · 82e45b6f
      Ido Schimmel 提交于
      Check that IPv4 and IPv6 react the same when the carrier of a netdev is
      toggled. Local routes should not be affected by this, whereas unicast
      routes should.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      82e45b6f
    • I
      selftests: fib_tests: Add test cases for netdev down · 5adb7683
      Ido Schimmel 提交于
      Check that IPv4 and IPv6 react the same when a netdev is being put
      administratively down.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5adb7683
    • I
      selftests: fib_tests: Add test cases for IPv4/IPv6 FIB · 607bd2e5
      Ido Schimmel 提交于
      Add test cases to check that IPv4 and IPv6 react to a netdev being
      unregistered as expected.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      607bd2e5
    • I
      ipv6: Flush multipath routes when all siblings are dead · 1de178ed
      Ido Schimmel 提交于
      By default, IPv6 deletes nexthops from a multipath route when the
      nexthop device is put administratively down. This differs from IPv4
      where the nexthops are kept, but marked with the RTNH_F_DEAD flag. A
      multipath route is flushed when all of its nexthops become dead.
      
      Align IPv6 with IPv4 and have it conform to the same guidelines.
      
      In case the multipath route needs to be flushed, its siblings are
      flushed one by one. Otherwise, the nexthops are marked with the
      appropriate flags and the tree walker is instructed to skip all the
      siblings.
      
      As explained in previous patches, care is taken to update the sernum of
      the affected tree nodes, so as to prevent the use of wrong dst entries.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1de178ed
    • I
      ipv6: Take table lock outside of sernum update function · 922c2ac8
      Ido Schimmel 提交于
      The next patch is going to allow dead routes to remain in the FIB tree
      in certain situations.
      
      When this happens we need to be sure to bump the sernum of the nodes
      where these are stored so that potential copies cached in sockets are
      invalidated.
      
      The function that performs this update assumes the table lock is not
      taken when it is invoked, but that will not be the case when it is
      invoked by the tree walker.
      
      Have the function assume the lock is taken and make the single caller
      take the lock itself.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      922c2ac8
    • I
      ipv6: Export sernum update function · 4a8e56ee
      Ido Schimmel 提交于
      We are going to allow dead routes to stay in the FIB tree (e.g., when
      they are part of a multipath route, directly connected route with no
      carrier) and revive them when their nexthop device gains carrier or when
      it is put administratively up.
      
      This is equivalent to the addition of the route to the FIB tree and we
      should therefore take care of updating the sernum of all the parent
      nodes of the node where the route is stored. Otherwise, we risk sockets
      caching and using sub-optimal dst entries.
      
      Export the function that performs the above, so that it could be invoked
      from fib6_ifup() later on.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4a8e56ee
    • I
      ipv6: Teach tree walker to skip multipath routes · b5cb5a75
      Ido Schimmel 提交于
      As explained in previous patch, fib6_ifdown() needs to consider the
      state of all the sibling routes when a multipath route is traversed.
      
      This is done by evaluating all the siblings when the first sibling in a
      multipath route is traversed. If the multipath route does not need to be
      flushed (e.g., not all siblings are dead), then we should just skip the
      multipath route as our work is done.
      
      Have the tree walker jump to the last sibling when it is determined that
      the multipath route needs to be skipped.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b5cb5a75
    • I
      ipv6: Add explicit flush indication to routes · a2c554d3
      Ido Schimmel 提交于
      When routes that are a part of a multipath route are evaluated by
      fib6_ifdown() in response to NETDEV_DOWN and NETDEV_UNREGISTER events
      the state of their sibling routes is not considered.
      
      This will change in subsequent patches in order to align IPv6 with
      IPv4's behavior. For example, when the last sibling in a multipath route
      becomes dead, the entire multipath route needs to be removed.
      
      To prevent the tree walker from re-evaluating all the sibling routes
      each time, we can simply evaluate them once - when the first sibling is
      traversed.
      
      If we determine the entire multipath route needs to be removed, then the
      'should_flush' bit is set in all the siblings, which will cause the
      walker to flush them when it traverses them.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a2c554d3
    • I
      ipv6: Report dead flag during route dump · f9d882ea
      Ido Schimmel 提交于
      Up until now the RTNH_F_DEAD flag was only reported in route dump when
      the 'ignore_routes_with_linkdown' sysctl was set. This is expected as
      dead routes were flushed otherwise.
      
      The reliance on this sysctl is going to be removed, so we need to report
      the flag regardless of the sysctl's value.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f9d882ea
    • I
      ipv6: Ignore dead routes during lookup · 8067bb8c
      Ido Schimmel 提交于
      Currently, dead routes are only present in the routing tables in case
      the 'ignore_routes_with_linkdown' sysctl is set. Otherwise, they are
      flushed.
      
      Subsequent patches are going to remove the reliance on this sysctl and
      make IPv6 more consistent with IPv4.
      
      Before this is done, we need to make sure dead routes are skipped during
      route lookup, so as to not cause packet loss.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8067bb8c