diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | ip6t_MAP66.c | 36 |
2 files changed, 12 insertions, 26 deletions
@@ -4,7 +4,7 @@ KPATH := /lib/modules/$(KVERSION)/build IPTABLES_VERSION := $(shell ip6tables --version|sed 's/^.*\([[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+\).*/\1/') IPTABLES_VERSION_CODE := $(shell echo $$(( $$(echo $(IPTABLES_VERSION)|sed 's/^.*\([[:digit:]]\+\)\.\([[:digit:]]\+\)\.\([[:digit:]]\+\).*/\1 * 65536 + \2 * 256 + \3/') ))) ifeq ($(DEBUG),1) -EXTRA_CFLAGS := -DMAP66_DEBUG +EXTRA_CFLAGS := -DDEBUG endif all: libip6t_MAP66.so diff --git a/ip6t_MAP66.c b/ip6t_MAP66.c index 457bd5e..a887eef 100644 --- a/ip6t_MAP66.c +++ b/ip6t_MAP66.c @@ -86,24 +86,20 @@ static bool is_my_ipv6_addr( const struct net_device *dev, const struct in6_addr *addr) { -#ifdef MAP66_DEBUG #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28) - printk("MAP66: is_my_ipv6_addr(%s, " NIP6_FMT ")\n", NULL != dev ? dev->name : "", NIP6(*addr)); + pr_devel("MAP66: is_my_ipv6_addr(%s, " NIP6_FMT ")\n", NULL != dev ? dev->name : "", NIP6(*addr)); #else - printk("MAP66: is_my_ipv6_addr(%s, %pI6)\n", NULL != dev ? dev->name : "", addr); + pr_devel("MAP66: is_my_ipv6_addr(%s, %pI6)\n", NULL != dev ? dev->name : "", addr); #endif -#endif if (NULL != dev) { const struct inet6_ifaddr *ifa; const struct inet6_dev *idev = rcu_dereference(dev->ip6_ptr); for (ifa = idev->addr_list; NULL != ifa; ifa = ifa->if_next) { -#ifdef MAP66_DEBUG #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28) - printk("MAP66: cmp " NIP6_FMT "\n", NIP6(ifa->addr)); + pr_devel("MAP66: cmp " NIP6_FMT "\n", NIP6(ifa->addr)); #else - printk("MAP66: cmp %pI6\n", &ifa->addr); + pr_devel("MAP66: cmp %pI6\n", &ifa->addr); #endif -#endif if (ipv6_addr_equal(&ifa->addr, addr)) return true; } } @@ -117,25 +113,21 @@ static unsigned int MAP66_tg6( struct ipv6hdr *hdr = ipv6_hdr(skb); const struct ip6t_MAP66_info *info = par->targinfo; -#ifdef MAP66_DEBUG #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28) - printk("MAP66: enter in=%s, out=%s, saddr=" NIP6_FMT ", daddr=" NIP6_FMT "\n", + pr_devel("MAP66: enter in=%s, out=%s, saddr=" NIP6_FMT ", daddr=" NIP6_FMT "\n", NULL != par->in ? par->in->name : "", NULL != par->out ? par->out->name : "", NIP6(hdr->saddr), NIP6(hdr->daddr)); #else - printk("MAP66: enter in=%s, out=%s, saddr=%pI6, daddr=%pI6\n", + pr_devel("MAP66: enter in=%s, out=%s, saddr=%pI6, daddr=%pI6\n", NULL != par->in ? par->in->name : "", NULL != par->out ? par->out->name : "", &hdr->saddr, &hdr->daddr); #endif -#endif switch(par->hooknum) { case NF_INET_PRE_ROUTING: -#ifdef MAP66_DEBUG - printk("MAP66 PRE, check=%d\n", 0 != (IP6T_MAP66_OPT_NOCHECK & info->mapflags)); -#endif + pr_devel("MAP66 PRE, check=%d\n", 0 != (IP6T_MAP66_OPT_NOCHECK & info->mapflags)); if (0 != (IP6T_MAP66_OPT_NOCHECK & info->mapflags) || !is_my_ipv6_addr(par->in, &hdr->daddr)) { @@ -143,9 +135,7 @@ static unsigned int MAP66_tg6( } break; case NF_INET_POST_ROUTING: -#ifdef MAP66_DEBUG - printk("MAP66 POST, check=%d\n", 0 != (IP6T_MAP66_OPT_NOCHECK & info->mapflags)); -#endif + pr_devel("MAP66 POST, check=%d\n", 0 != (IP6T_MAP66_OPT_NOCHECK & info->mapflags)); map16(&hdr->saddr, info->prefixlength, &info->prefix, info->prefixcsum); if (0 == (IP6T_MAP66_OPT_NOCHECK & info->mapflags) && is_my_ipv6_addr(par->out, &hdr->saddr)) @@ -154,25 +144,21 @@ static unsigned int MAP66_tg6( } break; default: -#ifdef MAP66_DEBUG - printk("MAP66: unsupported hook: %d\n", par->hooknum); -#endif + pr_devel("MAP66: unsupported hook: %d\n", par->hooknum); break; } -#ifdef MAP66_DEBUG #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28) - printk("MAP66: exit in=%s, out=%s, saddr=" NIP6_FMT ", daddr=" NIP6_FMT "\n", + pr_devel("MAP66: exit in=%s, out=%s, saddr=" NIP6_FMT ", daddr=" NIP6_FMT "\n", NULL != par->in ? par->in->name : "", NULL != par->out ? par->out->name : "", NIP6(hdr->saddr), NIP6(hdr->daddr)); #else - printk("MAP66: exit in=%s, out=%s, saddr=%pI6, daddr=%pI6\n", + pr_devel("MAP66: exit in=%s, out=%s, saddr=%pI6, daddr=%pI6\n", NULL != par->in ? par->in->name : "", NULL != par->out ? par->out->name : "", &hdr->saddr, &hdr->daddr); #endif -#endif return IP6T_CONTINUE; } |