All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH can-next] can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag
@ 2023-01-25  5:54 Oliver Hartkopp
  2023-02-02 14:54 ` Marc Kleine-Budde
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Hartkopp @ 2023-01-25  5:54 UTC (permalink / raw)
  To: linux-can; +Cc: Oliver Hartkopp, Jannik Hartung

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>
---
 net/can/gw.c | 7 +++++++
 1 file changed, 7 insertions(+)

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
@@ -1137,10 +1137,17 @@ static int cgw_create_job(struct sk_buff *skb,  struct nlmsghdr *nlh,
 		goto out;
 
 	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);
 	if (!err)
 		hlist_add_head_rcu(&gwj->list, &net->can.cgw_list);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH can-next] can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag
  2023-01-25  5:54 [PATCH can-next] can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag Oliver Hartkopp
@ 2023-02-02 14:54 ` Marc Kleine-Budde
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Kleine-Budde @ 2023-02-02 14:54 UTC (permalink / raw)
  To: Oliver Hartkopp; +Cc: linux-can, Jannik Hartung

[-- Attachment #1: Type: text/plain, Size: 828 bytes --]

On 25.01.2023 06:54:07, Oliver Hartkopp wrote:
> 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>

Applied to can-next.

Thanks,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-02 14:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25  5:54 [PATCH can-next] can: gw: give feedback on missing CGW_FLAGS_CAN_IIF_TX_OK flag Oliver Hartkopp
2023-02-02 14:54 ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.