shortcut-fe: parse parameter of device event correctly to be compatible with 3.14
CRs-Fixed: 808126
Change-Id: I43e32e8d177146090551a95a6e1822f0157d4b0e
Signed-off-by: Xiaoping Fan <xfan@codeaurora.org>
diff --git a/shortcut-fe/sfe_backport.h b/shortcut-fe/sfe_backport.h
index b7f7928..43c7011 100644
--- a/shortcut-fe/sfe_backport.h
+++ b/shortcut-fe/sfe_backport.h
@@ -62,6 +62,33 @@
return master;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+#define SFE_DEV_EVENT_PTR(PTR) netdev_notifier_info_to_dev(PTR)
+#else
+#define SFE_DEV_EVENT_PTR(PTR) (struct net_device *)(PTR)
+#endif
+
+/*
+ * declare function sfe_cm_device_event
+ */
+int sfe_cm_device_event(struct notifier_block *this, unsigned long event, void *ptr);
+
+/*
+ * sfe_cm_propagate_event
+ * propagate ip address event as network device event
+ */
+static inline int sfe_cm_propagate_event(struct notifier_block *this, unsigned long event, struct net_device *dev)
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
+ struct netdev_notifier_info info;
+
+ netdev_notifier_info_init(&info, dev);
+ return sfe_cm_device_event(this, event, &info);
+#else
+ return sfe_cm_device_event(this, event, dev);
+#endif
+}
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0)
#define SFE_NF_CONN_ACCT(NM) struct nf_conn_acct *NM
#else
diff --git a/shortcut-fe/sfe_cm.c b/shortcut-fe/sfe_cm.c
index 2e0bb40..b014652 100644
--- a/shortcut-fe/sfe_cm.c
+++ b/shortcut-fe/sfe_cm.c
@@ -862,9 +862,9 @@
/*
* sfe_cm_device_event()
*/
-static int sfe_cm_device_event(struct notifier_block *this, unsigned long event, void *ptr)
+int sfe_cm_device_event(struct notifier_block *this, unsigned long event, void *ptr)
{
- struct net_device *dev = (struct net_device *)ptr;
+ struct net_device *dev = SFE_DEV_EVENT_PTR(ptr);
switch (event) {
case NETDEV_DOWN:
@@ -884,7 +884,7 @@
static int sfe_cm_inet_event(struct notifier_block *this, unsigned long event, void *ptr)
{
struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
- return sfe_cm_device_event(this, event, dev);
+ return sfe_cm_propagate_event(this, event, dev);
}
/*
@@ -893,7 +893,7 @@
static int sfe_cm_inet6_event(struct notifier_block *this, unsigned long event, void *ptr)
{
struct net_device *dev = ((struct inet6_ifaddr *)ptr)->idev->dev;
- return sfe_cm_device_event(this, event, dev);
+ return sfe_cm_propagate_event(this, event, dev);
}
/*