diff options
author | Harald Welte <laforge@netfilter.org> | 2005-08-09 20:23:36 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-08-29 15:51:21 -0700 |
commit | d72367b6f36e557f122beefaa8c6b80eb1c7f245 (patch) | |
tree | 650d0bdca48e7f3ea6bc356f6aa868f34c6a226f /net/netfilter/nf_log.c | |
parent | bbd86b9fc469b7e91dc7444e6abb8930811d79cb (diff) | |
download | linux-d72367b6f36e557f122beefaa8c6b80eb1c7f245.tar.bz2 |
[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_log.c')
-rw-r--r-- | net/netfilter/nf_log.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 31a9d63921d6..e104760f7a67 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c @@ -18,6 +18,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; @@ -28,7 +30,9 @@ int nf_log_register(int pf, struct nf_logger *logger) 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; } |