Commit 73c36186 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: nfnetlink: use netlink_run_queue()

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3c5029c
...@@ -301,59 +301,16 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb, ...@@ -301,59 +301,16 @@ static int nfnetlink_rcv_msg(struct sk_buff *skb,
return -1; return -1;
} }
/* Process one packet of messages. */
static inline int nfnetlink_rcv_skb(struct sk_buff *skb)
{
int err;
struct nlmsghdr *nlh;
while (skb->len >= NLMSG_SPACE(0)) {
u32 rlen;
nlh = (struct nlmsghdr *)skb->data;
if (nlh->nlmsg_len < sizeof(struct nlmsghdr)
|| skb->len < nlh->nlmsg_len)
return 0;
rlen = NLMSG_ALIGN(nlh->nlmsg_len);
if (rlen > skb->len)
rlen = skb->len;
if (nfnetlink_rcv_msg(skb, nlh, &err)) {
if (!err)
return -1;
netlink_ack(skb, nlh, err);
} else
if (nlh->nlmsg_flags & NLM_F_ACK)
netlink_ack(skb, nlh, 0);
skb_pull(skb, rlen);
}
return 0;
}
static void nfnetlink_rcv(struct sock *sk, int len) static void nfnetlink_rcv(struct sock *sk, int len)
{ {
do { unsigned int qlen = 0;
struct sk_buff *skb;
do {
if (nfnl_trylock()) if (nfnl_trylock())
return; return;
netlink_run_queue(sk, &qlen, nfnetlink_rcv_msg);
while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {
if (nfnetlink_rcv_skb(skb)) {
if (skb->len)
skb_queue_head(&sk->sk_receive_queue,
skb);
else
kfree_skb(skb);
break;
}
kfree_skb(skb);
}
/* don't call nfnl_unlock, since it would reenter
* with further packet processing */
__nfnl_unlock(); __nfnl_unlock();
} while(nfnl && nfnl->sk_receive_queue.qlen); } while (qlen);
} }
static void __exit nfnetlink_exit(void) static void __exit nfnetlink_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment