diff options
author | Jan Engelhardt <jengelh@medozas.de> | 2010-03-19 16:08:16 -0400 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2010-03-25 10:00:04 -0400 |
commit | ff67e4e42bd178b1179c4d8e5c1fde18758ce84f (patch) | |
tree | 5d4cc857d4bac40c3d78f90f8e21f12c424737a4 /net/bridge | |
parent | 0d34545563f99886b997be7da63f0e8084af3bc5 (diff) |
netfilter: xt extensions: use pr_<level> (2)
Supplement to 1159683ef48469de71dc26f0ee1a9c30d131cf89.
Downgrade the log level to INFO for most checkentry messages as they
are, IMO, just an extra information to the -EINVAL code that is
returned as part of a parameter "constraint violation". Leave errors
to real errors, such as being unable to create a LED trigger.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/netfilter/ebt_among.c | 15 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_limit.c | 3 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_ulog.c | 23 | ||||
-rw-r--r-- | net/bridge/netfilter/ebt_vlan.c | 36 | ||||
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 5 |
5 files changed, 32 insertions, 50 deletions
diff --git a/net/bridge/netfilter/ebt_among.c b/net/bridge/netfilter/ebt_among.c index b595f091f35b..60ad6308bc1f 100644 --- a/net/bridge/netfilter/ebt_among.c +++ b/net/bridge/netfilter/ebt_among.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * August, 2003 | 7 | * August, 2003 |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
10 | #include <linux/ip.h> | 11 | #include <linux/ip.h> |
11 | #include <linux/if_arp.h> | 12 | #include <linux/if_arp.h> |
12 | #include <linux/module.h> | 13 | #include <linux/module.h> |
@@ -186,21 +187,17 @@ static bool ebt_among_mt_check(const struct xt_mtchk_param *par) | |||
186 | expected_length += ebt_mac_wormhash_size(wh_src); | 187 | expected_length += ebt_mac_wormhash_size(wh_src); |
187 | 188 | ||
188 | if (em->match_size != EBT_ALIGN(expected_length)) { | 189 | if (em->match_size != EBT_ALIGN(expected_length)) { |
189 | printk(KERN_WARNING | 190 | pr_info("wrong size: %d against expected %d, rounded to %Zd\n", |
190 | "ebtables: among: wrong size: %d " | 191 | em->match_size, expected_length, |
191 | "against expected %d, rounded to %Zd\n", | 192 | EBT_ALIGN(expected_length)); |
192 | em->match_size, expected_length, | ||
193 | EBT_ALIGN(expected_length)); | ||
194 | return false; | 193 | return false; |
195 | } | 194 | } |
196 | if (wh_dst && (err = ebt_mac_wormhash_check_integrity(wh_dst))) { | 195 | if (wh_dst && (err = ebt_mac_wormhash_check_integrity(wh_dst))) { |
197 | printk(KERN_WARNING | 196 | pr_info("dst integrity fail: %x\n", -err); |
198 | "ebtables: among: dst integrity fail: %x\n", -err); | ||
199 | return false; | 197 | return false; |
200 | } | 198 | } |
201 | if (wh_src && (err = ebt_mac_wormhash_check_integrity(wh_src))) { | 199 | if (wh_src && (err = ebt_mac_wormhash_check_integrity(wh_src))) { |
202 | printk(KERN_WARNING | 200 | pr_info("src integrity fail: %x\n", -err); |
203 | "ebtables: among: src integrity fail: %x\n", -err); | ||
204 | return false; | 201 | return false; |
205 | } | 202 | } |
206 | return true; | 203 | return true; |
diff --git a/net/bridge/netfilter/ebt_limit.c b/net/bridge/netfilter/ebt_limit.c index 7a8182710eb3..5b7330b62541 100644 --- a/net/bridge/netfilter/ebt_limit.c +++ b/net/bridge/netfilter/ebt_limit.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * September, 2003 | 10 | * September, 2003 |
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | #include <linux/netdevice.h> | 15 | #include <linux/netdevice.h> |
15 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
@@ -71,7 +72,7 @@ static bool ebt_limit_mt_check(const struct xt_mtchk_param *par) | |||
71 | /* Check for overflow. */ | 72 | /* Check for overflow. */ |
72 | if (info->burst == 0 || | 73 | if (info->burst == 0 || |
73 | user2credits(info->avg * info->burst) < user2credits(info->avg)) { | 74 | user2credits(info->avg * info->burst) < user2credits(info->avg)) { |
74 | printk("Overflow in ebt_limit, try lower: %u/%u\n", | 75 | pr_info("overflow, try lower: %u/%u\n", |
75 | info->avg, info->burst); | 76 | info->avg, info->burst); |
76 | return false; | 77 | return false; |
77 | } | 78 | } |
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c index 84340ab30ed3..789ea36f1db1 100644 --- a/net/bridge/netfilter/ebt_ulog.c +++ b/net/bridge/netfilter/ebt_ulog.c | |||
@@ -27,7 +27,7 @@ | |||
27 | * flushed even if it is not full yet. | 27 | * flushed even if it is not full yet. |
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | 30 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
33 | #include <linux/socket.h> | 33 | #include <linux/socket.h> |
@@ -43,9 +43,6 @@ | |||
43 | #include <net/sock.h> | 43 | #include <net/sock.h> |
44 | #include "../br_private.h" | 44 | #include "../br_private.h" |
45 | 45 | ||
46 | #define PRINTR(format, args...) do { if (net_ratelimit()) \ | ||
47 | printk(format , ## args); } while (0) | ||
48 | |||
49 | static unsigned int nlbufsiz = NLMSG_GOODSIZE; | 46 | static unsigned int nlbufsiz = NLMSG_GOODSIZE; |
50 | module_param(nlbufsiz, uint, 0600); | 47 | module_param(nlbufsiz, uint, 0600); |
51 | MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) " | 48 | MODULE_PARM_DESC(nlbufsiz, "netlink buffer size (number of bytes) " |
@@ -106,15 +103,14 @@ static struct sk_buff *ulog_alloc_skb(unsigned int size) | |||
106 | n = max(size, nlbufsiz); | 103 | n = max(size, nlbufsiz); |
107 | skb = alloc_skb(n, GFP_ATOMIC); | 104 | skb = alloc_skb(n, GFP_ATOMIC); |
108 | if (!skb) { | 105 | if (!skb) { |
109 | PRINTR(KERN_ERR "ebt_ulog: can't alloc whole buffer " | 106 | pr_debug("cannot alloc whole buffer of size %ub!\n", n); |
110 | "of size %ub!\n", n); | ||
111 | if (n > size) { | 107 | if (n > size) { |
112 | /* try to allocate only as much as we need for | 108 | /* try to allocate only as much as we need for |
113 | * current packet */ | 109 | * current packet */ |
114 | skb = alloc_skb(size, GFP_ATOMIC); | 110 | skb = alloc_skb(size, GFP_ATOMIC); |
115 | if (!skb) | 111 | if (!skb) |
116 | PRINTR(KERN_ERR "ebt_ulog: can't even allocate " | 112 | pr_debug("cannot even allocate " |
117 | "buffer of size %ub\n", size); | 113 | "buffer of size %ub\n", size); |
118 | } | 114 | } |
119 | } | 115 | } |
120 | 116 | ||
@@ -141,8 +137,7 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb, | |||
141 | 137 | ||
142 | size = NLMSG_SPACE(sizeof(*pm) + copy_len); | 138 | size = NLMSG_SPACE(sizeof(*pm) + copy_len); |
143 | if (size > nlbufsiz) { | 139 | if (size > nlbufsiz) { |
144 | PRINTR("ebt_ulog: Size %Zd needed, but nlbufsiz=%d\n", | 140 | pr_debug("Size %Zd needed, but nlbufsiz=%d\n", size, nlbufsiz); |
145 | size, nlbufsiz); | ||
146 | return; | 141 | return; |
147 | } | 142 | } |
148 | 143 | ||
@@ -216,8 +211,8 @@ unlock: | |||
216 | return; | 211 | return; |
217 | 212 | ||
218 | nlmsg_failure: | 213 | nlmsg_failure: |
219 | printk(KERN_CRIT "ebt_ulog: error during NLMSG_PUT. This should " | 214 | pr_debug("error during NLMSG_PUT. This should " |
220 | "not happen, please report to author.\n"); | 215 | "not happen, please report to author.\n"); |
221 | goto unlock; | 216 | goto unlock; |
222 | alloc_failure: | 217 | alloc_failure: |
223 | goto unlock; | 218 | goto unlock; |
@@ -291,8 +286,8 @@ static int __init ebt_ulog_init(void) | |||
291 | int i; | 286 | int i; |
292 | 287 | ||
293 | if (nlbufsiz >= 128*1024) { | 288 | if (nlbufsiz >= 128*1024) { |
294 | printk(KERN_NOTICE "ebt_ulog: Netlink buffer has to be <= 128kB," | 289 | pr_warning("Netlink buffer has to be <= 128kB," |
295 | " please try a smaller nlbufsiz parameter.\n"); | 290 | " please try a smaller nlbufsiz parameter.\n"); |
296 | return -EINVAL; | 291 | return -EINVAL; |
297 | } | 292 | } |
298 | 293 | ||
diff --git a/net/bridge/netfilter/ebt_vlan.c b/net/bridge/netfilter/ebt_vlan.c index be1dd2e1f615..5c44f51063c3 100644 --- a/net/bridge/netfilter/ebt_vlan.c +++ b/net/bridge/netfilter/ebt_vlan.c | |||
@@ -26,17 +26,12 @@ | |||
26 | #include <linux/netfilter_bridge/ebtables.h> | 26 | #include <linux/netfilter_bridge/ebtables.h> |
27 | #include <linux/netfilter_bridge/ebt_vlan.h> | 27 | #include <linux/netfilter_bridge/ebt_vlan.h> |
28 | 28 | ||
29 | static int debug; | ||
30 | #define MODULE_VERS "0.6" | 29 | #define MODULE_VERS "0.6" |
31 | 30 | ||
32 | module_param(debug, int, 0); | ||
33 | MODULE_PARM_DESC(debug, "debug=1 is turn on debug messages"); | ||
34 | MODULE_AUTHOR("Nick Fedchik <nick@fedchik.org.ua>"); | 31 | MODULE_AUTHOR("Nick Fedchik <nick@fedchik.org.ua>"); |
35 | MODULE_DESCRIPTION("Ebtables: 802.1Q VLAN tag match"); | 32 | MODULE_DESCRIPTION("Ebtables: 802.1Q VLAN tag match"); |
36 | MODULE_LICENSE("GPL"); | 33 | MODULE_LICENSE("GPL"); |
37 | 34 | ||
38 | |||
39 | #define DEBUG_MSG(args...) if (debug) printk (KERN_DEBUG "ebt_vlan: " args) | ||
40 | #define GET_BITMASK(_BIT_MASK_) info->bitmask & _BIT_MASK_ | 35 | #define GET_BITMASK(_BIT_MASK_) info->bitmask & _BIT_MASK_ |
41 | #define EXIT_ON_MISMATCH(_MATCH_,_MASK_) {if (!((info->_MATCH_ == _MATCH_)^!!(info->invflags & _MASK_))) return false; } | 36 | #define EXIT_ON_MISMATCH(_MATCH_,_MASK_) {if (!((info->_MATCH_ == _MATCH_)^!!(info->invflags & _MASK_))) return false; } |
42 | 37 | ||
@@ -91,24 +86,23 @@ static bool ebt_vlan_mt_check(const struct xt_mtchk_param *par) | |||
91 | 86 | ||
92 | /* Is it 802.1Q frame checked? */ | 87 | /* Is it 802.1Q frame checked? */ |
93 | if (e->ethproto != htons(ETH_P_8021Q)) { | 88 | if (e->ethproto != htons(ETH_P_8021Q)) { |
94 | DEBUG_MSG | 89 | pr_debug("passed entry proto %2.4X is not 802.1Q (8100)\n", |
95 | ("passed entry proto %2.4X is not 802.1Q (8100)\n", | 90 | ntohs(e->ethproto)); |
96 | (unsigned short) ntohs(e->ethproto)); | ||
97 | return false; | 91 | return false; |
98 | } | 92 | } |
99 | 93 | ||
100 | /* Check for bitmask range | 94 | /* Check for bitmask range |
101 | * True if even one bit is out of mask */ | 95 | * True if even one bit is out of mask */ |
102 | if (info->bitmask & ~EBT_VLAN_MASK) { | 96 | if (info->bitmask & ~EBT_VLAN_MASK) { |
103 | DEBUG_MSG("bitmask %2X is out of mask (%2X)\n", | 97 | pr_debug("bitmask %2X is out of mask (%2X)\n", |
104 | info->bitmask, EBT_VLAN_MASK); | 98 | info->bitmask, EBT_VLAN_MASK); |
105 | return false; | 99 | return false; |
106 | } | 100 | } |
107 | 101 | ||
108 | /* Check for inversion flags range */ | 102 | /* Check for inversion flags range */ |
109 | if (info->invflags & ~EBT_VLAN_MASK) { | 103 | if (info->invflags & ~EBT_VLAN_MASK) { |
110 | DEBUG_MSG("inversion flags %2X is out of mask (%2X)\n", | 104 | pr_debug("inversion flags %2X is out of mask (%2X)\n", |
111 | info->invflags, EBT_VLAN_MASK); | 105 | info->invflags, EBT_VLAN_MASK); |
112 | return false; | 106 | return false; |
113 | } | 107 | } |
114 | 108 | ||
@@ -121,9 +115,8 @@ static bool ebt_vlan_mt_check(const struct xt_mtchk_param *par) | |||
121 | if (GET_BITMASK(EBT_VLAN_ID)) { | 115 | if (GET_BITMASK(EBT_VLAN_ID)) { |
122 | if (!!info->id) { /* if id!=0 => check vid range */ | 116 | if (!!info->id) { /* if id!=0 => check vid range */ |
123 | if (info->id > VLAN_GROUP_ARRAY_LEN) { | 117 | if (info->id > VLAN_GROUP_ARRAY_LEN) { |
124 | DEBUG_MSG | 118 | pr_debug("id %d is out of range (1-4096)\n", |
125 | ("id %d is out of range (1-4096)\n", | 119 | info->id); |
126 | info->id); | ||
127 | return false; | 120 | return false; |
128 | } | 121 | } |
129 | /* Note: This is valid VLAN-tagged frame point. | 122 | /* Note: This is valid VLAN-tagged frame point. |
@@ -137,8 +130,8 @@ static bool ebt_vlan_mt_check(const struct xt_mtchk_param *par) | |||
137 | 130 | ||
138 | if (GET_BITMASK(EBT_VLAN_PRIO)) { | 131 | if (GET_BITMASK(EBT_VLAN_PRIO)) { |
139 | if ((unsigned char) info->prio > 7) { | 132 | if ((unsigned char) info->prio > 7) { |
140 | DEBUG_MSG("prio %d is out of range (0-7)\n", | 133 | pr_debug("prio %d is out of range (0-7)\n", |
141 | info->prio); | 134 | info->prio); |
142 | return false; | 135 | return false; |
143 | } | 136 | } |
144 | } | 137 | } |
@@ -147,9 +140,8 @@ static bool ebt_vlan_mt_check(const struct xt_mtchk_param *par) | |||
147 | * if_ether.h: ETH_ZLEN 60 - Min. octets in frame sans FCS */ | 140 | * if_ether.h: ETH_ZLEN 60 - Min. octets in frame sans FCS */ |
148 | if (GET_BITMASK(EBT_VLAN_ENCAP)) { | 141 | if (GET_BITMASK(EBT_VLAN_ENCAP)) { |
149 | if ((unsigned short) ntohs(info->encap) < ETH_ZLEN) { | 142 | if ((unsigned short) ntohs(info->encap) < ETH_ZLEN) { |
150 | DEBUG_MSG | 143 | pr_debug("encap frame length %d is less than " |
151 | ("encap frame length %d is less than minimal\n", | 144 | "minimal\n", ntohs(info->encap)); |
152 | ntohs(info->encap)); | ||
153 | return false; | 145 | return false; |
154 | } | 146 | } |
155 | } | 147 | } |
@@ -169,9 +161,7 @@ static struct xt_match ebt_vlan_mt_reg __read_mostly = { | |||
169 | 161 | ||
170 | static int __init ebt_vlan_init(void) | 162 | static int __init ebt_vlan_init(void) |
171 | { | 163 | { |
172 | DEBUG_MSG("ebtables 802.1Q extension module v" | 164 | pr_debug("ebtables 802.1Q extension module v" MODULE_VERS "\n"); |
173 | MODULE_VERS "\n"); | ||
174 | DEBUG_MSG("module debug=%d\n", !!debug); | ||
175 | return xt_register_match(&ebt_vlan_mt_reg); | 165 | return xt_register_match(&ebt_vlan_mt_reg); |
176 | } | 166 | } |
177 | 167 | ||
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index dfb58056a89a..989d72cc8148 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -14,8 +14,7 @@ | |||
14 | * as published by the Free Software Foundation; either version | 14 | * as published by the Free Software Foundation; either version |
15 | * 2 of the License, or (at your option) any later version. | 15 | * 2 of the License, or (at your option) any later version. |
16 | */ | 16 | */ |
17 | 17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
18 | |||
19 | #include <linux/kmod.h> | 18 | #include <linux/kmod.h> |
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/vmalloc.h> | 20 | #include <linux/vmalloc.h> |
@@ -2127,7 +2126,7 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base, | |||
2127 | return ret; | 2126 | return ret; |
2128 | new_offset += ret; | 2127 | new_offset += ret; |
2129 | if (offsets_update && new_offset) { | 2128 | if (offsets_update && new_offset) { |
2130 | pr_debug("ebtables: change offset %d to %d\n", | 2129 | pr_debug("change offset %d to %d\n", |
2131 | offsets_update[i], offsets[j] + new_offset); | 2130 | offsets_update[i], offsets[j] + new_offset); |
2132 | offsets_update[i] = offsets[j] + new_offset; | 2131 | offsets_update[i] = offsets[j] + new_offset; |
2133 | } | 2132 | } |