提交 2a30b2bd 编写于 作者: O Oliver Hartkopp 提交者: Marc Kleine-Budde

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: NJannik Hartung <jannik.hartung@tu-bs.de>
Signed-off-by: NOliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20230125055407.2053-1-socketcan@hartkopp.netSigned-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
上级 609aa68d
...@@ -1139,6 +1139,13 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -1139,6 +1139,13 @@ static int cgw_create_job(struct sk_buff *skb, struct nlmsghdr *nlh,
if (gwj->dst.dev->type != ARPHRD_CAN) if (gwj->dst.dev->type != ARPHRD_CAN)
goto out; 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(); ASSERT_RTNL();
err = cgw_register_filter(net, gwj); err = cgw_register_filter(net, gwj);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册