]> git.baikalelectronics.ru Git - kernel.git/commit
mlxsw: spectrum_router: Don't offload routes next in list
authorIdo Schimmel <idosch@mellanox.com>
Fri, 21 Jul 2017 16:04:28 +0000 (18:04 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 24 Jul 2017 21:14:48 +0000 (14:14 -0700)
commit2ef58aec0e9bc905f36b4c832e89d5c84dc481de
treea5a1652953da556fcb364fe4ec3c7f7456e0222b
parentcf7e3ed0c88ff1ae03ee510f98d7899b2d9aecad
mlxsw: spectrum_router: Don't offload routes next in list

Each FIB node holds a linked list of routes sharing the same prefix and
length. In the case of IPv4 it's ordered according to table ID, metric
and TOS and only the first route in the list is actually programmed to
the device.

In case a gatewayed route is added somewhere in the list, then after its
nexthop group will be refreshed and become valid (due to the resolution
of its gateway), it'll mistakenly overwrite the existing entry.

Example:
192.168.200.0/24 dev enp3s0np3 scope link metric 1000 offload
192.168.200.0/24 via 192.168.100.1 dev enp3s0np3 metric 1000 offload

Both routes are marked as offloaded despite the fact only the first one
should actually be present in the device's table.

When refreshing the nexthop group, don't write the route to the device's
table unless it's the first in its node.

Fixes: 0a420820c106 ("mlxsw: spectrum_router: Correctly handle identical routes")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c