diff options
author | Oliver Hartkopp <socketcan@hartkopp.net> | 2023-01-25 06:54:07 +0100 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2023-02-02 15:42:10 +0100 |
commit | 2a30b2bd01c23a7eeace3a3f82c2817227099805 (patch) | |
tree | 385ea64e80c3a28b27c29d0136b6e7ede81a256f /net/can/gw.c | |
parent | octeontx2-af: Removed unnecessary debug messages. (diff) | |
download | linux-2a30b2bd01c23a7eeace3a3f82c2817227099805.tar.xz linux-2a30b2bd01c23a7eeace3a3f82c2817227099805.zip |
can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag
To send CAN traffic back to the incoming interface a special flag has to
be set. When creating a routing job for identical interfaces without this
flag the rule is created but has no effect.
This patch adds an error return value in the case that the CAN interfaces
are identical but the CGW_FLAGS_CAN_IIF_TX_OK flag was not set.
Reported-by: Jannik Hartung <jannik.hartung@tu-bs.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20230125055407.2053-1-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/gw.c')
-rw-r--r-- | net/can/gw.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/can/gw.c b/net/can/gw.c index 23a3d89cad81..37528826935e 100644 --- a/net/can/gw.c +++ b/net/can/gw.c @@ -1139,6 +1139,13 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh, if (gwj->dst.dev->type != ARPHRD_CAN) goto out; + /* is sending the skb back to the incoming interface intended? */ + if (gwj->src.dev == gwj->dst.dev && + !(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK)) { + err = -EINVAL; + goto out; + } + ASSERT_RTNL(); err = cgw_register_filter(net, gwj); |