* [PATCH net-next] mlxsw: spectrum_router: Do not allow ipv6 gateway with v4 route via replace
@ 2019-04-22 22:42 David Ahern
2019-04-23 5:36 ` Ido Schimmel
0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2019-04-22 22:42 UTC (permalink / raw)
To: davem; +Cc: netdev, idosch, David Ahern
From: David Ahern <dsahern@gmail.com>
mlxsw currently does not support v6 gateways with v4 routes. Commit
19a9d136f198 ("ipv4: Flag fib_info with a fib_nh using IPv6 gateway")
prevents a route from being added, but nothing stops the replace. Add
a catch for it too.
$ ip ro add 172.16.2.0/24 via 10.99.1.2
$ ip ro replace 172.16.2.0/24 via inet6 fe80::202:ff:fe00:b dev swp1s0
Error: mlxsw_spectrum: IPv6 gateway with IPv4 route is not supported.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 34d9053e5cf0..d21b73236971 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -6109,6 +6109,8 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
NL_SET_ERR_MSG_MOD(info->extack, "FIB offload was aborted. Not configuring route");
return notifier_from_errno(-EINVAL);
}
+ /* fall through */
+ case FIB_EVENT_ENTRY_REPLACE:
if (info->family == AF_INET) {
struct fib_entry_notifier_info *fen_info = ptr;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] mlxsw: spectrum_router: Do not allow ipv6 gateway with v4 route via replace
2019-04-22 22:42 [PATCH net-next] mlxsw: spectrum_router: Do not allow ipv6 gateway with v4 route via replace David Ahern
@ 2019-04-23 5:36 ` Ido Schimmel
0 siblings, 0 replies; 2+ messages in thread
From: Ido Schimmel @ 2019-04-23 5:36 UTC (permalink / raw)
To: David Ahern; +Cc: davem, netdev, David Ahern
On Mon, Apr 22, 2019 at 03:42:14PM -0700, David Ahern wrote:
> From: David Ahern <dsahern@gmail.com>
>
> mlxsw currently does not support v6 gateways with v4 routes. Commit
> 19a9d136f198 ("ipv4: Flag fib_info with a fib_nh using IPv6 gateway")
> prevents a route from being added, but nothing stops the replace. Add
> a catch for it too.
> $ ip ro add 172.16.2.0/24 via 10.99.1.2
> $ ip ro replace 172.16.2.0/24 via inet6 fe80::202:ff:fe00:b dev swp1s0
> Error: mlxsw_spectrum: IPv6 gateway with IPv4 route is not supported.
>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
> drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> index 34d9053e5cf0..d21b73236971 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
> @@ -6109,6 +6109,8 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
> NL_SET_ERR_MSG_MOD(info->extack, "FIB offload was aborted. Not configuring route");
> return notifier_from_errno(-EINVAL);
> }
> + /* fall through */
> + case FIB_EVENT_ENTRY_REPLACE:
Good catch!
I think we need to have FIB_EVENT_ENTRY_REPLACE and
FIB_EVENT_ENTRY_APPEND right after FIB_EVENT_ENTRY_ADD. We want to
prevent route replace and append in case of abort and also prevent
replace/append of IPv4 routes with IPv6 nexthop.
> if (info->family == AF_INET) {
> struct fib_entry_notifier_info *fen_info = ptr;
>
> --
> 2.11.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-04-23 5:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 22:42 [PATCH net-next] mlxsw: spectrum_router: Do not allow ipv6 gateway with v4 route via replace David Ahern
2019-04-23 5:36 ` Ido Schimmel
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.