diff options
author | Patrick McHardy <kaber@trash.net> | 2007-12-05 04:31:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:56:23 -0500 |
commit | 0ef0f46580320a7f96c60b20b7a29b0bd820d2e7 (patch) | |
tree | 0e48b8fb88e4fba64a8bec8e87c855425d8670e9 | |
parent | 861934c7c888973da8bf621b3959e408531539e1 (diff) |
[NETFILTER]: nfnetlink_queue: remove useless enqueue status codes
The queueing core doesn't care about the exact return value from
the queue handler, so there's no need to go through the trouble
of returning a meaningful value as long as we indicate an error.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/netfilter/nfnetlink_queue.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index abd5ff9b89a7..6148a41aa978 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -203,7 +203,7 @@ nfqnl_flush(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, unsigned long data) | |||
203 | 203 | ||
204 | static struct sk_buff * | 204 | static struct sk_buff * |
205 | nfqnl_build_packet_message(struct nfqnl_instance *queue, | 205 | nfqnl_build_packet_message(struct nfqnl_instance *queue, |
206 | struct nf_queue_entry *entry, int *errp) | 206 | struct nf_queue_entry *entry) |
207 | { | 207 | { |
208 | sk_buff_data_t old_tail; | 208 | sk_buff_data_t old_tail; |
209 | size_t size; | 209 | size_t size; |
@@ -241,7 +241,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, | |||
241 | case NFQNL_COPY_PACKET: | 241 | case NFQNL_COPY_PACKET: |
242 | if ((entskb->ip_summed == CHECKSUM_PARTIAL || | 242 | if ((entskb->ip_summed == CHECKSUM_PARTIAL || |
243 | entskb->ip_summed == CHECKSUM_COMPLETE) && | 243 | entskb->ip_summed == CHECKSUM_COMPLETE) && |
244 | (*errp = skb_checksum_help(entskb))) { | 244 | skb_checksum_help(entskb)) { |
245 | spin_unlock_bh(&queue->lock); | 245 | spin_unlock_bh(&queue->lock); |
246 | return NULL; | 246 | return NULL; |
247 | } | 247 | } |
@@ -374,7 +374,6 @@ nlmsg_failure: | |||
374 | nla_put_failure: | 374 | nla_put_failure: |
375 | if (skb) | 375 | if (skb) |
376 | kfree_skb(skb); | 376 | kfree_skb(skb); |
377 | *errp = -EINVAL; | ||
378 | if (net_ratelimit()) | 377 | if (net_ratelimit()) |
379 | printk(KERN_ERR "nf_queue: error creating packet message\n"); | 378 | printk(KERN_ERR "nf_queue: error creating packet message\n"); |
380 | return NULL; | 379 | return NULL; |
@@ -383,21 +382,21 @@ nla_put_failure: | |||
383 | static int | 382 | static int |
384 | nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | 383 | nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) |
385 | { | 384 | { |
386 | int status = -EINVAL; | ||
387 | struct sk_buff *nskb; | 385 | struct sk_buff *nskb; |
388 | struct nfqnl_instance *queue; | 386 | struct nfqnl_instance *queue; |
387 | int err; | ||
389 | 388 | ||
390 | /* rcu_read_lock()ed by nf_hook_slow() */ | 389 | /* rcu_read_lock()ed by nf_hook_slow() */ |
391 | queue = instance_lookup(queuenum); | 390 | queue = instance_lookup(queuenum); |
392 | if (!queue) | 391 | if (!queue) |
393 | return -EINVAL; | 392 | goto err_out; |
394 | 393 | ||
395 | if (queue->copy_mode == NFQNL_COPY_NONE) | 394 | if (queue->copy_mode == NFQNL_COPY_NONE) |
396 | return -EAGAIN; | 395 | goto err_out; |
397 | 396 | ||
398 | nskb = nfqnl_build_packet_message(queue, entry, &status); | 397 | nskb = nfqnl_build_packet_message(queue, entry); |
399 | if (nskb == NULL) | 398 | if (nskb == NULL) |
400 | return status; | 399 | goto err_out; |
401 | 400 | ||
402 | spin_lock_bh(&queue->lock); | 401 | spin_lock_bh(&queue->lock); |
403 | 402 | ||
@@ -406,7 +405,6 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | |||
406 | 405 | ||
407 | if (queue->queue_total >= queue->queue_maxlen) { | 406 | if (queue->queue_total >= queue->queue_maxlen) { |
408 | queue->queue_dropped++; | 407 | queue->queue_dropped++; |
409 | status = -ENOSPC; | ||
410 | if (net_ratelimit()) | 408 | if (net_ratelimit()) |
411 | printk(KERN_WARNING "nf_queue: full at %d entries, " | 409 | printk(KERN_WARNING "nf_queue: full at %d entries, " |
412 | "dropping packets(s). Dropped: %d\n", | 410 | "dropping packets(s). Dropped: %d\n", |
@@ -415,8 +413,8 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | |||
415 | } | 413 | } |
416 | 414 | ||
417 | /* nfnetlink_unicast will either free the nskb or add it to a socket */ | 415 | /* nfnetlink_unicast will either free the nskb or add it to a socket */ |
418 | status = nfnetlink_unicast(nskb, queue->peer_pid, MSG_DONTWAIT); | 416 | err = nfnetlink_unicast(nskb, queue->peer_pid, MSG_DONTWAIT); |
419 | if (status < 0) { | 417 | if (err < 0) { |
420 | queue->queue_user_dropped++; | 418 | queue->queue_user_dropped++; |
421 | goto err_out_unlock; | 419 | goto err_out_unlock; |
422 | } | 420 | } |
@@ -424,14 +422,14 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | |||
424 | __enqueue_entry(queue, entry); | 422 | __enqueue_entry(queue, entry); |
425 | 423 | ||
426 | spin_unlock_bh(&queue->lock); | 424 | spin_unlock_bh(&queue->lock); |
427 | return status; | 425 | return 0; |
428 | 426 | ||
429 | err_out_free_nskb: | 427 | err_out_free_nskb: |
430 | kfree_skb(nskb); | 428 | kfree_skb(nskb); |
431 | |||
432 | err_out_unlock: | 429 | err_out_unlock: |
433 | spin_unlock_bh(&queue->lock); | 430 | spin_unlock_bh(&queue->lock); |
434 | return status; | 431 | err_out: |
432 | return -1; | ||
435 | } | 433 | } |
436 | 434 | ||
437 | static int | 435 | static int |