diff mbox

[1/2] netfilter: xt_quota2: Move away from NLMSG_PUT()

Message ID 1346387258-18321-2-git-send-email-tushar.behera@linaro.org
State Not Applicable
Headers show

Commit Message

Tushar Behera Aug. 31, 2012, 4:27 a.m. UTC
Commit c3deafc5261a ("netlink: Delete NLMSG_PUT and NLMSG_NEW.") removes
NLMSG_PUT() and recommends use of nlmsg_put() instead.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
 net/netfilter/xt_quota2.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/net/netfilter/xt_quota2.c b/net/netfilter/xt_quota2.c
index fb2ef46..865f909 100644
--- a/net/netfilter/xt_quota2.c
+++ b/net/netfilter/xt_quota2.c
@@ -24,6 +24,8 @@ 
 #include <linux/netfilter_ipv4/ipt_ULOG.h>
 #endif
 
+#include <net/netlink.h>
+
 /**
  * @lock:	lock to protect quota writers from each other
  */
@@ -82,9 +84,15 @@  static void quota2_log(unsigned int hooknum,
 	}
 
 	/* NLMSG_PUT() uses "goto nlmsg_failure" */
-	nlh = NLMSG_PUT(log_skb, /*pid*/0, /*seq*/0, qlog_nl_event,
-			sizeof(*pm));
-	pm = NLMSG_DATA(nlh);
+	nlh = nlmsg_put(log_skb, /*pid*/0, /*seq*/0, qlog_nl_event,
+			sizeof(*pm), 0);
+
+	if (!nlh) {
+		pr_debug("xt_quota2: error during NLMSG_PUT\n");
+		return;
+	}
+
+	pm = nlmsg_data(nlh);
 	if (skb->tstamp.tv64 == 0)
 		__net_timestamp((struct sk_buff *)skb);
 	pm->data_len = 0;
@@ -106,9 +114,6 @@  static void quota2_log(unsigned int hooknum,
 	NETLINK_CB(log_skb).dst_group = 1;
 	pr_debug("throwing 1 packets to netlink group 1\n");
 	netlink_broadcast(nflognl, log_skb, 0, 1, GFP_ATOMIC);
-
-nlmsg_failure:  /* Used within NLMSG_PUT() */
-	pr_debug("xt_quota2: error during NLMSG_PUT\n");
 }
 #else
 static void quota2_log(unsigned int hooknum,