1. 18 3月, 2018 21 次提交
  2. 17 3月, 2018 14 次提交
  3. 16 3月, 2018 5 次提交
    • D
      Merge branch 'net-ipv6-Address-checks-need-to-consider-the-L3-domain' · 859844e5
      David S. Miller 提交于
      David Ahern says:
      
      ====================
      net/ipv6: Address checks need to consider the L3 domain
      
      IPv6 prohibits a local address from being used as a gateway for a route.
      However, it is ok for the gateway to be a local address in a different L3
      domain (e.g., VRF). This allows, for example, veth pairs to connect VRFs.
      
      ip6_route_info_create calls ipv6_chk_addr_and_flags for gateway addresses
      to determine if the address is a local one, but ipv6_chk_addr_and_flags
      does not currently consider L3 domains. As a result routes can not be
      added in one VRF with a nexthop that points to a local address in a
      second VRF.
      
      Resolve by comparing the l3mdev for the passed in device and requiring an
      l3mdev match with the device containing an address. The intent of checking
      for an address on the specified device versus any device in the domain is
      mantained by a new argument to skip the check between the passed in device
      and the device with the address.
      
      Patch 1 moves the gateway validation from ip6_route_info_create into a
      helper; the function is long enough and refactoring drops the indent
      level.
      
      Patch 2 adds a skip_dev_check argument to ipv6_chk_addr_and_flags to
      allow a device to always be passed yet skip the device check when
      looking at addresses and fixes up a few ipv6_chk_addr callers that
      pass a NULL device.
      
      Patch 3 adds l3mdev checks to ipv6_chk_addr_and_flags.
      
      Patches 4 and 5 do some refactoring to the fib_tests script and then
      patch 6 adds nexthop validation tests.
      
      v4
      - separated l3mdev check into a separate patch (patch 3 of this set)
        as suggested by Kirill
      - consolidated dev and ipv6_chk_addr_and_flags call into 1 if (Kirill)
      - added a temp variable for gw type (Kirill)
      
      v3
      - set skip_dev_check in ipv6_chk_addr based on dev == NULL (per
        comment from Ido)
      
      v2
      - handle 2 variations of route spec with sane error path
      - add test cases
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      859844e5
    • D
      selftests: fib_tests: Add IPv6 nexthop spec tests · 654d3a78
      David Ahern 提交于
      Add series of tests for valid and invalid nexthop specs for IPv6.
      
      $ TEST=fib_nexthop_test ./fib_tests.sh
      ...
      IPv6 nexthop tests
          TEST: Directly connected nexthop, unicast address              [ OK ]
          TEST: Directly connected nexthop, unicast address with device  [ OK ]
          TEST: Gateway is linklocal address                             [ OK ]
          TEST: Gateway is linklocal address, no device                  [ OK ]
          TEST: Gateway can not be local unicast address                 [ OK ]
          TEST: Gateway can not be local unicast address, with device    [ OK ]
          TEST: Gateway can not be a local linklocal address             [ OK ]
          TEST: Gateway can be local address in a VRF                    [ OK ]
          TEST: Gateway can be local address in a VRF, with device       [ OK ]
          TEST: Gateway can be local linklocal address in a VRF          [ OK ]
          TEST: Redirect to VRF lookup                                   [ OK ]
          TEST: VRF route, gateway can be local address in default VRF   [ OK ]
          TEST: VRF route, gateway can not be a local address            [ OK ]
          TEST: VRF route, gateway can not be a local addr with device   [ OK ]
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      654d3a78
    • D
      selftests: fib_tests: Allow user to run a specific test · a511858c
      David Ahern 提交于
      Allow a user to run just a specific fib test by setting the TEST
      environment variable.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a511858c
    • D
      selftests: fib_tests: Use an alias for ip command · 171a4871
      David Ahern 提交于
      Replace 'ip -netns testns' with the alias IP. Shortens the line lengths
      and makes running the commands manually a bit easier.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      171a4871
    • D
      net/ipv6: Add l3mdev check to ipv6_chk_addr_and_flags · 1893ff20
      David Ahern 提交于
      Lookup the L3 master device for the passed in device. Only consider
      addresses on netdev's with the same master device. If the device is
      not enslaved or is NULL, then the l3mdev is NULL which means only
      devices not enslaved (ie, in the default domain) are considered.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Reviewed-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1893ff20