Hi Dave! Please apply to your net-2.6.14, thanks
-- - Harald Welte <[EMAIL PROTECTED]> http://netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie
[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 <[EMAIL PROTECTED]>
---
commit 2f20e47c7aaf09749b1bb0684fbd30a1921d2de2
tree d8bf732f6a40d56f1a1e8b54a421473e2d40df98
parent 5f748d529c9bf1f0f52453d02a5e3aa9eca351e3
author Harald Welte <[EMAIL PROTECTED]> Mo, 08 Aug 2005 18:55:39 +0200
committer Harald Welte <[EMAIL PROTECTED]> Mo, 08 Aug 2005 18:55:39 +0200
net/netfilter/nf_log.c | 6 +++++-
net/netfilter/nf_queue.c | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -17,6 +17,8 @@
static struct nf_logger *nf_logging[NPROTO]; /* = NULL */
static DEFINE_SPINLOCK(nf_log_lock);
+/* return EBUSY if somebody else is registered, EEXIST if the same logger
+ * is registred, 0 on success. */
int nf_log_register(int pf, struct nf_logger *logger)
{
int ret = -EBUSY;
@@ -27,7 +29,9 @@ int nf_log_register(int pf, struct nf_lo
if (!nf_logging[pf]) {
rcu_assign_pointer(nf_logging[pf], logger);
ret = 0;
- }
+ } else if (nf_logging[pf] == logger)
+ ret = -EEXIST;
+
spin_unlock(&nf_log_lock);
return ret;
}
diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
--- a/net/netfilter/nf_queue.c
+++ b/net/netfilter/nf_queue.c
@@ -19,6 +19,8 @@ static struct nf_queue_rerouter *queue_r
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;
@@ -27,7 +29,9 @@ int nf_register_queue_handler(int pf, st
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;
pgpCGkUXJXuKO.pgp
Description: PGP signature
