Commit 0ef0f465 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[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: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 861934c7
...@@ -203,7 +203,7 @@ nfqnl_flush(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, unsigned long data) ...@@ -203,7 +203,7 @@ nfqnl_flush(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, unsigned long data)
static struct sk_buff * static struct sk_buff *
nfqnl_build_packet_message(struct nfqnl_instance *queue, nfqnl_build_packet_message(struct nfqnl_instance *queue,
struct nf_queue_entry *entry, int *errp) struct nf_queue_entry *entry)
{ {
sk_buff_data_t old_tail; sk_buff_data_t old_tail;
size_t size; size_t size;
...@@ -241,7 +241,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue, ...@@ -241,7 +241,7 @@ nfqnl_build_packet_message(struct nfqnl_instance *queue,
case NFQNL_COPY_PACKET: case NFQNL_COPY_PACKET:
if ((entskb->ip_summed == CHECKSUM_PARTIAL || if ((entskb->ip_summed == CHECKSUM_PARTIAL ||
entskb->ip_summed == CHECKSUM_COMPLETE) && entskb->ip_summed == CHECKSUM_COMPLETE) &&
(*errp = skb_checksum_help(entskb))) { skb_checksum_help(entskb)) {
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
return NULL; return NULL;
} }
...@@ -374,7 +374,6 @@ nlmsg_failure: ...@@ -374,7 +374,6 @@ nlmsg_failure:
nla_put_failure: nla_put_failure:
if (skb) if (skb)
kfree_skb(skb); kfree_skb(skb);
*errp = -EINVAL;
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_ERR "nf_queue: error creating packet message\n"); printk(KERN_ERR "nf_queue: error creating packet message\n");
return NULL; return NULL;
...@@ -383,21 +382,21 @@ nla_put_failure: ...@@ -383,21 +382,21 @@ nla_put_failure:
static int static int
nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
{ {
int status = -EINVAL;
struct sk_buff *nskb; struct sk_buff *nskb;
struct nfqnl_instance *queue; struct nfqnl_instance *queue;
int err;
/* rcu_read_lock()ed by nf_hook_slow() */ /* rcu_read_lock()ed by nf_hook_slow() */
queue = instance_lookup(queuenum); queue = instance_lookup(queuenum);
if (!queue) if (!queue)
return -EINVAL; goto err_out;
if (queue->copy_mode == NFQNL_COPY_NONE) if (queue->copy_mode == NFQNL_COPY_NONE)
return -EAGAIN; goto err_out;
nskb = nfqnl_build_packet_message(queue, entry, &status); nskb = nfqnl_build_packet_message(queue, entry);
if (nskb == NULL) if (nskb == NULL)
return status; goto err_out;
spin_lock_bh(&queue->lock); spin_lock_bh(&queue->lock);
...@@ -406,7 +405,6 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) ...@@ -406,7 +405,6 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
if (queue->queue_total >= queue->queue_maxlen) { if (queue->queue_total >= queue->queue_maxlen) {
queue->queue_dropped++; queue->queue_dropped++;
status = -ENOSPC;
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_WARNING "nf_queue: full at %d entries, " printk(KERN_WARNING "nf_queue: full at %d entries, "
"dropping packets(s). Dropped: %d\n", "dropping packets(s). Dropped: %d\n",
...@@ -415,8 +413,8 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) ...@@ -415,8 +413,8 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
} }
/* nfnetlink_unicast will either free the nskb or add it to a socket */ /* nfnetlink_unicast will either free the nskb or add it to a socket */
status = nfnetlink_unicast(nskb, queue->peer_pid, MSG_DONTWAIT); err = nfnetlink_unicast(nskb, queue->peer_pid, MSG_DONTWAIT);
if (status < 0) { if (err < 0) {
queue->queue_user_dropped++; queue->queue_user_dropped++;
goto err_out_unlock; goto err_out_unlock;
} }
...@@ -424,14 +422,14 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) ...@@ -424,14 +422,14 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum)
__enqueue_entry(queue, entry); __enqueue_entry(queue, entry);
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
return status; return 0;
err_out_free_nskb: err_out_free_nskb:
kfree_skb(nskb); kfree_skb(nskb);
err_out_unlock: err_out_unlock:
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
return status; err_out:
return -1;
} }
static int static int
......
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