1. 18 3月, 2018 14 次提交
  2. 17 3月, 2018 14 次提交
  3. 16 3月, 2018 12 次提交
    • 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
    • D
      net/ipv6: Change address check to always take a device argument · 232378e8
      David Ahern 提交于
      ipv6_chk_addr_and_flags determines if an address is a local address and
      optionally if it is an address on a specific device. For example, it is
      called by ip6_route_info_create to determine if a given gateway address
      is a local address. The address check currently does not consider L3
      domains and as a result does not allow a route to be added in one VRF
      if the nexthop points to an address in a second VRF. e.g.,
      
          $ ip route add 2001:db8:1::/64 vrf r2 via 2001:db8:102::23
          Error: Invalid gateway address.
      
      where 2001:db8:102::23 is an address on an interface in vrf r1.
      
      ipv6_chk_addr_and_flags needs to allow callers to always pass in a device
      with a separate argument to not limit the address to the specific device.
      The device is used used to determine the L3 domain of interest.
      
      To that end add an argument to skip the device check and update callers
      to always pass a device where possible and use the new argument to mean
      any address in the domain.
      
      Update a handful of users of ipv6_chk_addr with a NULL dev argument. This
      patch handles the change to these callers without adding the domain check.
      
      ip6_validate_gw needs to handle 2 cases - one where the device is given
      as part of the nexthop spec and the other where the device is resolved.
      There is at least 1 VRF case where deferring the check to only after
      the route lookup has resolved the device fails with an unintuitive error
      "RTNETLINK answers: No route to host" as opposed to the preferred
      "Error: Gateway can not be a local address." The 'no route to host'
      error is because of the fallback to a full lookup. The check is done
      twice to avoid this error.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Reviewed-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      232378e8
    • D
      net/ipv6: Refactor gateway validation on route add · 9fbb704c
      David Ahern 提交于
      Move gateway validation code from ip6_route_info_create into
      ip6_validate_gw. Code move plus adjustments to handle the potential
      reset of dev and idev and to make checkpatch happy.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Reviewed-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9fbb704c
    • D
      Merge branch 'macb-Introduce-phy-handle-DT-functionality' · 1ad2ff02
      David S. Miller 提交于
      Brad Mouring says:
      
      ====================
      net: macb: Introduce phy-handle DT functionality
      
      Consider the situation where a macb netdev is connected through
      a phydev that sits on a mii bus other than the one provided to
      this particular netdev. This situation is what this patchset aims
      to accomplish through the existing phy-handle optional binding.
      
      This optional binding (as described in the ethernet DT bindings doc)
      directs the netdev to the phydev to use. This is precisely the
      situation this patchset aims to solve, so it makes sense to introduce
      the functionality to this driver (where the physical layout discussed
      was encountered).
      
      The devicetree snippet would look something like this:
      
      ...
         ethernet@feedf00d {
                 ...
                 phy-handle = <&phy0> // the first netdev is physically wired to phy0
                 ...
                 phy0: phy@0 {
                         ...
                         reg = <0x0> // MDIO address 0
                         ...
                 }
                 phy1: phy@1 {
                         ...
                         reg = <0x1> // MDIO address 1
                         ...
                 }
                 ...
         }
      
         ethernet@deadbeef {
                 ...
                 phy-handle = <&phy1> // tells the driver to use phy1 on the
                                      // first mac's mdio bus (it's wired thusly)
                 ...
         }
      ...
      
      The work done to add the phy_node in the first place (dacdbb4d:
      "net: macb: add fixed-link node support") will consume the
      device_node (if found).
      
      v2: Reorganization of mii probe/init functions, suggested by Andrew Lunn
      v3: Moved some of the bus init code back into init (erroneously moved to probe)
          some style issues, and an unintialized variable warning addressed.
      v4: Add Reviewed-by: tags
          Skip fallback code if phy-handle phandle is found
      v5: Cleanup formatting issues
          Fix compile failure introduced in 1/4 "net: macb: Reorganize macb_mii
              bringup"
          Fix typo in "Documentation: macb: Document phy-handle binding"
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1ad2ff02
    • B
      Documentation: macb: Document phy-handle binding · f3b249e6
      Brad Mouring 提交于
      Document the existence of the optional binding, directing to the
      general ethernet document that describes this binding.
      Signed-off-by: NBrad Mouring <brad.mouring@ni.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f3b249e6
    • B
      net: macb: Add phy-handle DT support · 2105a5d3
      Brad Mouring 提交于
      This optional binding (as described in the ethernet DT bindings doc)
      directs the netdev to the phydev to use. This is useful for a phy
      chip that has >1 phy in it, and two netdevs are using the same phy
      chip (i.e. the second mac's phy lives on the first mac's MDIO bus)
      
      The devicetree snippet would look something like this:
      
      ethernet@feedf00d {
      	...
      	phy-handle = <&phy0> // the first netdev is physically wired to phy0
      	...
      	phy0: phy@0 {
      		...
      		reg = <0x0> // MDIO address 0
      		...
      	}
      	phy1: phy@1 {
      		...
      		reg = <0x1> // MDIO address 1
      		...
      	}
      ...
      }
      
      ethernet@deadbeef {
      	...
      	phy-handle = <&phy1> // tells the driver to use phy1 on the
      						 // first mac's mdio bus (it's wired thusly)
      	...
      }
      
      The work done to add the phy_node in the first place (dacdbb4d:
      "net: macb: add fixed-link node support") will consume the
      device_node (if found).
      Signed-off-by: NBrad Mouring <brad.mouring@ni.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2105a5d3
    • B
      net: macb: Remove redundant poll irq assignment · cb732e9a
      Brad Mouring 提交于
      In phy_device's general probe, this device will already be set for
      phy register polling, rendering this code redundant.
      Signed-off-by: NBrad Mouring <brad.mouring@ni.com>
      Suggested-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cb732e9a
    • B
      net: macb: Reorganize macb_mii bringup · 739de9a1
      Brad Mouring 提交于
      The macb mii setup (mii_probe() and mii_init()) previously was
      somewhat interspersed, likely a result of organic growth and hacking.
      
      This change moves mii bus registration into mii_init and probing the
      bus for devices into mii_probe.
      Signed-off-by: NBrad Mouring <brad.mouring@ni.com>
      Suggested-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      739de9a1