[NETFILTER]: nfnetlink: use netlink_run_queue()
authorPatrick McHardy <kaber@trash.net>
Wed, 14 Mar 2007 23:39:45 +0000 (16:39 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:25:44 +0000 (22:25 -0700)
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nfnetlink.c

index 7865a47c981e8610fedaec1cc174fab36a88dff6..5be6ac478fd49be19849615fc20c3639edaf7a8f 100644 (file)
@@ -301,59 +301,16 @@ err_inval:
        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)
 {
-       do {
-               struct sk_buff *skb;
+       unsigned int qlen = 0;
 
+       do {
                if (nfnl_trylock())
                        return;
-
-               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 */
+               netlink_run_queue(sk, &qlen, nfnetlink_rcv_msg);
                __nfnl_unlock();
-       } while(nfnl && nfnl->sk_receive_queue.qlen);
+       } while (qlen);
 }
 
 static void __exit nfnetlink_exit(void)