]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/netfilter/ipt_ULOG.c
[SCSI] fix netlink kernel-doc
[linux-2.6-omap-h63xx.git] / net / ipv4 / netfilter / ipt_ULOG.c
index 212b830765a49f75abc1a9ca334d6748e2d99147..18a2826b57c6f2c7e16cd2c091ca68db772b61f6 100644 (file)
 #include <linux/netfilter.h>
 #include <linux/netfilter/x_tables.h>
 #include <linux/netfilter_ipv4/ipt_ULOG.h>
+#include <net/netfilter/nf_log.h>
 #include <net/sock.h>
 #include <linux/bitops.h>
 #include <asm/unaligned.h>
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
-MODULE_DESCRIPTION("iptables userspace logging module");
+MODULE_DESCRIPTION("Xtables: packet logging to netlink using ULOG");
 MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_NFLOG);
 
 #define ULOG_NL_EVENT          111             /* Harald's favorite number */
@@ -279,21 +280,15 @@ alloc_failure:
        spin_unlock_bh(&ulog_lock);
 }
 
-static unsigned int ipt_ulog_target(struct sk_buff *skb,
-                                   const struct net_device *in,
-                                   const struct net_device *out,
-                                   unsigned int hooknum,
-                                   const struct xt_target *target,
-                                   const void *targinfo)
+static unsigned int
+ulog_tg(struct sk_buff *skb, const struct xt_target_param *par)
 {
-       struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo;
-
-       ipt_ulog_packet(hooknum, skb, in, out, loginfo, NULL);
-
+       ipt_ulog_packet(par->hooknum, skb, par->in, par->out,
+                       par->targinfo, NULL);
        return XT_CONTINUE;
 }
 
-static void ipt_logfn(unsigned int pf,
+static void ipt_logfn(u_int8_t pf,
                      unsigned int hooknum,
                      const struct sk_buff *skb,
                      const struct net_device *in,
@@ -318,13 +313,9 @@ static void ipt_logfn(unsigned int pf,
        ipt_ulog_packet(hooknum, skb, in, out, &loginfo, prefix);
 }
 
-static bool ipt_ulog_checkentry(const char *tablename,
-                               const void *e,
-                               const struct xt_target *target,
-                               void *targinfo,
-                               unsigned int hookmask)
+static bool ulog_tg_check(const struct xt_tgchk_param *par)
 {
-       const struct ipt_ulog_info *loginfo = targinfo;
+       const struct ipt_ulog_info *loginfo = par->targinfo;
 
        if (loginfo->prefix[sizeof(loginfo->prefix) - 1] != '\0') {
                pr_debug("ipt_ULOG: prefix term %i\n",
@@ -347,7 +338,7 @@ struct compat_ipt_ulog_info {
        char            prefix[ULOG_PREFIX_LEN];
 };
 
-static void compat_from_user(void *dst, void *src)
+static void ulog_tg_compat_from_user(void *dst, void *src)
 {
        const struct compat_ipt_ulog_info *cl = src;
        struct ipt_ulog_info l = {
@@ -360,7 +351,7 @@ static void compat_from_user(void *dst, void *src)
        memcpy(dst, &l, sizeof(l));
 }
 
-static int compat_to_user(void __user *dst, void *src)
+static int ulog_tg_compat_to_user(void __user *dst, void *src)
 {
        const struct ipt_ulog_info *l = src;
        struct compat_ipt_ulog_info cl = {
@@ -374,16 +365,16 @@ static int compat_to_user(void __user *dst, void *src)
 }
 #endif /* CONFIG_COMPAT */
 
-static struct xt_target ipt_ulog_reg __read_mostly = {
+static struct xt_target ulog_tg_reg __read_mostly = {
        .name           = "ULOG",
-       .family         = AF_INET,
-       .target         = ipt_ulog_target,
+       .family         = NFPROTO_IPV4,
+       .target         = ulog_tg,
        .targetsize     = sizeof(struct ipt_ulog_info),
-       .checkentry     = ipt_ulog_checkentry,
+       .checkentry     = ulog_tg_check,
 #ifdef CONFIG_COMPAT
        .compatsize     = sizeof(struct compat_ipt_ulog_info),
-       .compat_from_user = compat_from_user,
-       .compat_to_user = compat_to_user,
+       .compat_from_user = ulog_tg_compat_from_user,
+       .compat_to_user = ulog_tg_compat_to_user,
 #endif
        .me             = THIS_MODULE,
 };
@@ -394,7 +385,7 @@ static struct nf_logger ipt_ulog_logger = {
        .me             = THIS_MODULE,
 };
 
-static int __init ipt_ulog_init(void)
+static int __init ulog_tg_init(void)
 {
        int ret, i;
 
@@ -415,18 +406,18 @@ static int __init ipt_ulog_init(void)
        if (!nflognl)
                return -ENOMEM;
 
-       ret = xt_register_target(&ipt_ulog_reg);
+       ret = xt_register_target(&ulog_tg_reg);
        if (ret < 0) {
-               sock_release(nflognl->sk_socket);
+               netlink_kernel_release(nflognl);
                return ret;
        }
        if (nflog)
-               nf_log_register(PF_INET, &ipt_ulog_logger);
+               nf_log_register(NFPROTO_IPV4, &ipt_ulog_logger);
 
        return 0;
 }
 
-static void __exit ipt_ulog_fini(void)
+static void __exit ulog_tg_exit(void)
 {
        ulog_buff_t *ub;
        int i;
@@ -435,8 +426,8 @@ static void __exit ipt_ulog_fini(void)
 
        if (nflog)
                nf_log_unregister(&ipt_ulog_logger);
-       xt_unregister_target(&ipt_ulog_reg);
-       sock_release(nflognl->sk_socket);
+       xt_unregister_target(&ulog_tg_reg);
+       netlink_kernel_release(nflognl);
 
        /* remove pending timers and free allocated skb's */
        for (i = 0; i < ULOG_MAXNLGROUPS; i++) {
@@ -453,5 +444,5 @@ static void __exit ipt_ulog_fini(void)
        }
 }
 
-module_init(ipt_ulog_init);
-module_exit(ipt_ulog_fini);
+module_init(ulog_tg_init);
+module_exit(ulog_tg_exit);