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>
This commit is contained in:
@@ -274,13 +274,17 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
|
|||||||
|
|
||||||
skb = alloc_skb(size, GFP_ATOMIC);
|
skb = alloc_skb(size, GFP_ATOMIC);
|
||||||
if (!skb)
|
if (!skb)
|
||||||
goto nlmsg_failure;
|
return NULL;
|
||||||
|
|
||||||
old_tail = skb->tail;
|
old_tail = skb->tail;
|
||||||
nlh = NLMSG_PUT(skb, 0, 0,
|
nlh = nlmsg_put(skb, 0, 0,
|
||||||
NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET,
|
NFNL_SUBSYS_QUEUE << 8 | NFQNL_MSG_PACKET,
|
||||||
sizeof(struct nfgenmsg));
|
sizeof(struct nfgenmsg), 0);
|
||||||
nfmsg = NLMSG_DATA(nlh);
|
if (!nlh) {
|
||||||
|
kfree_skb(skb);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
nfmsg = nlmsg_data(nlh);
|
||||||
nfmsg->nfgen_family = entry->pf;
|
nfmsg->nfgen_family = entry->pf;
|
||||||
nfmsg->version = NFNETLINK_V0;
|
nfmsg->version = NFNETLINK_V0;
|
||||||
nfmsg->res_id = htons(queue->queue_num);
|
nfmsg->res_id = htons(queue->queue_num);
|
||||||
@@ -383,7 +387,8 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
|
|||||||
|
|
||||||
if (skb_tailroom(skb) < nla_total_size(data_len)) {
|
if (skb_tailroom(skb) < nla_total_size(data_len)) {
|
||||||
printk(KERN_WARNING "nf_queue: no tailroom!\n");
|
printk(KERN_WARNING "nf_queue: no tailroom!\n");
|
||||||
goto nlmsg_failure;
|
kfree_skb(skb);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nla = (struct nlattr *)skb_put(skb, nla_total_size(data_len));
|
nla = (struct nlattr *)skb_put(skb, nla_total_size(data_len));
|
||||||
@@ -400,7 +405,6 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
|
|||||||
nlh->nlmsg_len = skb->tail - old_tail;
|
nlh->nlmsg_len = skb->tail - old_tail;
|
||||||
return skb;
|
return skb;
|
||||||
|
|
||||||
nlmsg_failure:
|
|
||||||
nla_put_failure:
|
nla_put_failure:
|
||||||
if (skb)
|
if (skb)
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
@@ -686,7 +690,7 @@ nfqnl_recv_verdict_batch(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
const struct nlmsghdr *nlh,
|
const struct nlmsghdr *nlh,
|
||||||
const struct nlattr * const nfqa[])
|
const struct nlattr * const nfqa[])
|
||||||
{
|
{
|
||||||
struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
|
struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
||||||
struct nf_queue_entry *entry, *tmp;
|
struct nf_queue_entry *entry, *tmp;
|
||||||
unsigned int verdict, maxid;
|
unsigned int verdict, maxid;
|
||||||
struct nfqnl_msg_verdict_hdr *vhdr;
|
struct nfqnl_msg_verdict_hdr *vhdr;
|
||||||
@@ -732,7 +736,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
const struct nlmsghdr *nlh,
|
const struct nlmsghdr *nlh,
|
||||||
const struct nlattr * const nfqa[])
|
const struct nlattr * const nfqa[])
|
||||||
{
|
{
|
||||||
struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
|
struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
||||||
u_int16_t queue_num = ntohs(nfmsg->res_id);
|
u_int16_t queue_num = ntohs(nfmsg->res_id);
|
||||||
|
|
||||||
struct nfqnl_msg_verdict_hdr *vhdr;
|
struct nfqnl_msg_verdict_hdr *vhdr;
|
||||||
@@ -806,7 +810,7 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
|
|||||||
const struct nlmsghdr *nlh,
|
const struct nlmsghdr *nlh,
|
||||||
const struct nlattr * const nfqa[])
|
const struct nlattr * const nfqa[])
|
||||||
{
|
{
|
||||||
struct nfgenmsg *nfmsg = NLMSG_DATA(nlh);
|
struct nfgenmsg *nfmsg = nlmsg_data(nlh);
|
||||||
u_int16_t queue_num = ntohs(nfmsg->res_id);
|
u_int16_t queue_num = ntohs(nfmsg->res_id);
|
||||||
struct nfqnl_instance *queue;
|
struct nfqnl_instance *queue;
|
||||||
struct nfqnl_msg_config_cmd *cmd = NULL;
|
struct nfqnl_msg_config_cmd *cmd = NULL;
|
||||||
|
Reference in New Issue
Block a user