Skip to content

Commit

Permalink
can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Oliver Hartkopp <[email protected]>
Link: https://lore.kernel.org/all/[email protected]
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
hartkopp authored and marckleinebudde committed Feb 2, 2023
1 parent 609aa68 commit 2a30b2b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/can/gw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2a30b2b

Please sign in to comment.