All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 net-next 0/6] net/ipv6: Address checks need to consider the L3 domain
@ 2018-03-13 15:29 David Ahern
  2018-03-13 15:29 ` [PATCH v4 net-next 1/6] net/ipv6: Refactor gateway validation on route add David Ahern
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: David Ahern @ 2018-03-13 15:29 UTC (permalink / raw)
  To: netdev; +Cc: idosch, David Ahern

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

David Ahern (6):
  net/ipv6: Refactor gateway validation on route add
  net/ipv6: Change address check to always take a device argument
  net/ipv6: Add l3mdev check to ipv6_chk_addr_and_flags
  selftests: fib_tests: Use an alias for ip command
  selftests: fib_tests: Allow user to run a specific test
  selftests: fib_tests: Add IPv6 nexthop spec tests

 include/net/addrconf.h                   |   4 +-
 net/ipv6/addrconf.c                      |  26 ++-
 net/ipv6/anycast.c                       |   9 +-
 net/ipv6/datagram.c                      |   5 +-
 net/ipv6/ip6_tunnel.c                    |  12 +-
 net/ipv6/ndisc.c                         |   2 +-
 net/ipv6/route.c                         | 131 ++++++-----
 tools/testing/selftests/net/fib_tests.sh | 359 +++++++++++++++++++++++--------
 8 files changed, 390 insertions(+), 158 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-03-16 15:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 15:29 [PATCH v4 net-next 0/6] net/ipv6: Address checks need to consider the L3 domain David Ahern
2018-03-13 15:29 ` [PATCH v4 net-next 1/6] net/ipv6: Refactor gateway validation on route add David Ahern
2018-03-14 12:21   ` Ido Schimmel
2018-03-13 15:29 ` [PATCH v4 net-next 2/6] net/ipv6: Change address check to always take a device argument David Ahern
2018-03-14 12:22   ` Ido Schimmel
2018-03-13 15:29 ` [PATCH v4 net-next 3/6] net/ipv6: Add l3mdev check to ipv6_chk_addr_and_flags David Ahern
2018-03-14 12:25   ` Ido Schimmel
2018-03-13 15:29 ` [PATCH v4 net-next 4/6] selftests: fib_tests: Use an alias for ip command David Ahern
2018-03-13 15:29 ` [PATCH v4 net-next 5/6] selftests: fib_tests: Allow user to run a specific test David Ahern
2018-03-13 15:29 ` [PATCH v4 net-next 6/6] selftests: fib_tests: Add IPv6 nexthop spec tests David Ahern
2018-03-16 15:29 ` [PATCH v4 net-next 0/6] net/ipv6: Address checks need to consider the L3 domain David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.