Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d904d3ed authored by Oliver Hartkopp's avatar Oliver Hartkopp Committed by Marc Kleine-Budde
Browse files

can: gw: make routing to the incoming CAN interface configurable



Introduce new configuration flag CGW_FLAGS_CAN_IIF_TX_OK to configure if a
CAN sk_buff that has been routed with can-gw is allowed to be send back to
the originating CAN interface.

Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 156c2bb9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ enum {


#define CGW_FLAGS_CAN_ECHO 0x01
#define CGW_FLAGS_CAN_ECHO 0x01
#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
#define CGW_FLAGS_CAN_IIF_TX_OK 0x04


#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
#define CGW_MOD_FUNCS 4 /* AND OR XOR SET */


+8 −0
Original line number Original line Diff line number Diff line
@@ -52,6 +52,7 @@
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/can.h>
#include <linux/can.h>
#include <linux/can/core.h>
#include <linux/can/core.h>
#include <linux/can/skb.h>
#include <linux/can/gw.h>
#include <linux/can/gw.h>
#include <net/rtnetlink.h>
#include <net/rtnetlink.h>
#include <net/net_namespace.h>
#include <net/net_namespace.h>
@@ -347,6 +348,13 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data)
		return;
		return;
	}
	}


	/* is sending the skb back to the incoming interface not allowed? */
	if (!(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK) &&
	    skb_headroom(skb) == sizeof(struct can_skb_priv) &&
	    (((struct can_skb_priv *)(skb->head))->ifindex ==
	     gwj->dst.dev->ifindex))
		return;

	/*
	/*
	 * clone the given skb, which has not been done in can_rcv()
	 * clone the given skb, which has not been done in can_rcv()
	 *
	 *