#define CGW_FLAGS_CAN_ECHO 0x01
 #define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
+#define CGW_FLAGS_CAN_IIF_TX_OK 0x04
 
 #define CGW_MOD_FUNCS 4 /* AND OR XOR SET */
 
 
 #include <linux/skbuff.h>
 #include <linux/can.h>
 #include <linux/can/core.h>
+#include <linux/can/skb.h>
 #include <linux/can/gw.h>
 #include <net/rtnetlink.h>
 #include <net/net_namespace.h>
                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()
         *