History

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.

Oliver Hartkopp committed 13 years ago

Commit d904d3e1 parent 156c2bb2 files · +9 −0Browse files

Unified · Split

2 files
  1. include/uapi/linux/can/gw.h +1 −0
  2. net/can/gw.c +8 −0
include/uapi/linux/can/gw.h+1−0
@@ -51,6 +51,7 @@ enum { · 50 unmodified lines
5151
5252 #define CGW_FLAGS_CAN_ECHO 0x01
5353 #define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
54+#define CGW_FLAGS_CAN_IIF_TX_OK 0x04
5455
5556 #define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
5657
net/can/gw.c+8−0
@@ -52,6 +52,7 @@ · 51 unmodified lines
5252 #include <linux/skbuff.h>
5353 #include <linux/can.h>
5454 #include <linux/can/core.h>
55+#include <linux/can/skb.h>
5556 #include <linux/can/gw.h>
5657 #include <net/rtnetlink.h>
5758 #include <net/net_namespace.h>
@@ -347,6 +348,13 @@ static void can_can_gw_rcv(struct sk_buff *skb, void *data) · 289 unmodified lines
347348 return;
348349 }
349350
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+
350358 /*
351359 * clone the given skb, which has not been done in can_rcv()
352360 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t