summaryrefslogtreecommitdiff
path: root/net/netfilter/nf_queue.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2005-08-09 20:23:36 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 15:51:21 -0700
commitd72367b6f36e557f122beefaa8c6b80eb1c7f245 (patch)
tree650d0bdca48e7f3ea6bc356f6aa868f34c6a226f /net/netfilter/nf_queue.c
parentbbd86b9fc469b7e91dc7444e6abb8930811d79cb (diff)
[NETFILTER]: more verbose return codes from nf_{log,queue}
This adds EEXIST to distinguish between the following return values: 0: nobody was registered, registration successful EEXIST: the exact same handler was already registered, no registration required EBUSY: somebody else is registered, registration unsuccessful. Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netfilter/nf_queue.c')
-rw-r--r--net/netfilter/nf_queue.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
index 8a67bde8b640..d10d552d9c40 100644
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -20,6 +20,8 @@ static struct nf_queue_rerouter *queue_rerouter;
static DEFINE_RWLOCK(queue_handler_lock);
+/* return EBUSY when somebody else is registered, return EEXIST if the
+ * same handler is registered, return 0 in case of success. */
int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)
{
int ret;
@@ -28,7 +30,9 @@ int nf_register_queue_handler(int pf, struct nf_queue_handler *qh)
return -EINVAL;
write_lock_bh(&queue_handler_lock);
- if (queue_handler[pf])
+ if (queue_handler[pf] == qh)
+ ret = -EEXIST;
+ else if (queue_handler[pf])
ret = -EBUSY;
else {
queue_handler[pf] = qh;