aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-11-11 13:59:17 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-11 14:10:31 -0500
commitba7a46f16dd29f93303daeb1fee8af316c5a07f4 (patch)
tree72568f33fadf0b75d02f6e30bca1404a5aae2530
parent5b61c4db49e2530ed10631321d4c73f49d560a93 (diff)
net: Convert LIMIT_NETDEBUG to net_dbg_ratelimited
Use the more common dynamic_debug capable net_dbg_ratelimited and remove the LIMIT_NETDEBUG macro. All messages are still ratelimited. Some KERN_<LEVEL> uses are changed to KERN_DEBUG. This may have some negative impact on messages that were emitted at KERN_INFO that are not not enabled at all unless DEBUG is defined or dynamic_debug is enabled. Even so, these messages are now _not_ emitted by default. This also eliminates the use of the net_msg_warn sysctl "/proc/sys/net/core/warnings". For backward compatibility, the sysctl is not removed, but it has no function. The extern declaration of net_msg_warn is removed from sock.h and made static in net/core/sysctl_net_core.c Miscellanea: o Update the sysctl documentation o Remove the embedded uses of pr_fmt o Coalesce format fragments o Realign arguments Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/sysctl/net.txt12
-rw-r--r--include/net/sock.h7
-rw-r--r--include/net/udplite.h6
-rw-r--r--net/core/sysctl_net_core.c2
-rw-r--r--net/core/utils.c3
-rw-r--r--net/ipv4/icmp.c8
-rw-r--r--net/ipv4/inet_fragment.c2
-rw-r--r--net/ipv4/ip_fragment.c3
-rw-r--r--net/ipv4/tcp_input.c8
-rw-r--r--net/ipv4/tcp_timer.c18
-rw-r--r--net/ipv4/udp.c30
-rw-r--r--net/ipv6/addrconf.c6
-rw-r--r--net/ipv6/ah6.c7
-rw-r--r--net/ipv6/datagram.c4
-rw-r--r--net/ipv6/esp6.c4
-rw-r--r--net/ipv6/exthdrs.c18
-rw-r--r--net/ipv6/icmp.c15
-rw-r--r--net/ipv6/mip6.c11
-rw-r--r--net/ipv6/netfilter.c2
-rw-r--r--net/ipv6/udp.c31
-rw-r--r--net/phonet/af_phonet.c9
-rw-r--r--net/phonet/pep-gprs.c3
-rw-r--r--net/phonet/pep.c12
23 files changed, 105 insertions, 116 deletions
diff --git a/Documentation/sysctl/net.txt b/Documentation/sysctl/net.txt
index 04892b821157..e26c607468a6 100644
--- a/Documentation/sysctl/net.txt
+++ b/Documentation/sysctl/net.txt
@@ -120,10 +120,14 @@ seconds.
120warnings 120warnings
121-------- 121--------
122 122
123This controls console messages from the networking stack that can occur because 123This sysctl is now unused.
124of problems on the network like duplicate address or bad checksums. Normally, 124
125this should be enabled, but if the problem persists the messages can be 125This was used to control console messages from the networking stack that
126disabled. 126occur because of problems on the network like duplicate address or bad
127checksums.
128
129These messages are now emitted at KERN_DEBUG and can generally be enabled
130and controlled by the dynamic_debug facility.
127 131
128netdev_budget 132netdev_budget
129------------- 133-------------
diff --git a/include/net/sock.h b/include/net/sock.h
index 7789b59c0c40..83a669f83bae 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2288,13 +2288,6 @@ bool sk_ns_capable(const struct sock *sk,
2288bool sk_capable(const struct sock *sk, int cap); 2288bool sk_capable(const struct sock *sk, int cap);
2289bool sk_net_capable(const struct sock *sk, int cap); 2289bool sk_net_capable(const struct sock *sk, int cap);
2290 2290
2291/*
2292 * Enable debug/info messages
2293 */
2294extern int net_msg_warn;
2295#define LIMIT_NETDEBUG(fmt, args...) \
2296 do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)
2297
2298extern __u32 sysctl_wmem_max; 2291extern __u32 sysctl_wmem_max;
2299extern __u32 sysctl_rmem_max; 2292extern __u32 sysctl_rmem_max;
2300 2293
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 2caadabcd07b..9a28a5179400 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -40,7 +40,7 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets 40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets
41 * with a zero checksum field are illegal. */ 41 * with a zero checksum field are illegal. */
42 if (uh->check == 0) { 42 if (uh->check == 0) {
43 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n"); 43 net_dbg_ratelimited("UDPLite: zeroed checksum field\n");
44 return 1; 44 return 1;
45 } 45 }
46 46
@@ -52,8 +52,8 @@ static inline int udplite_checksum_init(struct sk_buff *skb, struct udphdr *uh)
52 /* 52 /*
53 * Coverage length violates RFC 3828: log and discard silently. 53 * Coverage length violates RFC 3828: log and discard silently.
54 */ 54 */
55 LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n", 55 net_dbg_ratelimited("UDPLite: bad csum coverage %d/%d\n",
56 cscov, skb->len); 56 cscov, skb->len);
57 return 1; 57 return 1;
58 58
59 } else if (cscov < skb->len) { 59 } else if (cscov < skb->len) {
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index cf9cd13509a7..f93f092fe226 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -26,6 +26,8 @@ static int zero = 0;
26static int one = 1; 26static int one = 1;
27static int ushort_max = USHRT_MAX; 27static int ushort_max = USHRT_MAX;
28 28
29static int net_msg_warn; /* Unused, but still a sysctl */
30
29#ifdef CONFIG_RPS 31#ifdef CONFIG_RPS
30static int rps_sock_flow_sysctl(struct ctl_table *table, int write, 32static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
31 void __user *buffer, size_t *lenp, loff_t *ppos) 33 void __user *buffer, size_t *lenp, loff_t *ppos)
diff --git a/net/core/utils.c b/net/core/utils.c
index efc76dd9dcd1..7b803884c162 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -33,9 +33,6 @@
33#include <asm/byteorder.h> 33#include <asm/byteorder.h>
34#include <asm/uaccess.h> 34#include <asm/uaccess.h>
35 35
36int net_msg_warn __read_mostly = 1;
37EXPORT_SYMBOL(net_msg_warn);
38
39DEFINE_RATELIMIT_STATE(net_ratelimit_state, 5 * HZ, 10); 36DEFINE_RATELIMIT_STATE(net_ratelimit_state, 5 * HZ, 10);
40/* 37/*
41 * All net warning printk()s should be guarded by this function. 38 * All net warning printk()s should be guarded by this function.
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 5882f584910e..36b7bfa609d6 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -784,8 +784,8 @@ static void icmp_unreach(struct sk_buff *skb)
784 */ 784 */
785 switch (net->ipv4.sysctl_ip_no_pmtu_disc) { 785 switch (net->ipv4.sysctl_ip_no_pmtu_disc) {
786 default: 786 default:
787 LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"), 787 net_dbg_ratelimited("%pI4: fragmentation needed and DF set\n",
788 &iph->daddr); 788 &iph->daddr);
789 break; 789 break;
790 case 2: 790 case 2:
791 goto out; 791 goto out;
@@ -798,8 +798,8 @@ static void icmp_unreach(struct sk_buff *skb)
798 } 798 }
799 break; 799 break;
800 case ICMP_SR_FAILED: 800 case ICMP_SR_FAILED:
801 LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: Source Route Failed\n"), 801 net_dbg_ratelimited("%pI4: Source Route Failed\n",
802 &iph->daddr); 802 &iph->daddr);
803 break; 803 break;
804 default: 804 default:
805 break; 805 break;
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 19419b60cb37..e7920352646a 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -458,6 +458,6 @@ void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
458 ". Dropping fragment.\n"; 458 ". Dropping fragment.\n";
459 459
460 if (PTR_ERR(q) == -ENOBUFS) 460 if (PTR_ERR(q) == -ENOBUFS)
461 LIMIT_NETDEBUG(KERN_WARNING "%s%s", prefix, msg); 461 net_dbg_ratelimited("%s%s", prefix, msg);
462} 462}
463EXPORT_SYMBOL(inet_frag_maybe_warn_overflow); 463EXPORT_SYMBOL(inet_frag_maybe_warn_overflow);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 4d964dadd655..e5b6d0ddcb58 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -618,8 +618,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
618 return 0; 618 return 0;
619 619
620out_nomem: 620out_nomem:
621 LIMIT_NETDEBUG(KERN_ERR pr_fmt("queue_glue: no memory for gluing queue %p\n"), 621 net_dbg_ratelimited("queue_glue: no memory for gluing queue %p\n", qp);
622 qp);
623 err = -ENOMEM; 622 err = -ENOMEM;
624 goto out_fail; 623 goto out_fail;
625out_oversize: 624out_oversize:
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 5f979c7f5135..d91436ba17ea 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5854,12 +5854,12 @@ static inline void pr_drop_req(struct request_sock *req, __u16 port, int family)
5854 struct inet_request_sock *ireq = inet_rsk(req); 5854 struct inet_request_sock *ireq = inet_rsk(req);
5855 5855
5856 if (family == AF_INET) 5856 if (family == AF_INET)
5857 LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("drop open request from %pI4/%u\n"), 5857 net_dbg_ratelimited("drop open request from %pI4/%u\n",
5858 &ireq->ir_rmt_addr, port); 5858 &ireq->ir_rmt_addr, port);
5859#if IS_ENABLED(CONFIG_IPV6) 5859#if IS_ENABLED(CONFIG_IPV6)
5860 else if (family == AF_INET6) 5860 else if (family == AF_INET6)
5861 LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("drop open request from %pI6/%u\n"), 5861 net_dbg_ratelimited("drop open request from %pI6/%u\n",
5862 &ireq->ir_v6_rmt_addr, port); 5862 &ireq->ir_v6_rmt_addr, port);
5863#endif 5863#endif
5864} 5864}
5865 5865
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index 9b21ae8b2e31..1829c7fbc77e 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -374,17 +374,19 @@ void tcp_retransmit_timer(struct sock *sk)
374 */ 374 */
375 struct inet_sock *inet = inet_sk(sk); 375 struct inet_sock *inet = inet_sk(sk);
376 if (sk->sk_family == AF_INET) { 376 if (sk->sk_family == AF_INET) {
377 LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("Peer %pI4:%u/%u unexpectedly shrunk window %u:%u (repaired)\n"), 377 net_dbg_ratelimited("Peer %pI4:%u/%u unexpectedly shrunk window %u:%u (repaired)\n",
378 &inet->inet_daddr, 378 &inet->inet_daddr,
379 ntohs(inet->inet_dport), inet->inet_num, 379 ntohs(inet->inet_dport),
380 tp->snd_una, tp->snd_nxt); 380 inet->inet_num,
381 tp->snd_una, tp->snd_nxt);
381 } 382 }
382#if IS_ENABLED(CONFIG_IPV6) 383#if IS_ENABLED(CONFIG_IPV6)
383 else if (sk->sk_family == AF_INET6) { 384 else if (sk->sk_family == AF_INET6) {
384 LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n"), 385 net_dbg_ratelimited("Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n",
385 &sk->sk_v6_daddr, 386 &sk->sk_v6_daddr,
386 ntohs(inet->inet_dport), inet->inet_num, 387 ntohs(inet->inet_dport),
387 tp->snd_una, tp->snd_nxt); 388 inet->inet_num,
389 tp->snd_una, tp->snd_nxt);
388 } 390 }
389#endif 391#endif
390 if (tcp_time_stamp - tp->rcv_tstamp > TCP_RTO_MAX) { 392 if (tcp_time_stamp - tp->rcv_tstamp > TCP_RTO_MAX) {
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d13751685f44..1b6e9d5fadef 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1051,7 +1051,7 @@ back_from_confirm:
1051 /* ... which is an evident application bug. --ANK */ 1051 /* ... which is an evident application bug. --ANK */
1052 release_sock(sk); 1052 release_sock(sk);
1053 1053
1054 LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("cork app bug 2\n")); 1054 net_dbg_ratelimited("cork app bug 2\n");
1055 err = -EINVAL; 1055 err = -EINVAL;
1056 goto out; 1056 goto out;
1057 } 1057 }
@@ -1133,7 +1133,7 @@ int udp_sendpage(struct sock *sk, struct page *page, int offset,
1133 if (unlikely(!up->pending)) { 1133 if (unlikely(!up->pending)) {
1134 release_sock(sk); 1134 release_sock(sk);
1135 1135
1136 LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("udp cork app bug 3\n")); 1136 net_dbg_ratelimited("udp cork app bug 3\n");
1137 return -EINVAL; 1137 return -EINVAL;
1138 } 1138 }
1139 1139
@@ -1547,8 +1547,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1547 * provided by the application." 1547 * provided by the application."
1548 */ 1548 */
1549 if (up->pcrlen == 0) { /* full coverage was set */ 1549 if (up->pcrlen == 0) { /* full coverage was set */
1550 LIMIT_NETDEBUG(KERN_WARNING "UDPLite: partial coverage %d while full coverage %d requested\n", 1550 net_dbg_ratelimited("UDPLite: partial coverage %d while full coverage %d requested\n",
1551 UDP_SKB_CB(skb)->cscov, skb->len); 1551 UDP_SKB_CB(skb)->cscov, skb->len);
1552 goto drop; 1552 goto drop;
1553 } 1553 }
1554 /* The next case involves violating the min. coverage requested 1554 /* The next case involves violating the min. coverage requested
@@ -1558,8 +1558,8 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
1558 * Therefore the above ...()->partial_cov statement is essential. 1558 * Therefore the above ...()->partial_cov statement is essential.
1559 */ 1559 */
1560 if (UDP_SKB_CB(skb)->cscov < up->pcrlen) { 1560 if (UDP_SKB_CB(skb)->cscov < up->pcrlen) {
1561 LIMIT_NETDEBUG(KERN_WARNING "UDPLite: coverage %d too small, need min %d\n", 1561 net_dbg_ratelimited("UDPLite: coverage %d too small, need min %d\n",
1562 UDP_SKB_CB(skb)->cscov, up->pcrlen); 1562 UDP_SKB_CB(skb)->cscov, up->pcrlen);
1563 goto drop; 1563 goto drop;
1564 } 1564 }
1565 } 1565 }
@@ -1828,11 +1828,11 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1828 return 0; 1828 return 0;
1829 1829
1830short_packet: 1830short_packet:
1831 LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %pI4:%u %d/%d to %pI4:%u\n", 1831 net_dbg_ratelimited("UDP%s: short packet: From %pI4:%u %d/%d to %pI4:%u\n",
1832 proto == IPPROTO_UDPLITE ? "Lite" : "", 1832 proto == IPPROTO_UDPLITE ? "Lite" : "",
1833 &saddr, ntohs(uh->source), 1833 &saddr, ntohs(uh->source),
1834 ulen, skb->len, 1834 ulen, skb->len,
1835 &daddr, ntohs(uh->dest)); 1835 &daddr, ntohs(uh->dest));
1836 goto drop; 1836 goto drop;
1837 1837
1838csum_error: 1838csum_error:
@@ -1840,10 +1840,10 @@ csum_error:
1840 * RFC1122: OK. Discards the bad packet silently (as far as 1840 * RFC1122: OK. Discards the bad packet silently (as far as
1841 * the network is concerned, anyway) as per 4.1.3.4 (MUST). 1841 * the network is concerned, anyway) as per 4.1.3.4 (MUST).
1842 */ 1842 */
1843 LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: bad checksum. From %pI4:%u to %pI4:%u ulen %d\n", 1843 net_dbg_ratelimited("UDP%s: bad checksum. From %pI4:%u to %pI4:%u ulen %d\n",
1844 proto == IPPROTO_UDPLITE ? "Lite" : "", 1844 proto == IPPROTO_UDPLITE ? "Lite" : "",
1845 &saddr, ntohs(uh->source), &daddr, ntohs(uh->dest), 1845 &saddr, ntohs(uh->source), &daddr, ntohs(uh->dest),
1846 ulen); 1846 ulen);
1847 UDP_INC_STATS_BH(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE); 1847 UDP_INC_STATS_BH(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE);
1848drop: 1848drop:
1849 UDP_INC_STATS_BH(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE); 1849 UDP_INC_STATS_BH(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 06e897832a7a..251fcb48b216 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1411,10 +1411,8 @@ int ipv6_dev_get_saddr(struct net *net, const struct net_device *dst_dev,
1411 1411
1412 if (unlikely(score->addr_type == IPV6_ADDR_ANY || 1412 if (unlikely(score->addr_type == IPV6_ADDR_ANY ||
1413 score->addr_type & IPV6_ADDR_MULTICAST)) { 1413 score->addr_type & IPV6_ADDR_MULTICAST)) {
1414 LIMIT_NETDEBUG(KERN_DEBUG 1414 net_dbg_ratelimited("ADDRCONF: unspecified / multicast address assigned as unicast address on %s",
1415 "ADDRCONF: unspecified / multicast address " 1415 dev->name);
1416 "assigned as unicast address on %s",
1417 dev->name);
1418 continue; 1416 continue;
1419 } 1417 }
1420 1418
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 6d16eb0e0c7f..8ab1989198f6 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -272,10 +272,9 @@ static int ipv6_clear_mutable_options(struct ipv6hdr *iph, int len, int dir)
272 ipv6_rearrange_destopt(iph, exthdr.opth); 272 ipv6_rearrange_destopt(iph, exthdr.opth);
273 case NEXTHDR_HOP: 273 case NEXTHDR_HOP:
274 if (!zero_out_mutable_opts(exthdr.opth)) { 274 if (!zero_out_mutable_opts(exthdr.opth)) {
275 LIMIT_NETDEBUG( 275 net_dbg_ratelimited("overrun %sopts\n",
276 KERN_WARNING "overrun %sopts\n", 276 nexthdr == NEXTHDR_HOP ?
277 nexthdr == NEXTHDR_HOP ? 277 "hop" : "dest");
278 "hop" : "dest");
279 return -EINVAL; 278 return -EINVAL;
280 } 279 }
281 break; 280 break;
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 5c6996e44b14..cc1139687fd7 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -893,8 +893,8 @@ int ip6_datagram_send_ctl(struct net *net, struct sock *sk,
893 break; 893 break;
894 } 894 }
895 default: 895 default:
896 LIMIT_NETDEBUG(KERN_DEBUG "invalid cmsg type: %d\n", 896 net_dbg_ratelimited("invalid cmsg type: %d\n",
897 cmsg->cmsg_type); 897 cmsg->cmsg_type);
898 err = -EINVAL; 898 err = -EINVAL;
899 goto exit_f; 899 goto exit_f;
900 } 900 }
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index d21d7b22eebc..d2c2d749b6db 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -286,8 +286,8 @@ static int esp_input_done2(struct sk_buff *skb, int err)
286 err = -EINVAL; 286 err = -EINVAL;
287 padlen = nexthdr[0]; 287 padlen = nexthdr[0];
288 if (padlen + 2 + alen >= elen) { 288 if (padlen + 2 + alen >= elen) {
289 LIMIT_NETDEBUG(KERN_WARNING "ipsec esp packet is garbage " 289 net_dbg_ratelimited("ipsec esp packet is garbage padlen=%d, elen=%d\n",
290 "padlen=%d, elen=%d\n", padlen + 2, elen - alen); 290 padlen + 2, elen - alen);
291 goto out; 291 goto out;
292 } 292 }
293 293
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 601d896f22d0..a7bbbe45570b 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -184,7 +184,7 @@ static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)
184 int ret; 184 int ret;
185 185
186 if (opt->dsthao) { 186 if (opt->dsthao) {
187 LIMIT_NETDEBUG(KERN_DEBUG "hao duplicated\n"); 187 net_dbg_ratelimited("hao duplicated\n");
188 goto discard; 188 goto discard;
189 } 189 }
190 opt->dsthao = opt->dst1; 190 opt->dsthao = opt->dst1;
@@ -193,14 +193,14 @@ static bool ipv6_dest_hao(struct sk_buff *skb, int optoff)
193 hao = (struct ipv6_destopt_hao *)(skb_network_header(skb) + optoff); 193 hao = (struct ipv6_destopt_hao *)(skb_network_header(skb) + optoff);
194 194
195 if (hao->length != 16) { 195 if (hao->length != 16) {
196 LIMIT_NETDEBUG( 196 net_dbg_ratelimited("hao invalid option length = %d\n",
197 KERN_DEBUG "hao invalid option length = %d\n", hao->length); 197 hao->length);
198 goto discard; 198 goto discard;
199 } 199 }
200 200
201 if (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) { 201 if (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) {
202 LIMIT_NETDEBUG( 202 net_dbg_ratelimited("hao is not an unicast addr: %pI6\n",
203 KERN_DEBUG "hao is not an unicast addr: %pI6\n", &hao->addr); 203 &hao->addr);
204 goto discard; 204 goto discard;
205 } 205 }
206 206
@@ -551,8 +551,8 @@ static bool ipv6_hop_ra(struct sk_buff *skb, int optoff)
551 memcpy(&IP6CB(skb)->ra, nh + optoff + 2, sizeof(IP6CB(skb)->ra)); 551 memcpy(&IP6CB(skb)->ra, nh + optoff + 2, sizeof(IP6CB(skb)->ra));
552 return true; 552 return true;
553 } 553 }
554 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_ra: wrong RA length %d\n", 554 net_dbg_ratelimited("ipv6_hop_ra: wrong RA length %d\n",
555 nh[optoff + 1]); 555 nh[optoff + 1]);
556 kfree_skb(skb); 556 kfree_skb(skb);
557 return false; 557 return false;
558} 558}
@@ -566,8 +566,8 @@ static bool ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
566 u32 pkt_len; 566 u32 pkt_len;
567 567
568 if (nh[optoff + 1] != 4 || (optoff & 3) != 2) { 568 if (nh[optoff + 1] != 4 || (optoff & 3) != 2) {
569 LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", 569 net_dbg_ratelimited("ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n",
570 nh[optoff+1]); 570 nh[optoff+1]);
571 IP6_INC_STATS_BH(net, ipv6_skb_idev(skb), 571 IP6_INC_STATS_BH(net, ipv6_skb_idev(skb),
572 IPSTATS_MIB_INHDRERRORS); 572 IPSTATS_MIB_INHDRERRORS);
573 goto drop; 573 goto drop;
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 62c1037d9e83..092934032077 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -338,7 +338,7 @@ static struct dst_entry *icmpv6_route_lookup(struct net *net,
338 * anycast. 338 * anycast.
339 */ 339 */
340 if (((struct rt6_info *)dst)->rt6i_flags & RTF_ANYCAST) { 340 if (((struct rt6_info *)dst)->rt6i_flags & RTF_ANYCAST) {
341 LIMIT_NETDEBUG(KERN_DEBUG "icmp6_send: acast source\n"); 341 net_dbg_ratelimited("icmp6_send: acast source\n");
342 dst_release(dst); 342 dst_release(dst);
343 return ERR_PTR(-EINVAL); 343 return ERR_PTR(-EINVAL);
344 } 344 }
@@ -452,7 +452,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
452 * and anycast addresses will be checked later. 452 * and anycast addresses will be checked later.
453 */ 453 */
454 if ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) { 454 if ((addr_type == IPV6_ADDR_ANY) || (addr_type & IPV6_ADDR_MULTICAST)) {
455 LIMIT_NETDEBUG(KERN_DEBUG "icmp6_send: addr_any/mcast source\n"); 455 net_dbg_ratelimited("icmp6_send: addr_any/mcast source\n");
456 return; 456 return;
457 } 457 }
458 458
@@ -460,7 +460,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
460 * Never answer to a ICMP packet. 460 * Never answer to a ICMP packet.
461 */ 461 */
462 if (is_ineligible(skb)) { 462 if (is_ineligible(skb)) {
463 LIMIT_NETDEBUG(KERN_DEBUG "icmp6_send: no reply to icmp error\n"); 463 net_dbg_ratelimited("icmp6_send: no reply to icmp error\n");
464 return; 464 return;
465 } 465 }
466 466
@@ -509,7 +509,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
509 len = skb->len - msg.offset; 509 len = skb->len - msg.offset;
510 len = min_t(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr) - sizeof(struct icmp6hdr)); 510 len = min_t(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr) - sizeof(struct icmp6hdr));
511 if (len < 0) { 511 if (len < 0) {
512 LIMIT_NETDEBUG(KERN_DEBUG "icmp: len problem\n"); 512 net_dbg_ratelimited("icmp: len problem\n");
513 goto out_dst_release; 513 goto out_dst_release;
514 } 514 }
515 515
@@ -706,9 +706,8 @@ static int icmpv6_rcv(struct sk_buff *skb)
706 daddr = &ipv6_hdr(skb)->daddr; 706 daddr = &ipv6_hdr(skb)->daddr;
707 707
708 if (skb_checksum_validate(skb, IPPROTO_ICMPV6, ip6_compute_pseudo)) { 708 if (skb_checksum_validate(skb, IPPROTO_ICMPV6, ip6_compute_pseudo)) {
709 LIMIT_NETDEBUG(KERN_DEBUG 709 net_dbg_ratelimited("ICMPv6 checksum failed [%pI6c > %pI6c]\n",
710 "ICMPv6 checksum failed [%pI6c > %pI6c]\n", 710 saddr, daddr);
711 saddr, daddr);
712 goto csum_error; 711 goto csum_error;
713 } 712 }
714 713
@@ -781,7 +780,7 @@ static int icmpv6_rcv(struct sk_buff *skb)
781 if (type & ICMPV6_INFOMSG_MASK) 780 if (type & ICMPV6_INFOMSG_MASK)
782 break; 781 break;
783 782
784 LIMIT_NETDEBUG(KERN_DEBUG "icmpv6: msg of unknown type\n"); 783 net_dbg_ratelimited("icmpv6: msg of unknown type\n");
785 784
786 /* 785 /*
787 * error of unknown type. 786 * error of unknown type.
diff --git a/net/ipv6/mip6.c b/net/ipv6/mip6.c
index f61429d391d3..b9779d441b12 100644
--- a/net/ipv6/mip6.c
+++ b/net/ipv6/mip6.c
@@ -97,16 +97,17 @@ static int mip6_mh_filter(struct sock *sk, struct sk_buff *skb)
97 return -1; 97 return -1;
98 98
99 if (mh->ip6mh_hdrlen < mip6_mh_len(mh->ip6mh_type)) { 99 if (mh->ip6mh_hdrlen < mip6_mh_len(mh->ip6mh_type)) {
100 LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH message too short: %d vs >=%d\n", 100 net_dbg_ratelimited("mip6: MH message too short: %d vs >=%d\n",
101 mh->ip6mh_hdrlen, mip6_mh_len(mh->ip6mh_type)); 101 mh->ip6mh_hdrlen,
102 mip6_mh_len(mh->ip6mh_type));
102 mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_hdrlen) + 103 mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_hdrlen) +
103 skb_network_header_len(skb)); 104 skb_network_header_len(skb));
104 return -1; 105 return -1;
105 } 106 }
106 107
107 if (mh->ip6mh_proto != IPPROTO_NONE) { 108 if (mh->ip6mh_proto != IPPROTO_NONE) {
108 LIMIT_NETDEBUG(KERN_DEBUG "mip6: MH invalid payload proto = %d\n", 109 net_dbg_ratelimited("mip6: MH invalid payload proto = %d\n",
109 mh->ip6mh_proto); 110 mh->ip6mh_proto);
110 mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_proto) + 111 mip6_param_prob(skb, 0, offsetof(struct ip6_mh, ip6mh_proto) +
111 skb_network_header_len(skb)); 112 skb_network_header_len(skb));
112 return -1; 113 return -1;
@@ -288,7 +289,7 @@ static int mip6_destopt_offset(struct xfrm_state *x, struct sk_buff *skb,
288 * XXX: packet if HAO exists. 289 * XXX: packet if HAO exists.
289 */ 290 */
290 if (ipv6_find_tlv(skb, offset, IPV6_TLV_HAO) >= 0) { 291 if (ipv6_find_tlv(skb, offset, IPV6_TLV_HAO) >= 0) {
291 LIMIT_NETDEBUG(KERN_WARNING "mip6: hao exists already, override\n"); 292 net_dbg_ratelimited("mip6: hao exists already, override\n");
292 return offset; 293 return offset;
293 } 294 }
294 295
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index d38e6a8d8b9f..398377a9d018 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -36,7 +36,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
36 err = dst->error; 36 err = dst->error;
37 if (err) { 37 if (err) {
38 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); 38 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
39 LIMIT_NETDEBUG(KERN_DEBUG "ip6_route_me_harder: No more route.\n"); 39 net_dbg_ratelimited("ip6_route_me_harder: No more route\n");
40 dst_release(dst); 40 dst_release(dst);
41 return err; 41 return err;
42 } 42 }
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index d1fe36274906..0ba3de4f2368 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -660,15 +660,13 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
660 if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) { 660 if ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {
661 661
662 if (up->pcrlen == 0) { /* full coverage was set */ 662 if (up->pcrlen == 0) { /* full coverage was set */
663 LIMIT_NETDEBUG(KERN_WARNING "UDPLITE6: partial coverage" 663 net_dbg_ratelimited("UDPLITE6: partial coverage %d while full coverage %d requested\n",
664 " %d while full coverage %d requested\n", 664 UDP_SKB_CB(skb)->cscov, skb->len);
665 UDP_SKB_CB(skb)->cscov, skb->len);
666 goto drop; 665 goto drop;
667 } 666 }
668 if (UDP_SKB_CB(skb)->cscov < up->pcrlen) { 667 if (UDP_SKB_CB(skb)->cscov < up->pcrlen) {
669 LIMIT_NETDEBUG(KERN_WARNING "UDPLITE6: coverage %d " 668 net_dbg_ratelimited("UDPLITE6: coverage %d too small, need min %d\n",
670 "too small, need min %d\n", 669 UDP_SKB_CB(skb)->cscov, up->pcrlen);
671 UDP_SKB_CB(skb)->cscov, up->pcrlen);
672 goto drop; 670 goto drop;
673 } 671 }
674 } 672 }
@@ -761,9 +759,9 @@ static void udp6_csum_zero_error(struct sk_buff *skb)
761 /* RFC 2460 section 8.1 says that we SHOULD log 759 /* RFC 2460 section 8.1 says that we SHOULD log
762 * this error. Well, it is reasonable. 760 * this error. Well, it is reasonable.
763 */ 761 */
764 LIMIT_NETDEBUG(KERN_INFO "IPv6: udp checksum is 0 for [%pI6c]:%u->[%pI6c]:%u\n", 762 net_dbg_ratelimited("IPv6: udp checksum is 0 for [%pI6c]:%u->[%pI6c]:%u\n",
765 &ipv6_hdr(skb)->saddr, ntohs(udp_hdr(skb)->source), 763 &ipv6_hdr(skb)->saddr, ntohs(udp_hdr(skb)->source),
766 &ipv6_hdr(skb)->daddr, ntohs(udp_hdr(skb)->dest)); 764 &ipv6_hdr(skb)->daddr, ntohs(udp_hdr(skb)->dest));
767} 765}
768 766
769/* 767/*
@@ -931,14 +929,11 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
931 return 0; 929 return 0;
932 930
933short_packet: 931short_packet:
934 LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: From [%pI6c]:%u %d/%d to [%pI6c]:%u\n", 932 net_dbg_ratelimited("UDP%sv6: short packet: From [%pI6c]:%u %d/%d to [%pI6c]:%u\n",
935 proto == IPPROTO_UDPLITE ? "-Lite" : "", 933 proto == IPPROTO_UDPLITE ? "-Lite" : "",
936 saddr, 934 saddr, ntohs(uh->source),
937 ntohs(uh->source), 935 ulen, skb->len,
938 ulen, 936 daddr, ntohs(uh->dest));
939 skb->len,
940 daddr,
941 ntohs(uh->dest));
942 goto discard; 937 goto discard;
943csum_error: 938csum_error:
944 UDP6_INC_STATS_BH(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE); 939 UDP6_INC_STATS_BH(net, UDP_MIB_CSUMERRORS, proto == IPPROTO_UDPLITE);
@@ -1290,7 +1285,7 @@ back_from_confirm:
1290 /* ... which is an evident application bug. --ANK */ 1285 /* ... which is an evident application bug. --ANK */
1291 release_sock(sk); 1286 release_sock(sk);
1292 1287
1293 LIMIT_NETDEBUG(KERN_DEBUG "udp cork app bug 2\n"); 1288 net_dbg_ratelimited("udp cork app bug 2\n");
1294 err = -EINVAL; 1289 err = -EINVAL;
1295 goto out; 1290 goto out;
1296 } 1291 }
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 5a940dbd74a3..32ab87d34828 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -426,16 +426,17 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
426 426
427 out_dev = phonet_route_output(net, pn_sockaddr_get_addr(&sa)); 427 out_dev = phonet_route_output(net, pn_sockaddr_get_addr(&sa));
428 if (!out_dev) { 428 if (!out_dev) {
429 LIMIT_NETDEBUG(KERN_WARNING"No Phonet route to %02X\n", 429 net_dbg_ratelimited("No Phonet route to %02X\n",
430 pn_sockaddr_get_addr(&sa)); 430 pn_sockaddr_get_addr(&sa));
431 goto out; 431 goto out;
432 } 432 }
433 433
434 __skb_push(skb, sizeof(struct phonethdr)); 434 __skb_push(skb, sizeof(struct phonethdr));
435 skb->dev = out_dev; 435 skb->dev = out_dev;
436 if (out_dev == dev) { 436 if (out_dev == dev) {
437 LIMIT_NETDEBUG(KERN_ERR"Phonet loop to %02X on %s\n", 437 net_dbg_ratelimited("Phonet loop to %02X on %s\n",
438 pn_sockaddr_get_addr(&sa), dev->name); 438 pn_sockaddr_get_addr(&sa),
439 dev->name);
439 goto out_dev; 440 goto out_dev;
440 } 441 }
441 /* Some drivers (e.g. TUN) do not allocate HW header space */ 442 /* Some drivers (e.g. TUN) do not allocate HW header space */
diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index e9a83a637185..fa8237fdc57b 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -203,8 +203,7 @@ static netdev_tx_t gprs_xmit(struct sk_buff *skb, struct net_device *dev)
203 len = skb->len; 203 len = skb->len;
204 err = pep_write(sk, skb); 204 err = pep_write(sk, skb);
205 if (err) { 205 if (err) {
206 LIMIT_NETDEBUG(KERN_WARNING"%s: TX error (%d)\n", 206 net_dbg_ratelimited("%s: TX error (%d)\n", dev->name, err);
207 dev->name, err);
208 dev->stats.tx_aborted_errors++; 207 dev->stats.tx_aborted_errors++;
209 dev->stats.tx_errors++; 208 dev->stats.tx_errors++;
210 } else { 209 } else {
diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index 44b2123e22b8..9cd069dfaf65 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -272,8 +272,8 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
272 272
273 hdr = pnp_hdr(skb); 273 hdr = pnp_hdr(skb);
274 if (hdr->data[0] != PN_PEP_TYPE_COMMON) { 274 if (hdr->data[0] != PN_PEP_TYPE_COMMON) {
275 LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP type: %u\n", 275 net_dbg_ratelimited("Phonet unknown PEP type: %u\n",
276 (unsigned int)hdr->data[0]); 276 (unsigned int)hdr->data[0]);
277 return -EOPNOTSUPP; 277 return -EOPNOTSUPP;
278 } 278 }
279 279
@@ -304,8 +304,8 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
304 break; 304 break;
305 305
306 default: 306 default:
307 LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP indication: %u\n", 307 net_dbg_ratelimited("Phonet unknown PEP indication: %u\n",
308 (unsigned int)hdr->data[1]); 308 (unsigned int)hdr->data[1]);
309 return -EOPNOTSUPP; 309 return -EOPNOTSUPP;
310 } 310 }
311 if (wake) 311 if (wake)
@@ -451,8 +451,8 @@ static int pipe_do_rcv(struct sock *sk, struct sk_buff *skb)
451 break; 451 break;
452 452
453 default: 453 default:
454 LIMIT_NETDEBUG(KERN_DEBUG"Phonet unknown PEP message: %u\n", 454 net_dbg_ratelimited("Phonet unknown PEP message: %u\n",
455 hdr->message_id); 455 hdr->message_id);
456 err = -EINVAL; 456 err = -EINVAL;
457 } 457 }
458out: 458out: