public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: add compat support for the new netlink ops
@ 2013-02-17 14:43 Antonio Quartulli
  2013-02-18 23:49 ` Simon Wunderlich
  0 siblings, 1 reply; 12+ messages in thread
From: Antonio Quartulli @ 2013-02-17 14:43 UTC (permalink / raw)
  To: b.a.t.m.a.n

This patches enable the new rtnl ops to compile on kernels starting from 2.6.32

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---

Could not be uglier.
*Compile tested only* because linux-2.6.32 does not compile on my laptop



 compat.h | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/compat.h b/compat.h
index 885e551..de22e2b 100644
--- a/compat.h
+++ b/compat.h
@@ -71,6 +71,9 @@ static inline void batadv_this_cpu_add(uint64_t *count_ptr, size_t count)
 	put_cpu();
 }
 
+#define batadv_softif_destroy_netlink(dev, head) batadv_softif_destroy_netlink(dev)
+#define unregister_netdevice_queue(dev, head) unregister_netdevice(dev)
+
 #endif /* < KERNEL_VERSION(2, 6, 33) */
 
 
@@ -132,6 +135,43 @@ static inline int batadv_param_set_copystring(const char *val,
 #define kstrtoul strict_strtoul
 #define kstrtol  strict_strtol
 
+#define batadv_softif_slave_add(x, y) \
+batadv_softif_slave_add(struct net_device *dev, struct ifreq *rq, int cmd)\
+{\
+	return 0;\
+}\
+static int __batadv_softif_slave_add(x, y)
+
+#define batadv_softif_slave_del(x, y) \
+__batadv_softif_slave_del(struct net_device *dev, struct net_device *slave_dev);\
+static int batadv_softif_slave_del(struct net_device *dev, struct ifreq *rq, int cmd)\
+{\
+	struct batadv_priv *bat_priv = netdev_priv(dev);\
+	struct net_device *slave_dev;\
+	int ret;\
+	if (!capable(CAP_NET_ADMIN))\
+		return -EPERM;\
+	slave_dev = dev_get_by_index(&init_net, rq->ifr_ifindex);\
+	if (!dev)\
+		return -EINVAL;\
+	switch(cmd) {\
+	case SIOCBRADDIF:\
+		ret = __batadv_softif_slave_add(bat_priv->soft_iface, slave_dev);\
+	case SIOCBRDELIF:\
+		ret = __batadv_softif_slave_del(bat_priv->soft_iface, slave_dev);\
+	default:\
+		pr_debug("batman-adv does not support ioctl 0x%x\n", cmd);\
+		return -EOPNOTSUPP;\
+	}\
+\
+	dev_put(slave_dev);\
+	return ret;\
+}\
+static int __batadv_softif_slave_del(x, y)
+
+#define ndo_add_slave ndo_do_ioctl
+#define ndo_del_slave ndo_do_ioctl
+
 #endif /* < KERNEL_VERSION(2, 6, 39) */
 
 
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-02-27  3:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-17 14:43 [B.A.T.M.A.N.] [PATCH] batman-adv: add compat support for the new netlink ops Antonio Quartulli
2013-02-18 23:49 ` Simon Wunderlich
2013-02-19  1:08   ` Marek Lindner
2013-02-19 21:43     ` Simon Wunderlich
2013-02-20 13:26       ` Antonio Quartulli
2013-02-20 14:14         ` Simon Wunderlich
2013-02-20 14:27           ` Antonio Quartulli
2013-02-20 14:40             ` Antonio Quartulli
2013-02-20 14:57               ` [B.A.T.M.A.N.] [PATCHv2] " Antonio Quartulli
2013-02-26 21:28                 ` Simon Wunderlich
2013-02-26 21:31                   ` Antonio Quartulli
2013-02-27  3:20                   ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox