mlxsw: Fail attempts to use routes with nexthop objects
authorDavid Ahern <dsahern@gmail.com>
Tue, 4 Jun 2019 03:19:53 +0000 (20:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jun 2019 02:26:50 +0000 (19:26 -0700)
Fail attempts to use nexthop objects with routes until support can be
properly added.

Signed-off-by: David Ahern <dsahern@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 4f781358aef1f3120e37c9966d4bb6babc74d116..23f17ea52061960a54e3e2656cca0e933861680c 100644 (file)
@@ -6122,6 +6122,20 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
                                NL_SET_ERR_MSG_MOD(info->extack, "IPv6 gateway with IPv4 route is not supported");
                                return notifier_from_errno(-EINVAL);
                        }
+                       if (fen_info->fi->nh) {
+                               NL_SET_ERR_MSG_MOD(info->extack, "IPv4 route with nexthop objects is not supported");
+                               return notifier_from_errno(-EINVAL);
+                       }
+               } else if (info->family == AF_INET6) {
+                       struct fib6_entry_notifier_info *fen6_info;
+
+                       fen6_info = container_of(info,
+                                                struct fib6_entry_notifier_info,
+                                                info);
+                       if (fen6_info->rt->nh) {
+                               NL_SET_ERR_MSG_MOD(info->extack, "IPv6 route with nexthop objects is not supported");
+                               return notifier_from_errno(-EINVAL);
+                       }
                }
                break;
        }