]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/netfilter/nf_log.c
[WATCHDOG] Fix build with CONFIG_ITCO_VENDOR_SUPPORT=n
[linux-2.6-omap-h63xx.git] / net / netfilter / nf_log.c
index 94985792b79ac65a9e3eb5ac8b04704cd2004b3b..9fda6ee95a31ed5ee5d59c8fc3c5403076a179b4 100644 (file)
@@ -6,20 +6,21 @@
 #include <linux/netfilter.h>
 #include <linux/seq_file.h>
 #include <net/protocol.h>
+#include <net/netfilter/nf_log.h>
 
 #include "nf_internals.h"
 
-/* Internal logging interface, which relies on the real 
+/* Internal logging interface, which relies on the real
    LOG target modules */
 
 #define NF_LOG_PREFIXLEN               128
 
-static struct nf_logger *nf_loggers[NPROTO];
+static const struct nf_logger *nf_loggers[NPROTO] __read_mostly;
 static DEFINE_MUTEX(nf_log_mutex);
 
 /* 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 nf_log_register(int pf, const struct nf_logger *logger)
 {
        int ret;
 
@@ -57,7 +58,7 @@ void nf_log_unregister_pf(int pf)
 }
 EXPORT_SYMBOL(nf_log_unregister_pf);
 
-void nf_log_unregister(struct nf_logger *logger)
+void nf_log_unregister(const struct nf_logger *logger)
 {
        int i;
 
@@ -77,12 +78,12 @@ void nf_log_packet(int pf,
                   const struct sk_buff *skb,
                   const struct net_device *in,
                   const struct net_device *out,
-                  struct nf_loginfo *loginfo,
+                  const struct nf_loginfo *loginfo,
                   const char *fmt, ...)
 {
        va_list args;
        char prefix[NF_LOG_PREFIXLEN];
-       struct nf_logger *logger;
+       const struct nf_logger *logger;
 
        rcu_read_lock();
        logger = rcu_dereference(nf_loggers[pf]);
@@ -90,12 +91,7 @@ void nf_log_packet(int pf,
                va_start(args, fmt);
                vsnprintf(prefix, sizeof(prefix), fmt, args);
                va_end(args);
-               /* We must read logging before nf_logfn[pf] */
                logger->logfn(pf, hooknum, skb, in, out, loginfo, prefix);
-       } else if (net_ratelimit()) {
-               printk(KERN_WARNING "nf_log_packet: can\'t log since "
-                      "no backend logging module loaded in! Please either "
-                      "load one, or disable logging explicitly\n");
        }
        rcu_read_unlock();
 }
@@ -103,6 +99,7 @@ EXPORT_SYMBOL(nf_log_packet);
 
 #ifdef CONFIG_PROC_FS
 static void *seq_start(struct seq_file *seq, loff_t *pos)
+       __acquires(RCU)
 {
        rcu_read_lock();
 
@@ -123,6 +120,7 @@ static void *seq_next(struct seq_file *s, void *v, loff_t *pos)
 }
 
 static void seq_stop(struct seq_file *s, void *v)
+       __releases(RCU)
 {
        rcu_read_unlock();
 }
@@ -166,13 +164,9 @@ static const struct file_operations nflog_file_ops = {
 int __init netfilter_log_init(void)
 {
 #ifdef CONFIG_PROC_FS
-       struct proc_dir_entry *pde;
-
-       pde = create_proc_entry("nf_log", S_IRUGO, proc_net_netfilter);
-       if (!pde)
+       if (!proc_create("nf_log", S_IRUGO,
+                        proc_net_netfilter, &nflog_file_ops))
                return -1;
-
-       pde->proc_fops = &nflog_file_ops;
 #endif
        return 0;
 }