]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
mlxsw: spectrum_router: Return an error for non-default FIB rules
authorIdo Schimmel <idosch@mellanox.com>
Wed, 2 May 2018 07:17:34 +0000 (10:17 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 1 Mar 2019 13:21:05 +0000 (14:21 +0100)
BugLink: http://bugs.launchpad.net/bugs/1815234
[ Upstream commit 6290182b2b3bda119ecb243fb3d6bcc98a74344f ]

Since commit 9776d32537d2 ("net: Move call_fib_rule_notifiers up in
fib_nl_newrule") it is possible to forbid the installation of
unsupported FIB rules.

Have mlxsw return an error for non-default FIB rules in addition to the
existing extack message.

Example:
# ip rule add from 198.51.100.1 table 10
Error: mlxsw_spectrum: FIB rules not supported.

Note that offload is only aborted when non-default FIB rules are already
installed and merely replayed during module initialization.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c

index 7e50dbc8282ca27b93ce30e6b61946e88c80402b..1d95ceeed191b557624536a93b424081eb3497ae 100644 (file)
@@ -5756,20 +5756,20 @@ static int mlxsw_sp_router_fib_rule_event(unsigned long event,
        switch (info->family) {
        case AF_INET:
                if (!fib4_rule_default(rule) && !rule->l3mdev)
-                       err = -1;
+                       err = -EOPNOTSUPP;
                break;
        case AF_INET6:
                if (!fib6_rule_default(rule) && !rule->l3mdev)
-                       err = -1;
+                       err = -EOPNOTSUPP;
                break;
        case RTNL_FAMILY_IPMR:
                if (!ipmr_rule_default(rule) && !rule->l3mdev)
-                       err = -1;
+                       err = -EOPNOTSUPP;
                break;
        }
 
        if (err < 0)
-               NL_SET_ERR_MSG(extack, "spectrum: FIB rules not supported. Aborting offload");
+               NL_SET_ERR_MSG_MOD(extack, "FIB rules not supported");
 
        return err;
 }
@@ -5795,8 +5795,8 @@ static int mlxsw_sp_router_fib_event(struct notifier_block *nb,
        case FIB_EVENT_RULE_DEL:
                err = mlxsw_sp_router_fib_rule_event(event, info,
                                                     router->mlxsw_sp);
-               if (!err)
-                       return NOTIFY_DONE;
+               if (!err || info->extack)
+                       return notifier_from_errno(err);
        }
 
        fib_work = kzalloc(sizeof(*fib_work), GFP_ATOMIC);