#include <socketcan/can/gw.h>
#include <net/rtnetlink.h>
#include <net/net_namespace.h>
+#include <net/sock.h>
#include <socketcan/can/version.h> /* for RCSID. Removed by mkpatch script */
RCSID("$Id$");
static struct kmem_cache *cgw_cache __read_mostly;
-#define CGW_SK_MAGIC ((void *)(¬ifier))
+static struct sock gw_dummy_sk;
/* structure that contains the (on-the-fly) CAN frame modifications */
struct cf_mod {
int modidx = 0;
/* do not handle already routed frames */
- if (skb->sk == CGW_SK_MAGIC)
+ if (skb->sk == &gw_dummy_sk)
return;
if (!(gwj->dst.dev->flags & IFF_UP)) {
}
/* mark routed frames with a 'special' sk value */
- nskb->sk = CGW_SK_MAGIC;
+ nskb->sk = &gw_dummy_sk;
nskb->dev = gwj->dst.dev;
/* pointer to modifiable CAN frame */
notifier.notifier_call = cgw_notifier;
register_netdevice_notifier(¬ifier);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33)
+ /* initialize struct for dev_pick_tx() */
+ sk_tx_queue_clear(&gw_dummy_sk);
+#endif
+
if (__rtnl_register(PF_CAN, RTM_GETROUTE, NULL, cgw_dump_jobs)) {
unregister_netdevice_notifier(¬ifier);
kmem_cache_destroy(cgw_cache);