From 50907826b01fb170d1d61ea89f4fd72515ecf53e Mon Sep 17 00:00:00 2001 From: sven-ola Date: Thu, 7 Oct 2010 12:15:25 +0000 Subject: switched to pr_devel for debug msg git-svn-id: https://map66.svn.sourceforge.net/svnroot/map66@15 3484d885-4da6-438d-b19d-107d078dd756 --- Makefile | 2 +- ip6t_MAP66.c | 36 +++++++++++------------------------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index dbfc552..f54abf3 100644 --- a/Makefile +++ b/Makefile @@ -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,24 +144,20 @@ 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; -- cgit v1.2.3