aboutsummaryrefslogtreecommitdiffstats
path: root/net/can/gw.c
diff options
context:
space:
mode:
authorOliver Hartkopp <socketcan@hartkopp.net>2013-01-17 12:43:41 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2013-01-26 10:59:01 -0500
commitd904d3edcbb26efc86ea3575bb4265559801a94b (patch)
tree3589f467d029ea18c1740841ba5dd12323bc3b7a /net/can/gw.c
parent156c2bb9f88065c8da78814f98fde665a5cbb527 (diff)
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 <socketcan@hartkopp.net> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'net/can/gw.c')
-rw-r--r--net/can/gw.c8
1 files changed, 8 insertions, 0 deletions
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 @@
52#include <linux/skbuff.h> 52#include <linux/skbuff.h>
53#include <linux/can.h> 53#include <linux/can.h>
54#include <linux/can/core.h> 54#include <linux/can/core.h>
55#include <linux/can/skb.h>
55#include <linux/can/gw.h> 56#include <linux/can/gw.h>
56#include <net/rtnetlink.h> 57#include <net/rtnetlink.h>
57#include <net/net_namespace.h> 58#include <net/net_namespace.h>
@@ -347,6 +348,13 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data)
347 return; 348 return;
348 } 349 }
349 350
351 /* is sending the skb back to the incoming interface not allowed? */
352 if (!(gwj->flags & CGW_FLAGS_CAN_IIF_TX_OK) &&
353 skb_headroom(skb) == sizeof(struct can_skb_priv) &&
354 (((struct can_skb_priv *)(skb->head))->ifindex ==
355 gwj->dst.dev->ifindex))
356 return;
357
350 /* 358 /*
351 * clone the given skb, which has not been done in can_rcv() 359 * clone the given skb, which has not been done in can_rcv()
352 * 360 *