aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-05-13 17:56:26 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-15 13:45:03 -0400
commite87cc4728f0e2fb663e592a1141742b1d6c63256 (patch)
treeb8219696d37f0c8d0521d5853560b97fc96dc667 /net/ipv6
parent3a3bfb61e64476ff1e4ac3122cb6dec9c79b795c (diff)
net: Convert net_ratelimit uses to net_<level>_ratelimited
Standardize the net core ratelimited logging functions. Coalesce formats, align arguments. Change a printk then vprintk sequence to use printf extension %pV. 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.c17
-rw-r--r--net/ipv6/ah6.c4
-rw-r--r--net/ipv6/ip6_output.c3
-rw-r--r--net/ipv6/ip6_tunnel.c33
-rw-r--r--net/ipv6/ip6mr.c3
-rw-r--r--net/ipv6/netfilter/ip6_tables.c3
-rw-r--r--net/ipv6/netfilter/ip6t_REJECT.c6
-rw-r--r--net/ipv6/netfilter/ip6table_mangle.c3
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c3
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c7
-rw-r--r--net/ipv6/reassembly.c6
-rw-r--r--net/ipv6/route.c12
-rw-r--r--net/ipv6/sit.c6
-rw-r--r--net/ipv6/tcp_ipv6.c10
14 files changed, 41 insertions, 75 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8b7f100a4b4..4d1d51a0bd2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1415,9 +1415,8 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp)
1415 return; 1415 return;
1416 } 1416 }
1417 1417
1418 if (net_ratelimit()) 1418 net_info_ratelimited("%s: IPv6 duplicate address %pI6c detected!\n",
1419 printk(KERN_INFO "%s: IPv6 duplicate address %pI6c detected!\n", 1419 ifp->idev->dev->name, &ifp->addr);
1420 ifp->idev->dev->name, &ifp->addr);
1421 1420
1422 if (idev->cnf.accept_dad > 1 && !idev->cnf.disable_ipv6) { 1421 if (idev->cnf.accept_dad > 1 && !idev->cnf.disable_ipv6) {
1423 struct in6_addr addr; 1422 struct in6_addr addr;
@@ -1847,16 +1846,15 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
1847 prefered_lft = ntohl(pinfo->prefered); 1846 prefered_lft = ntohl(pinfo->prefered);
1848 1847
1849 if (prefered_lft > valid_lft) { 1848 if (prefered_lft > valid_lft) {
1850 if (net_ratelimit()) 1849 net_warn_ratelimited("addrconf: prefix option has invalid lifetime\n");
1851 printk(KERN_WARNING "addrconf: prefix option has invalid lifetime\n");
1852 return; 1850 return;
1853 } 1851 }
1854 1852
1855 in6_dev = in6_dev_get(dev); 1853 in6_dev = in6_dev_get(dev);
1856 1854
1857 if (in6_dev == NULL) { 1855 if (in6_dev == NULL) {
1858 if (net_ratelimit()) 1856 net_dbg_ratelimited("addrconf: device %s not configured\n",
1859 printk(KERN_DEBUG "addrconf: device %s not configured\n", dev->name); 1857 dev->name);
1860 return; 1858 return;
1861 } 1859 }
1862 1860
@@ -1931,9 +1929,8 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
1931 } 1929 }
1932 goto ok; 1930 goto ok;
1933 } 1931 }
1934 if (net_ratelimit()) 1932 net_dbg_ratelimited("IPv6 addrconf: prefix with wrong length %d\n",
1935 printk(KERN_DEBUG "IPv6 addrconf: prefix with wrong length %d\n", 1933 pinfo->prefix_len);
1936 pinfo->prefix_len);
1937 in6_dev_put(in6_dev); 1934 in6_dev_put(in6_dev);
1938 return; 1935 return;
1939 1936
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 2ae79dbeec2..a9f4156f7c3 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -189,8 +189,8 @@ static void ipv6_rearrange_destopt(struct ipv6hdr *iph, struct ipv6_opt_hdr *des
189 189
190 hao = (struct ipv6_destopt_hao *)&opt[off]; 190 hao = (struct ipv6_destopt_hao *)&opt[off];
191 if (hao->length != sizeof(hao->addr)) { 191 if (hao->length != sizeof(hao->addr)) {
192 if (net_ratelimit()) 192 net_warn_ratelimited("destopt hao: invalid header length: %u\n",
193 printk(KERN_WARNING "destopt hao: invalid header length: %u\n", hao->length); 193 hao->length);
194 goto bad; 194 goto bad;
195 } 195 }
196 final_addr = hao->addr; 196 final_addr = hao->addr;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index d8e05af2c4b..be2264e7dd2 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -252,8 +252,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
252 dst->dev, dst_output); 252 dst->dev, dst_output);
253 } 253 }
254 254
255 if (net_ratelimit()) 255 net_dbg_ratelimited("IPv6: sending pkt_too_big to self\n");
256 printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
257 skb->dev = dst->dev; 256 skb->dev = dst->dev;
258 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); 257 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
259 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS); 258 IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 5df487c81ed..27fec272d39 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -460,19 +460,14 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
460 struct ipv6_tlv_tnl_enc_lim *tel; 460 struct ipv6_tlv_tnl_enc_lim *tel;
461 __u32 mtu; 461 __u32 mtu;
462 case ICMPV6_DEST_UNREACH: 462 case ICMPV6_DEST_UNREACH:
463 if (net_ratelimit()) 463 net_warn_ratelimited("%s: Path to destination invalid or inactive!\n",
464 printk(KERN_WARNING 464 t->parms.name);
465 "%s: Path to destination invalid "
466 "or inactive!\n", t->parms.name);
467 rel_msg = 1; 465 rel_msg = 1;
468 break; 466 break;
469 case ICMPV6_TIME_EXCEED: 467 case ICMPV6_TIME_EXCEED:
470 if ((*code) == ICMPV6_EXC_HOPLIMIT) { 468 if ((*code) == ICMPV6_EXC_HOPLIMIT) {
471 if (net_ratelimit()) 469 net_warn_ratelimited("%s: Too small hop limit or routing loop in tunnel!\n",
472 printk(KERN_WARNING 470 t->parms.name);
473 "%s: Too small hop limit or "
474 "routing loop in tunnel!\n",
475 t->parms.name);
476 rel_msg = 1; 471 rel_msg = 1;
477 } 472 }
478 break; 473 break;
@@ -484,17 +479,13 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
484 if (teli && teli == *info - 2) { 479 if (teli && teli == *info - 2) {
485 tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli]; 480 tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
486 if (tel->encap_limit == 0) { 481 if (tel->encap_limit == 0) {
487 if (net_ratelimit()) 482 net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n",
488 printk(KERN_WARNING 483 t->parms.name);
489 "%s: Too small encapsulation "
490 "limit or routing loop in "
491 "tunnel!\n", t->parms.name);
492 rel_msg = 1; 484 rel_msg = 1;
493 } 485 }
494 } else if (net_ratelimit()) { 486 } else {
495 printk(KERN_WARNING 487 net_warn_ratelimited("%s: Recipient unable to parse tunneled packet!\n",
496 "%s: Recipient unable to parse tunneled " 488 t->parms.name);
497 "packet!\n ", t->parms.name);
498 } 489 }
499 break; 490 break;
500 case ICMPV6_PKT_TOOBIG: 491 case ICMPV6_PKT_TOOBIG:
@@ -919,10 +910,8 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
919 910
920 if (tdev == dev) { 911 if (tdev == dev) {
921 stats->collisions++; 912 stats->collisions++;
922 if (net_ratelimit()) 913 net_warn_ratelimited("%s: Local routing loop detected!\n",
923 printk(KERN_WARNING 914 t->parms.name);
924 "%s: Local routing loop detected!\n",
925 t->parms.name);
926 goto tx_err_dst_release; 915 goto tx_err_dst_release;
927 } 916 }
928 mtu = dst_mtu(dst) - sizeof (*ipv6h); 917 mtu = dst_mtu(dst) - sizeof (*ipv6h);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index efc0098b59d..ba936e18b61 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1147,8 +1147,7 @@ static int ip6mr_cache_report(struct mr6_table *mrt, struct sk_buff *pkt,
1147 */ 1147 */
1148 ret = sock_queue_rcv_skb(mrt->mroute6_sk, skb); 1148 ret = sock_queue_rcv_skb(mrt->mroute6_sk, skb);
1149 if (ret < 0) { 1149 if (ret < 0) {
1150 if (net_ratelimit()) 1150 net_warn_ratelimited("mroute6: pending queue full, dropping entries\n");
1151 printk(KERN_WARNING "mroute6: pending queue full, dropping entries.\n");
1152 kfree_skb(skb); 1151 kfree_skb(skb);
1153 } 1152 }
1154 1153
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 308bdd65123..d7cb04506c3 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -181,8 +181,7 @@ ip6_checkentry(const struct ip6t_ip6 *ipv6)
181static unsigned int 181static unsigned int
182ip6t_error(struct sk_buff *skb, const struct xt_action_param *par) 182ip6t_error(struct sk_buff *skb, const struct xt_action_param *par)
183{ 183{
184 if (net_ratelimit()) 184 net_info_ratelimited("error: `%s'\n", (const char *)par->targinfo);
185 pr_info("error: `%s'\n", (const char *)par->targinfo);
186 185
187 return NF_DROP; 186 return NF_DROP;
188} 187}
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index aad2fa41cf4..fd4fb34c51c 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -114,8 +114,7 @@ static void send_reset(struct net *net, struct sk_buff *oldskb)
114 GFP_ATOMIC); 114 GFP_ATOMIC);
115 115
116 if (!nskb) { 116 if (!nskb) {
117 if (net_ratelimit()) 117 net_dbg_ratelimited("cannot alloc skb\n");
118 pr_debug("cannot alloc skb\n");
119 dst_release(dst); 118 dst_release(dst);
120 return; 119 return;
121 } 120 }
@@ -210,8 +209,7 @@ reject_tg6(struct sk_buff *skb, const struct xt_action_param *par)
210 send_reset(net, skb); 209 send_reset(net, skb);
211 break; 210 break;
212 default: 211 default:
213 if (net_ratelimit()) 212 net_info_ratelimited("case %u not handled yet\n", reject->with);
214 pr_info("case %u not handled yet\n", reject->with);
215 break; 213 break;
216 } 214 }
217 215
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c
index 00d19173db7..4d782405f12 100644
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
@@ -42,8 +42,7 @@ ip6t_mangle_out(struct sk_buff *skb, const struct net_device *out)
42 /* root is playing with raw sockets. */ 42 /* root is playing with raw sockets. */
43 if (skb->len < sizeof(struct iphdr) || 43 if (skb->len < sizeof(struct iphdr) ||
44 ip_hdrlen(skb) < sizeof(struct iphdr)) { 44 ip_hdrlen(skb) < sizeof(struct iphdr)) {
45 if (net_ratelimit()) 45 net_warn_ratelimited("ip6t_hook: happy cracking\n");
46 pr_warning("ip6t_hook: happy cracking.\n");
47 return NF_ACCEPT; 46 return NF_ACCEPT;
48 } 47 }
49#endif 48#endif
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index fe925e49252..3224ef90a21 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -232,8 +232,7 @@ static unsigned int ipv6_conntrack_local(unsigned int hooknum,
232{ 232{
233 /* root is playing with raw sockets. */ 233 /* root is playing with raw sockets. */
234 if (skb->len < sizeof(struct ipv6hdr)) { 234 if (skb->len < sizeof(struct ipv6hdr)) {
235 if (net_ratelimit()) 235 net_notice_ratelimited("ipv6_conntrack_local: packet too short\n");
236 pr_notice("ipv6_conntrack_local: packet too short\n");
237 return NF_ACCEPT; 236 return NF_ACCEPT;
238 } 237 }
239 return __ipv6_conntrack_in(dev_net(out), hooknum, skb, okfn); 238 return __ipv6_conntrack_in(dev_net(out), hooknum, skb, okfn);
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 48a2be1b7c7..c9c78c2e666 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -444,12 +444,11 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
444 return head; 444 return head;
445 445
446out_oversize: 446out_oversize:
447 if (net_ratelimit()) 447 net_dbg_ratelimited("nf_ct_frag6_reasm: payload len = %d\n",
448 printk(KERN_DEBUG "nf_ct_frag6_reasm: payload len = %d\n", payload_len); 448 payload_len);
449 goto out_fail; 449 goto out_fail;
450out_oom: 450out_oom:
451 if (net_ratelimit()) 451 net_dbg_ratelimited("nf_ct_frag6_reasm: no memory for reassembly\n");
452 printk(KERN_DEBUG "nf_ct_frag6_reasm: no memory for reassembly\n");
453out_fail: 452out_fail:
454 return NULL; 453 return NULL;
455} 454}
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 54c5d2b704d..f1b86fdc06a 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -518,12 +518,10 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff *prev,
518 return 1; 518 return 1;
519 519
520out_oversize: 520out_oversize:
521 if (net_ratelimit()) 521 net_dbg_ratelimited("ip6_frag_reasm: payload len = %d\n", payload_len);
522 printk(KERN_DEBUG "ip6_frag_reasm: payload len = %d\n", payload_len);
523 goto out_fail; 522 goto out_fail;
524out_oom: 523out_oom:
525 if (net_ratelimit()) 524 net_dbg_ratelimited("ip6_frag_reasm: no memory for reassembly\n");
526 printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n");
527out_fail: 525out_fail:
528 rcu_read_lock(); 526 rcu_read_lock();
529 IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); 527 IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0aefc36f74c..e20e3206902 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -794,9 +794,7 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort,
794 goto retry; 794 goto retry;
795 } 795 }
796 796
797 if (net_ratelimit()) 797 net_warn_ratelimited("ipv6: Neighbour table overflow\n");
798 printk(KERN_WARNING
799 "ipv6: Neighbour table overflow.\n");
800 dst_free(&rt->dst); 798 dst_free(&rt->dst);
801 return NULL; 799 return NULL;
802 } 800 }
@@ -1643,9 +1641,7 @@ void rt6_redirect(const struct in6_addr *dest, const struct in6_addr *src,
1643 rt = ip6_route_redirect(dest, src, saddr, neigh->dev); 1641 rt = ip6_route_redirect(dest, src, saddr, neigh->dev);
1644 1642
1645 if (rt == net->ipv6.ip6_null_entry) { 1643 if (rt == net->ipv6.ip6_null_entry) {
1646 if (net_ratelimit()) 1644 net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop for redirect target\n");
1647 printk(KERN_DEBUG "rt6_redirect: source isn't a valid nexthop "
1648 "for redirect target\n");
1649 goto out; 1645 goto out;
1650 } 1646 }
1651 1647
@@ -2106,9 +2102,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
2106 int err; 2102 int err;
2107 2103
2108 if (!rt) { 2104 if (!rt) {
2109 if (net_ratelimit()) 2105 net_warn_ratelimited("IPv6: Maximum number of routes reached, consider increasing route/max_size\n");
2110 pr_warning("IPv6: Maximum number of routes reached,"
2111 " consider increasing route/max_size.\n");
2112 return ERR_PTR(-ENOMEM); 2106 return ERR_PTR(-ENOMEM);
2113 } 2107 }
2114 2108
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index e5fef943e30..a36a09701bf 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -702,8 +702,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
702 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr); 702 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr);
703 703
704 if (neigh == NULL) { 704 if (neigh == NULL) {
705 if (net_ratelimit()) 705 net_dbg_ratelimited("sit: nexthop == NULL\n");
706 printk(KERN_DEBUG "sit: nexthop == NULL\n");
707 goto tx_error; 706 goto tx_error;
708 } 707 }
709 708
@@ -732,8 +731,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
732 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr); 731 neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr);
733 732
734 if (neigh == NULL) { 733 if (neigh == NULL) {
735 if (net_ratelimit()) 734 net_dbg_ratelimited("sit: nexthop == NULL\n");
736 printk(KERN_DEBUG "sit: nexthop == NULL\n");
737 goto tx_error; 735 goto tx_error;
738 } 736 }
739 737
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 078d039e8fd..4cf55ae7bf8 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -723,12 +723,10 @@ static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
723 NULL, NULL, skb); 723 NULL, NULL, skb);
724 724
725 if (genhash || memcmp(hash_location, newhash, 16) != 0) { 725 if (genhash || memcmp(hash_location, newhash, 16) != 0) {
726 if (net_ratelimit()) { 726 net_info_ratelimited("MD5 Hash %s for [%pI6c]:%u->[%pI6c]:%u\n",
727 printk(KERN_INFO "MD5 Hash %s for [%pI6c]:%u->[%pI6c]:%u\n", 727 genhash ? "failed" : "mismatch",
728 genhash ? "failed" : "mismatch", 728 &ip6h->saddr, ntohs(th->source),
729 &ip6h->saddr, ntohs(th->source), 729 &ip6h->daddr, ntohs(th->dest));
730 &ip6h->daddr, ntohs(th->dest));
731 }
732 return 1; 730 return 1;
733 } 731 }
734 return 0; 732 return 0;