Unified · Split
| @@ -5,7 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | * it under the terms of the GNU General Public License version 2 as |
| 6 | 6 | * published by the Free Software Foundation. |
| 7 | 7 | */ |
| 8 | − | |
| 8 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 9 | 9 | #include <linux/in.h> |
| 10 | 10 | #include <linux/module.h> |
| 11 | 11 | #include <linux/skbuff.h> |
| @@ -18,21 +18,15 @@ MODULE_LICENSE("GPL"); · 6 unmodified lines | ||
| 18 | 18 | MODULE_AUTHOR("Yon Uriarte <yon@astaro.de>"); |
| 19 | 19 | MODULE_DESCRIPTION("Xtables: IPv4 IPsec-AH SPI match"); |
| 20 | 20 | |
| 21 | −#ifdef DEBUG_CONNTRACK | |
| 22 | −#define duprintf(format, args...) printk(format , ## args) | |
| 23 | −#else | |
| 24 | −#define duprintf(format, args...) | |
| 25 | −#endif | |
| 26 | − | |
| 27 | 21 | /* Returns 1 if the spi is matched by the range, 0 otherwise */ |
| 28 | 22 | static inline bool |
| 29 | 23 | spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) |
| 30 | 24 | { |
| 31 | 25 | bool r; |
| 32 | − duprintf("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', | |
| 33 | − min,spi,max); | |
| 26 | + pr_debug("spi_match:%c 0x%x <= 0x%x <= 0x%x\n", | |
| 27 | + invert ? '!' : ' ', min, spi, max); | |
| 34 | 28 | r=(spi >= min && spi <= max) ^ invert; |
| 35 | − duprintf(" result %s\n",r? "PASS" : "FAILED"); | |
| 29 | + pr_debug(" result %s\n", r ? "PASS" : "FAILED"); | |
| 36 | 30 | return r; |
| 37 | 31 | } |
| 38 | 32 | |
| @@ -51,7 +45,7 @@ static bool ah_mt(const struct sk_buff *skb, const struct xt_match_param *par) · 12 unmodified lines | ||
| 51 | 45 | /* We've been asked to examine this packet, and we |
| 52 | 46 | * can't. Hence, no choice but to drop. |
| 53 | 47 | */ |
| 54 | − duprintf("Dropping evil AH tinygram.\n"); | |
| 48 | + pr_debug("Dropping evil AH tinygram.\n"); | |
| 55 | 49 | *par->hotdrop = true; |
| 56 | 50 | return 0; |
| 57 | 51 | } |
| @@ -67,7 +61,7 @@ static bool ah_mt_check(const struct xt_mtchk_param *par) · 9 unmodified lines | ||
| 67 | 61 | |
| 68 | 62 | /* Must specify no unknown invflags */ |
| 69 | 63 | if (ahinfo->invflags & ~IPT_AH_INV_MASK) { |
| 70 | − duprintf("ipt_ah: unknown flags %X\n", ahinfo->invflags); | |
| 64 | + pr_debug("unknown flags %X\n", ahinfo->invflags); | |
| 71 | 65 | return false; |
| 72 | 66 | } |
| 73 | 67 | return true; |
| @@ -11,6 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | * Based on net/netfilter/xt_tcpudp.c |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 14 | 15 | #include <linux/types.h> |
| 15 | 16 | #include <linux/module.h> |
| 16 | 17 | #include <net/ip.h> |
| @@ -24,12 +25,6 @@ · 7 unmodified lines | ||
| 24 | 25 | MODULE_DESCRIPTION("Xtables: IPv6 Mobility Header match"); |
| 25 | 26 | MODULE_LICENSE("GPL"); |
| 26 | 27 | |
| 27 | −#ifdef DEBUG_IP_FIREWALL_USER | |
| 28 | −#define duprintf(format, args...) printk(format , ## args) | |
| 29 | −#else | |
| 30 | −#define duprintf(format, args...) | |
| 31 | −#endif | |
| 32 | − | |
| 33 | 28 | /* Returns 1 if the type is matched by the range, 0 otherwise */ |
| 34 | 29 | static inline bool |
| 35 | 30 | type_match(u_int8_t min, u_int8_t max, u_int8_t type, bool invert) |
| @@ -51,13 +46,13 @@ static bool mh_mt6(const struct sk_buff *skb, const struct xt_match_param *par) · 15 unmodified lines | ||
| 51 | 46 | if (mh == NULL) { |
| 52 | 47 | /* We've been asked to examine this packet, and we |
| 53 | 48 | can't. Hence, no choice but to drop. */ |
| 54 | − duprintf("Dropping evil MH tinygram.\n"); | |
| 49 | + pr_debug("Dropping evil MH tinygram.\n"); | |
| 55 | 50 | *par->hotdrop = true; |
| 56 | 51 | return false; |
| 57 | 52 | } |
| 58 | 53 | |
| 59 | 54 | if (mh->ip6mh_proto != IPPROTO_NONE) { |
| 60 | − duprintf("Dropping invalid MH Payload Proto: %u\n", | |
| 55 | + pr_debug("Dropping invalid MH Payload Proto: %u\n", | |
| 61 | 56 | mh->ip6mh_proto); |
| 62 | 57 | *par->hotdrop = true; |
| 63 | 58 | return false; |
| @@ -12,7 +12,7 @@ · 11 unmodified lines | ||
| 12 | 12 | * published by the Free Software Foundation. |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | − | |
| 15 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 16 | 16 | #include <linux/kernel.h> |
| 17 | 17 | #include <linux/socket.h> |
| 18 | 18 | #include <linux/net.h> |
| @@ -54,12 +54,6 @@ struct xt_af { · 35 unmodified lines | ||
| 54 | 54 | |
| 55 | 55 | static struct xt_af *xt; |
| 56 | 56 | |
| 57 | −#ifdef DEBUG_IP_FIREWALL_USER | |
| 58 | −#define duprintf(format, args...) printk(format , ## args) | |
| 59 | −#else | |
| 60 | −#define duprintf(format, args...) | |
| 61 | −#endif | |
| 62 | − | |
| 63 | 57 | static const char *const xt_prefix[NFPROTO_NUMPROTO] = { |
| 64 | 58 | [NFPROTO_UNSPEC] = "x", |
| 65 | 59 | [NFPROTO_IPV4] = "ip", |
| @@ -720,7 +714,7 @@ xt_replace_table(struct xt_table *table, · 654 unmodified lines | ||
| 720 | 714 | |
| 721 | 715 | /* Check inside lock: is the old number correct? */ |
| 722 | 716 | if (num_counters != private->number) { |
| 723 | − duprintf("num_counters != table->private->number (%u/%u)\n", | |
| 717 | + pr_debug("num_counters != table->private->number (%u/%u)\n", | |
| 724 | 718 | num_counters, private->number); |
| 725 | 719 | local_bh_enable(); |
| 726 | 720 | *error = -EAGAIN; |
| @@ -777,7 +771,7 @@ struct xt_table *xt_register_table(struct net *net, · 50 unmodified lines | ||
| 777 | 771 | goto unlock; |
| 778 | 772 | |
| 779 | 773 | private = table->private; |
| 780 | − duprintf("table->private->number = %u\n", private->number); | |
| 774 | + pr_debug("table->private->number = %u\n", private->number); | |
| 781 | 775 | |
| 782 | 776 | /* save number of initial entries */ |
| 783 | 777 | private->initial_entries = private->number; |
| @@ -6,7 +6,7 @@ · 5 unmodified lines | ||
| 6 | 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | 7 | * published by the Free Software Foundation. |
| 8 | 8 | */ |
| 9 | − | |
| 9 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 10 | 10 | #include <linux/module.h> |
| 11 | 11 | #include <linux/skbuff.h> |
| 12 | 12 | #include <linux/in.h> |
| @@ -24,21 +24,15 @@ MODULE_DESCRIPTION("Xtables: IPsec-ESP packet match"); · 11 unmodified lines | ||
| 24 | 24 | MODULE_ALIAS("ipt_esp"); |
| 25 | 25 | MODULE_ALIAS("ip6t_esp"); |
| 26 | 26 | |
| 27 | −#if 0 | |
| 28 | −#define duprintf(format, args...) printk(format , ## args) | |
| 29 | −#else | |
| 30 | −#define duprintf(format, args...) | |
| 31 | −#endif | |
| 32 | − | |
| 33 | 27 | /* Returns 1 if the spi is matched by the range, 0 otherwise */ |
| 34 | 28 | static inline bool |
| 35 | 29 | spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, bool invert) |
| 36 | 30 | { |
| 37 | 31 | bool r; |
| 38 | − duprintf("esp spi_match:%c 0x%x <= 0x%x <= 0x%x", invert ? '!' : ' ', | |
| 39 | − min, spi, max); | |
| 32 | + pr_debug("esp spi_match:%c 0x%x <= 0x%x <= 0x%x\n", | |
| 33 | + invert ? '!' : ' ', min, spi, max); | |
| 40 | 34 | r = (spi >= min && spi <= max) ^ invert; |
| 41 | − duprintf(" result %s\n", r ? "PASS" : "FAILED"); | |
| 35 | + pr_debug(" result %s\n", r ? "PASS" : "FAILED"); | |
| 42 | 36 | return r; |
| 43 | 37 | } |
| 44 | 38 | |
| @@ -57,7 +51,7 @@ static bool esp_mt(const struct sk_buff *skb, const struct xt_match_param *par) · 12 unmodified lines | ||
| 57 | 51 | /* We've been asked to examine this packet, and we |
| 58 | 52 | * can't. Hence, no choice but to drop. |
| 59 | 53 | */ |
| 60 | − duprintf("Dropping evil ESP tinygram.\n"); | |
| 54 | + pr_debug("Dropping evil ESP tinygram.\n"); | |
| 61 | 55 | *par->hotdrop = true; |
| 62 | 56 | return false; |
| 63 | 57 | } |
| @@ -71,7 +65,7 @@ static bool esp_mt_check(const struct xt_mtchk_param *par) · 7 unmodified lines | ||
| 71 | 65 | const struct xt_esp *espinfo = par->matchinfo; |
| 72 | 66 | |
| 73 | 67 | if (espinfo->invflags & ~XT_ESP_INV_MASK) { |
| 74 | − duprintf("xt_esp: unknown flags %X\n", espinfo->invflags); | |
| 68 | + pr_debug("unknown flags %X\n", espinfo->invflags); | |
| 75 | 69 | return false; |
| 76 | 70 | } |
| 77 | 71 | |
| @@ -8,7 +8,7 @@ · 7 unmodified lines | ||
| 8 | 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | 9 | * published by the Free Software Foundation. |
| 10 | 10 | */ |
| 11 | − | |
| 11 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 12 | 12 | #include <linux/module.h> |
| 13 | 13 | #include <linux/types.h> |
| 14 | 14 | #include <linux/udp.h> |
| @@ -26,12 +26,6 @@ MODULE_DESCRIPTION("Xtables: multiple port matching for TCP, UDP, UDP-Lite, SCTP · 11 unmodified lines | ||
| 26 | 26 | MODULE_ALIAS("ipt_multiport"); |
| 27 | 27 | MODULE_ALIAS("ip6t_multiport"); |
| 28 | 28 | |
| 29 | −#if 0 | |
| 30 | −#define duprintf(format, args...) printk(format , ## args) | |
| 31 | −#else | |
| 32 | −#define duprintf(format, args...) | |
| 33 | −#endif | |
| 34 | − | |
| 35 | 29 | /* Returns 1 if the port is matched by the test, 0 otherwise. */ |
| 36 | 30 | static inline bool |
| 37 | 31 | ports_match_v0(const u_int16_t *portlist, enum xt_multiport_flags flags, |
| @@ -63,7 +57,7 @@ ports_match_v1(const struct xt_multiport_v1 *minfo, · 25 unmodified lines | ||
| 63 | 57 | if (minfo->pflags[i]) { |
| 64 | 58 | /* range port matching */ |
| 65 | 59 | e = minfo->ports[++i]; |
| 66 | − duprintf("src or dst matches with %d-%d?\n", s, e); | |
| 60 | + pr_debug("src or dst matches with %d-%d?\n", s, e); | |
| 67 | 61 | |
| 68 | 62 | if (minfo->flags == XT_MULTIPORT_SOURCE |
| 69 | 63 | && src >= s && src <= e) |
| @@ -77,7 +71,7 @@ ports_match_v1(const struct xt_multiport_v1 *minfo, · 7 unmodified lines | ||
| 77 | 71 | return true ^ minfo->invert; |
| 78 | 72 | } else { |
| 79 | 73 | /* exact port matching */ |
| 80 | − duprintf("src or dst matches with %d?\n", s); | |
| 74 | + pr_debug("src or dst matches with %d?\n", s); | |
| 81 | 75 | |
| 82 | 76 | if (minfo->flags == XT_MULTIPORT_SOURCE |
| 83 | 77 | && src == s) |
| @@ -109,7 +103,7 @@ multiport_mt_v0(const struct sk_buff *skb, const struct xt_match_param *par) · 25 unmodified lines | ||
| 109 | 103 | /* We've been asked to examine this packet, and we |
| 110 | 104 | * can't. Hence, no choice but to drop. |
| 111 | 105 | */ |
| 112 | − duprintf("xt_multiport: Dropping evil offset=0 tinygram.\n"); | |
| 106 | + pr_debug("Dropping evil offset=0 tinygram.\n"); | |
| 113 | 107 | *par->hotdrop = true; |
| 114 | 108 | return false; |
| 115 | 109 | } |
| @@ -133,7 +127,7 @@ multiport_mt(const struct sk_buff *skb, const struct xt_match_param *par) · 17 unmodified lines | ||
| 133 | 127 | /* We've been asked to examine this packet, and we |
| 134 | 128 | * can't. Hence, no choice but to drop. |
| 135 | 129 | */ |
| 136 | − duprintf("xt_multiport: Dropping evil offset=0 tinygram.\n"); | |
| 130 | + pr_debug("Dropping evil offset=0 tinygram.\n"); | |
| 137 | 131 | *par->hotdrop = true; |
| 138 | 132 | return false; |
| 139 | 133 | } |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 1 | 2 | #include <linux/module.h> |
| 2 | 3 | #include <linux/skbuff.h> |
| 3 | 4 | #include <net/ip.h> |
| @@ -15,12 +16,6 @@ MODULE_DESCRIPTION("Xtables: SCTP protocol packet match"); · 11 unmodified lines | ||
| 15 | 16 | MODULE_ALIAS("ipt_sctp"); |
| 16 | 17 | MODULE_ALIAS("ip6t_sctp"); |
| 17 | 18 | |
| 18 | −#ifdef DEBUG_SCTP | |
| 19 | −#define duprintf(format, args...) printk(format , ## args) | |
| 20 | −#else | |
| 21 | −#define duprintf(format, args...) | |
| 22 | −#endif | |
| 23 | − | |
| 24 | 19 | #define SCCHECK(cond, option, flag, invflag) (!((flag) & (option)) \ |
| 25 | 20 | || (!!((invflag) & (option)) ^ (cond))) |
| 26 | 21 | |
| @@ -52,7 +47,7 @@ match_packet(const struct sk_buff *skb, · 25 unmodified lines | ||
| 52 | 47 | const struct xt_sctp_flag_info *flag_info = info->flag_info; |
| 53 | 48 | int flag_count = info->flag_count; |
| 54 | 49 | |
| 55 | −#ifdef DEBUG_SCTP | |
| 50 | +#ifdef DEBUG | |
| 56 | 51 | int i = 0; |
| 57 | 52 | #endif |
| 58 | 53 | |
| @@ -62,17 +57,19 @@ match_packet(const struct sk_buff *skb, · 3 unmodified lines | ||
| 62 | 57 | do { |
| 63 | 58 | sch = skb_header_pointer(skb, offset, sizeof(_sch), &_sch); |
| 64 | 59 | if (sch == NULL || sch->length == 0) { |
| 65 | − duprintf("Dropping invalid SCTP packet.\n"); | |
| 60 | + pr_debug("Dropping invalid SCTP packet.\n"); | |
| 66 | 61 | *hotdrop = true; |
| 67 | 62 | return false; |
| 68 | 63 | } |
| 69 | − | |
| 70 | − duprintf("Chunk num: %d\toffset: %d\ttype: %d\tlength: %d\tflags: %x\n", | |
| 71 | − ++i, offset, sch->type, htons(sch->length), sch->flags); | |
| 72 | − | |
| 64 | +#ifdef DEBUG | |
| 65 | + pr_debug("Chunk num: %d\toffset: %d\ttype: %d\tlength: %d" | |
| 66 | + "\tflags: %x\n", | |
| 67 | + ++i, offset, sch->type, htons(sch->length), | |
| 68 | + sch->flags); | |
| 69 | +#endif | |
| 73 | 70 | offset += (ntohs(sch->length) + 3) & ~3; |
| 74 | 71 | |
| 75 | − duprintf("skb->len: %d\toffset: %d\n", skb->len, offset); | |
| 72 | + pr_debug("skb->len: %d\toffset: %d\n", skb->len, offset); | |
| 76 | 73 | |
| 77 | 74 | if (SCTP_CHUNKMAP_IS_SET(info->chunkmap, sch->type)) { |
| 78 | 75 | switch (chunk_match_type) { |
| @@ -124,17 +121,17 @@ sctp_mt(const struct sk_buff *skb, const struct xt_match_param *par) · 45 unmodified lines | ||
| 124 | 121 | sctp_sctphdr_t _sh; |
| 125 | 122 | |
| 126 | 123 | if (par->fragoff != 0) { |
| 127 | − duprintf("Dropping non-first fragment.. FIXME\n"); | |
| 124 | + pr_debug("Dropping non-first fragment.. FIXME\n"); | |
| 128 | 125 | return false; |
| 129 | 126 | } |
| 130 | 127 | |
| 131 | 128 | sh = skb_header_pointer(skb, par->thoff, sizeof(_sh), &_sh); |
| 132 | 129 | if (sh == NULL) { |
| 133 | − duprintf("Dropping evil TCP offset=0 tinygram.\n"); | |
| 130 | + pr_debug("Dropping evil TCP offset=0 tinygram.\n"); | |
| 134 | 131 | *par->hotdrop = true; |
| 135 | 132 | return false; |
| 136 | 133 | } |
| 137 | − duprintf("spt: %d\tdpt: %d\n", ntohs(sh->source), ntohs(sh->dest)); | |
| 134 | + pr_debug("spt: %d\tdpt: %d\n", ntohs(sh->source), ntohs(sh->dest)); | |
| 138 | 135 | |
| 139 | 136 | return SCCHECK(ntohs(sh->source) >= info->spts[0] |
| 140 | 137 | && ntohs(sh->source) <= info->spts[1], |
| @@ -1,3 +1,4 @@ | ||
| 1 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 1 | 2 | #include <linux/types.h> |
| 2 | 3 | #include <linux/module.h> |
| 3 | 4 | #include <net/ip.h> |
| @@ -19,13 +20,6 @@ MODULE_ALIAS("ipt_tcp"); · 15 unmodified lines | ||
| 19 | 20 | MODULE_ALIAS("ip6t_udp"); |
| 20 | 21 | MODULE_ALIAS("ip6t_tcp"); |
| 21 | 22 | |
| 22 | −#ifdef DEBUG_IP_FIREWALL_USER | |
| 23 | −#define duprintf(format, args...) printk(format , ## args) | |
| 24 | −#else | |
| 25 | −#define duprintf(format, args...) | |
| 26 | −#endif | |
| 27 | − | |
| 28 | − | |
| 29 | 23 | /* Returns 1 if the port is matched by the range, 0 otherwise */ |
| 30 | 24 | static inline bool |
| 31 | 25 | port_match(u_int16_t min, u_int16_t max, u_int16_t port, bool invert) |
| @@ -46,7 +40,7 @@ tcp_find_option(u_int8_t option, · 14 unmodified lines | ||
| 46 | 40 | u_int8_t _opt[60 - sizeof(struct tcphdr)]; |
| 47 | 41 | unsigned int i; |
| 48 | 42 | |
| 49 | − duprintf("tcp_match: finding option\n"); | |
| 43 | + pr_debug("finding option\n"); | |
| 50 | 44 | |
| 51 | 45 | if (!optlen) |
| 52 | 46 | return invert; |
| @@ -82,7 +76,7 @@ static bool tcp_mt(const struct sk_buff *skb, const struct xt_match_param *par) · 29 unmodified lines | ||
| 82 | 76 | flag overwrite to pass the direction checks. |
| 83 | 77 | */ |
| 84 | 78 | if (par->fragoff == 1) { |
| 85 | − duprintf("Dropping evil TCP offset=1 frag.\n"); | |
| 79 | + pr_debug("Dropping evil TCP offset=1 frag.\n"); | |
| 86 | 80 | *par->hotdrop = true; |
| 87 | 81 | } |
| 88 | 82 | /* Must not be a fragment. */ |
| @@ -95,7 +89,7 @@ static bool tcp_mt(const struct sk_buff *skb, const struct xt_match_param *par) · 6 unmodified lines | ||
| 95 | 89 | if (th == NULL) { |
| 96 | 90 | /* We've been asked to examine this packet, and we |
| 97 | 91 | can't. Hence, no choice but to drop. */ |
| 98 | − duprintf("Dropping evil TCP offset=0 tinygram.\n"); | |
| 92 | + pr_debug("Dropping evil TCP offset=0 tinygram.\n"); | |
| 99 | 93 | *par->hotdrop = true; |
| 100 | 94 | return false; |
| 101 | 95 | } |
| @@ -148,7 +142,7 @@ static bool udp_mt(const struct sk_buff *skb, const struct xt_match_param *par) · 46 unmodified lines | ||
| 148 | 142 | if (uh == NULL) { |
| 149 | 143 | /* We've been asked to examine this packet, and we |
| 150 | 144 | can't. Hence, no choice but to drop. */ |
| 151 | − duprintf("Dropping evil UDP tinygram.\n"); | |
| 145 | + pr_debug("Dropping evil UDP tinygram.\n"); | |
| 152 | 146 | *par->hotdrop = true; |
| 153 | 147 | return false; |
| 154 | 148 | } |