From d904d3edcbb26efc86ea3575bb4265559801a94b Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Thu, 17 Jan 2013 18:43:41 +0100 Subject: 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: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde --- net/can/gw.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'net') diff --git a/net/can/gw.c b/net/can/gw.c index 574dda78eb0f..37a3efb7cc9d 100644 --- a/net/can/gw.c +++ b/net/can/gw.c @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -347,6 +348,13 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data) 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() * -- cgit v1.2.3