diff options
author | Patrick McHardy <kaber@trash.net> | 2007-03-14 19:39:45 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:25:44 -0400 |
commit | 73c361862c2be2e4ed6019da283fe1b422107f16 (patch) | |
tree | 2ac3e081fc9e3a84dc57b5a25e15e0e284488c3c | |
parent | a3c5029cf7a96da3acdf6884a21581b5bef310c3 (diff) |
[NETFILTER]: nfnetlink: use netlink_run_queue()
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/netfilter/nfnetlink.c | 51 |
1 files changed, 4 insertions, 47 deletions
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c index 7865a47c981e..5be6ac478fd4 100644 --- a/net/netfilter/nfnetlink.c +++ b/net/netfilter/nfnetlink.c | |||
@@ -301,59 +301,16 @@ err_inval: | |||
301 | return -1; | 301 | return -1; |
302 | } | 302 | } |
303 | 303 | ||
304 | /* Process one packet of messages. */ | ||
305 | static inline int nfnetlink_rcv_skb(struct sk_buff *skb) | ||
306 | { | ||
307 | int err; | ||
308 | struct nlmsghdr *nlh; | ||
309 | |||
310 | while (skb->len >= NLMSG_SPACE(0)) { | ||
311 | u32 rlen; | ||
312 | |||
313 | nlh = (struct nlmsghdr *)skb->data; | ||
314 | if (nlh->nlmsg_len < sizeof(struct nlmsghdr) | ||
315 | || skb->len < nlh->nlmsg_len) | ||
316 | return 0; | ||
317 | rlen = NLMSG_ALIGN(nlh->nlmsg_len); | ||
318 | if (rlen > skb->len) | ||
319 | rlen = skb->len; | ||
320 | if (nfnetlink_rcv_msg(skb, nlh, &err)) { | ||
321 | if (!err) | ||
322 | return -1; | ||
323 | netlink_ack(skb, nlh, err); | ||
324 | } else | ||
325 | if (nlh->nlmsg_flags & NLM_F_ACK) | ||
326 | netlink_ack(skb, nlh, 0); | ||
327 | skb_pull(skb, rlen); | ||
328 | } | ||
329 | |||
330 | return 0; | ||
331 | } | ||
332 | |||
333 | static void nfnetlink_rcv(struct sock *sk, int len) | 304 | static void nfnetlink_rcv(struct sock *sk, int len) |
334 | { | 305 | { |
335 | do { | 306 | unsigned int qlen = 0; |
336 | struct sk_buff *skb; | ||
337 | 307 | ||
308 | do { | ||
338 | if (nfnl_trylock()) | 309 | if (nfnl_trylock()) |
339 | return; | 310 | return; |
340 | 311 | netlink_run_queue(sk, &qlen, nfnetlink_rcv_msg); | |
341 | while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) { | ||
342 | if (nfnetlink_rcv_skb(skb)) { | ||
343 | if (skb->len) | ||
344 | skb_queue_head(&sk->sk_receive_queue, | ||
345 | skb); | ||
346 | else | ||
347 | kfree_skb(skb); | ||
348 | break; | ||
349 | } | ||
350 | kfree_skb(skb); | ||
351 | } | ||
352 | |||
353 | /* don't call nfnl_unlock, since it would reenter | ||
354 | * with further packet processing */ | ||
355 | __nfnl_unlock(); | 312 | __nfnl_unlock(); |
356 | } while(nfnl && nfnl->sk_receive_queue.qlen); | 313 | } while (qlen); |
357 | } | 314 | } |
358 | 315 | ||
359 | static void __exit nfnetlink_exit(void) | 316 | static void __exit nfnetlink_exit(void) |