wprobe: fix build against Linux 3.7
authorJo-Philipp Wich <jow@openwrt.org>
Wed, 16 Jan 2013 14:05:21 +0000 (14:05 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Wed, 16 Jan 2013 14:05:21 +0000 (14:05 +0000)
SVN-Revision: 35185

net/wprobe/Makefile
net/wprobe/src/kernel/wprobe-core.c

index de1ba6d636d166cdf4a515aa1ccd56fca0672982..fe80453f5abf955376fa69a2c691fdbad56ad746 100644 (file)
@@ -1,5 +1,5 @@
 #
 #
-# Copyright (C) 2008-2010 OpenWrt.org
+# Copyright (C) 2008-2013 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=wprobe
 PKG_VERSION:=1
 
 PKG_NAME:=wprobe
 PKG_VERSION:=1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix
 
 
 PKG_BUILD_DEPENDS:=PACKAGE_wprobe-export:libipfix
 
index ee68a8eec7f024fd2cf083c7e4f33fb7993fd811..27bc3664dd7041553c231c7e3df13671213f1aa3 100644 (file)
@@ -40,6 +40,12 @@ prefetch(pos->next), pos != (head); \
 pos = rcu_dereference(pos->next))
 #endif
 
 pos = rcu_dereference(pos->next))
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,7,0)
+#define SKB_PORTID(x) NETLINK_CB(x).portid
+#else
+#define SKB_PORTID(x) NETLINK_CB(x).pid
+#endif
+
 #define WPROBE_MIN_INTERVAL            100 /* minimum measurement interval in msecs */
 #define WPROBE_MAX_FILTER_SIZE 1024
 #define WPROBE_MAX_FRAME_SIZE  1900
 #define WPROBE_MIN_INTERVAL            100 /* minimum measurement interval in msecs */
 #define WPROBE_MAX_FILTER_SIZE 1024
 #define WPROBE_MAX_FRAME_SIZE  1900
@@ -441,7 +447,7 @@ wprobe_send_item_value(struct sk_buff *msg, struct netlink_callback *cb,
        struct wprobe_value *val = dev->query_val;
        u64 time = val[i].last - val[i].first;
 
        struct wprobe_value *val = dev->query_val;
        u64 time = val[i].last - val[i].first;
 
-       hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_INFO);
 
        if (nla_put_u32(msg, WPROBE_ATTR_ID, i))
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_INFO);
 
        if (nla_put_u32(msg, WPROBE_ATTR_ID, i))
@@ -514,7 +520,7 @@ wprobe_send_item_info(struct sk_buff *msg, struct netlink_callback *cb,
 {
        struct genlmsghdr *hdr;
 
 {
        struct genlmsghdr *hdr;
 
-       hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_LIST);
 
        if ((i == 0) && (dev->addr != NULL)) {
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_LIST);
 
        if ((i == 0) && (dev->addr != NULL)) {
@@ -557,7 +563,7 @@ wprobe_dump_filter_group(struct sk_buff *msg, struct wprobe_filter_group *fg, st
        struct nlattr *group, *item;
        int i;
 
        struct nlattr *group, *item;
        int i;
 
-       hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_FILTER);
        if (!hdr)
                return false;
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_FILTER);
        if (!hdr)
                return false;
@@ -639,7 +645,7 @@ wprobe_dump_link(struct sk_buff *msg, struct wprobe_link *l, struct netlink_call
 {
        struct genlmsghdr *hdr;
 
 {
        struct genlmsghdr *hdr;
 
-       hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
+       hdr = genlmsg_put(msg, SKB_PORTID(cb->skb), cb->nlh->nlmsg_seq,
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_LINKS);
        if (!hdr)
                return false;
                        &wprobe_fam, NLM_F_MULTI, WPROBE_CMD_GET_LINKS);
        if (!hdr)
                return false;