diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-27 00:35:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-27 00:35:27 -0400 |
commit | 3da07c0c2b5a13d05d9a66395d72eec0923b0592 (patch) | |
tree | 9204e4af7a885267a07aeac21edb7b25a41ffcc3 /net | |
parent | d550d0958928889fa7978b3e254edcd6c52c3296 (diff) |
netfilter: nfnetlink_queue_core: Move away from NLMSG_PUT().
And use nlmsg_data() while we're here too.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nfnetlink_queue_core.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index d36b95ea8ca3..a0b64920039d 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -274,13 +274,17 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
274 | 274 | ||
275 | skb = alloc_skb(size, GFP_ATOMIC); | 275 | skb = alloc_skb(size, GFP_ATOMIC); |
276 | if (!skb) | 276 | if (!skb) |
277 | goto nlmsg_failure; | 277 | return NULL; |
278 | 278 | ||
279 | old_tail = skb->tail; | 279 | old_tail = skb->tail; |
280 | nlh = NLMSG_PUT(skb, 0, 0, | 280 | nlh = nlmsg_put(skb, 0, 0, |
281 | NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, | 281 | NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET, |
282 | sizeof(struct nfgenmsg)); | 282 | sizeof(struct nfgenmsg), 0); |
283 | nfmsg = NLMSG_DATA(nlh); | 283 | if (!nlh) { |
284 | kfree_skb(skb); | ||
285 | return NULL; | ||
286 | } | ||
287 | nfmsg = nlmsg_data(nlh); | ||
284 | nfmsg->nfgen_family = entry->pf; | 288 | nfmsg->nfgen_family = entry->pf; |
285 | nfmsg->version = NFNETLINK_V0; | 289 | nfmsg->version = NFNETLINK_V0; |
286 | nfmsg->res_id = htons(queue->queue_num); | 290 | nfmsg->res_id = htons(queue->queue_num); |
@@ -383,7 +387,8 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
383 | 387 | ||
384 | if (skb_tailroom(skb) < nla_total_size(data_len)) { | 388 | if (skb_tailroom(skb) < nla_total_size(data_len)) { |
385 | printk(KERN_WARNING "nf_queue: no tailroom!\n"); | 389 | printk(KERN_WARNING "nf_queue: no tailroom!\n"); |
386 | goto nlmsg_failure; | 390 | kfree_skb(skb); |
391 | return NULL; | ||
387 | } | 392 | } |
388 | 393 | ||
389 | nla = (struct nlattr *)skb_put(skb, nla_total_size(data_len)); | 394 | nla = (struct nlattr *)skb_put(skb, nla_total_size(data_len)); |
@@ -400,7 +405,6 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
400 | nlh->nlmsg_len = skb->tail - old_tail; | 405 | nlh->nlmsg_len = skb->tail - old_tail; |
401 | return skb; | 406 | return skb; |
402 | 407 | ||
403 | nlmsg_failure: | ||
404 | nla_put_failure: | 408 | nla_put_failure: |
405 | if (skb) | 409 | if (skb) |
406 | kfree_skb(skb); | 410 | kfree_skb(skb); |
@@ -686,7 +690,7 @@ nfqnl_recv_verdict_batch(struct sock *ctnl, struct sk_buff *skb, | |||
686 | const struct nlmsghdr *nlh, | 690 | const struct nlmsghdr *nlh, |
687 | const struct nlattr * const nfqa[]) | 691 | const struct nlattr * const nfqa[]) |
688 | { | 692 | { |
689 | struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); | 693 | struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
690 | struct nf_queue_entry *entry, *tmp; | 694 | struct nf_queue_entry *entry, *tmp; |
691 | unsigned int verdict, maxid; | 695 | unsigned int verdict, maxid; |
692 | struct nfqnl_msg_verdict_hdr *vhdr; | 696 | struct nfqnl_msg_verdict_hdr *vhdr; |
@@ -732,7 +736,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb, | |||
732 | const struct nlmsghdr *nlh, | 736 | const struct nlmsghdr *nlh, |
733 | const struct nlattr * const nfqa[]) | 737 | const struct nlattr * const nfqa[]) |
734 | { | 738 | { |
735 | struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); | 739 | struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
736 | u_int16_t queue_num = ntohs(nfmsg->res_id); | 740 | u_int16_t queue_num = ntohs(nfmsg->res_id); |
737 | 741 | ||
738 | struct nfqnl_msg_verdict_hdr *vhdr; | 742 | struct nfqnl_msg_verdict_hdr *vhdr; |
@@ -806,7 +810,7 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb, | |||
806 | const struct nlmsghdr *nlh, | 810 | const struct nlmsghdr *nlh, |
807 | const struct nlattr * const nfqa[]) | 811 | const struct nlattr * const nfqa[]) |
808 | { | 812 | { |
809 | struct nfgenmsg *nfmsg = NLMSG_DATA(nlh); | 813 | struct nfgenmsg *nfmsg = nlmsg_data(nlh); |
810 | u_int16_t queue_num = ntohs(nfmsg->res_id); | 814 | u_int16_t queue_num = ntohs(nfmsg->res_id); |
811 | struct nfqnl_instance *queue; | 815 | struct nfqnl_instance *queue; |
812 | struct nfqnl_msg_config_cmd *cmd = NULL; | 816 | struct nfqnl_msg_config_cmd *cmd = NULL; |