Skip to content

Commit

Permalink
mlxsw: spectrum_router: Relax FIB rule validation
Browse files Browse the repository at this point in the history
Currently, mlxsw does not support policy-based routing (PBR) and
therefore forbids the installation of non-default FIB rules except for
the l3mdev rule which is used for VRFs.

Relax the check to allow the installation of FIB rules that would never
match packets received by the device. Specifically, if the iif is that
of the loopback netdev. This is useful for users that need to redirect
locally generated packets based on FIB rules.

Signed-off-by: Ido Schimmel <[email protected]>
Acked-by: Jiri Pirko <[email protected]>
Tested-by: Alexander Petrovskiy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
idosch authored and davem330 committed Apr 21, 2019
1 parent fa73989 commit 05414dd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
Original file line number Diff line number Diff line change
Expand Up @@ -6050,6 +6050,10 @@ static int mlxsw_sp_router_fib_rule_event(unsigned long event,
fr_info = container_of(info, struct fib_rule_notifier_info, info);
rule = fr_info->rule;

/* Rule only affects locally generated traffic */
if (rule->iifindex == info->net->loopback_dev->ifindex)
return 0;

switch (info->family) {
case AF_INET:
if (!fib4_rule_default(rule) && !rule->l3mdev)
Expand Down

0 comments on commit 05414dd

Please sign in to comment.