diff options
author | Joe Perches <joe@perches.com> | 2014-11-11 13:59:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-11 14:10:31 -0500 |
commit | ba7a46f16dd29f93303daeb1fee8af316c5a07f4 (patch) | |
tree | 72568f33fadf0b75d02f6e30bca1404a5aae2530 /net/ipv6 | |
parent | 5b61c4db49e2530ed10631321d4c73f49d560a93 (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>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/addrconf.c | 6 | ||||
-rw-r--r-- | net/ipv6/ah6.c | 7 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 4 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 4 | ||||
-rw-r--r-- | net/ipv6/exthdrs.c | 18 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 15 | ||||
-rw-r--r-- | net/ipv6/mip6.c | 11 | ||||
-rw-r--r-- | net/ipv6/netfilter.c | 2 | ||||
-rw-r--r-- | net/ipv6/udp.c | 31 |
9 files changed, 45 insertions, 53 deletions
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 | ||
933 | short_packet: | 931 | short_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; |
943 | csum_error: | 938 | csum_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 | } |