Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ipv4: Standardize prefixes for message logging

Add #define pr_fmt(fmt) as appropriate.

Add "IPv4: ", "TCP: ", and "IPsec: " to appropriate files.
Standardize on "UDPLite: " for appropriate uses.
Some prefixes were previously "UDPLITE: " and "UDP-Lite: ".

Add KBUILD_MODNAME ": " to icmp and gre.
Remove embedded prefixes as appropriate.

Add missing "\n" to pr_info in gre.c.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Joe Perches and committed by
David S. Miller
afd46503 058bd4d2

+81 -50
+2 -2
include/net/udplite.h
··· 40 40 * checksum. UDP-Lite (like IPv6) mandates checksums, hence packets 41 41 * with a zero checksum field are illegal. */ 42 42 if (uh->check == 0) { 43 - LIMIT_NETDEBUG(KERN_DEBUG "UDPLITE: zeroed checksum field\n"); 43 + LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: zeroed checksum field\n"); 44 44 return 1; 45 45 } 46 46 ··· 52 52 /* 53 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 + LIMIT_NETDEBUG(KERN_DEBUG "UDPLite: bad csum coverage %d/%d\n", 56 56 cscov, skb->len); 57 57 return 1; 58 58
+2
net/ipv4/af_inet.c
··· 65 65 * 2 of the License, or (at your option) any later version. 66 66 */ 67 67 68 + #define pr_fmt(fmt) "IPv4: " fmt 69 + 68 70 #include <linux/err.h> 69 71 #include <linux/errno.h> 70 72 #include <linux/types.h>
+6 -3
net/ipv4/ah4.c
··· 1 + #define pr_fmt(fmt) "IPsec: " fmt 2 + 1 3 #include <crypto/hash.h> 2 4 #include <linux/err.h> 3 5 #include <linux/module.h> ··· 447 445 448 446 if (aalg_desc->uinfo.auth.icv_fullbits/8 != 449 447 crypto_ahash_digestsize(ahash)) { 450 - pr_info("AH: %s digestsize %u != %hu\n", 451 - x->aalg->alg_name, crypto_ahash_digestsize(ahash), 452 - aalg_desc->uinfo.auth.icv_fullbits/8); 448 + pr_info("%s: %s digestsize %u != %hu\n", 449 + __func__, x->aalg->alg_name, 450 + crypto_ahash_digestsize(ahash), 451 + aalg_desc->uinfo.auth.icv_fullbits / 8); 453 452 goto error; 454 453 } 455 454
+2
net/ipv4/esp4.c
··· 1 + #define pr_fmt(fmt) "IPsec: " fmt 2 + 1 3 #include <crypto/aead.h> 2 4 #include <crypto/authenc.h> 3 5 #include <linux/err.h>
+4 -2
net/ipv4/gre.c
··· 10 10 * 11 11 */ 12 12 13 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 + 13 15 #include <linux/module.h> 14 16 #include <linux/kernel.h> 15 17 #include <linux/kmod.h> ··· 120 118 121 119 static int __init gre_init(void) 122 120 { 123 - pr_info("GRE over IPv4 demultiplexor driver"); 121 + pr_info("GRE over IPv4 demultiplexor driver\n"); 124 122 125 123 if (inet_add_protocol(&net_gre_protocol, IPPROTO_GRE) < 0) { 126 - pr_err("gre: can't add protocol\n"); 124 + pr_err("can't add protocol\n"); 127 125 return -EAGAIN; 128 126 } 129 127
+4 -2
net/ipv4/icmp.c
··· 62 62 * 63 63 */ 64 64 65 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 66 + 65 67 #include <linux/module.h> 66 68 #include <linux/types.h> 67 69 #include <linux/jiffies.h> ··· 672 670 break; 673 671 case ICMP_FRAG_NEEDED: 674 672 if (ipv4_config.no_pmtu_disc) { 675 - LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: fragmentation needed and DF set\n", 673 + LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: fragmentation needed and DF set\n"), 676 674 &iph->daddr); 677 675 } else { 678 676 info = ip_rt_frag_needed(net, iph, ··· 683 681 } 684 682 break; 685 683 case ICMP_SR_FAILED: 686 - LIMIT_NETDEBUG(KERN_INFO "ICMP: %pI4: Source Route Failed\n", 684 + LIMIT_NETDEBUG(KERN_INFO pr_fmt("%pI4: Source Route Failed\n"), 687 685 &iph->daddr); 688 686 break; 689 687 default:
+5 -3
net/ipv4/ip_fragment.c
··· 20 20 * Patrick McHardy : LRU queue of frag heads for evictor. 21 21 */ 22 22 23 + #define pr_fmt(fmt) "IPv4: " fmt 24 + 23 25 #include <linux/compiler.h> 24 26 #include <linux/module.h> 25 27 #include <linux/types.h> ··· 301 299 return container_of(q, struct ipq, q); 302 300 303 301 out_nomem: 304 - LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n"); 302 + LIMIT_NETDEBUG(KERN_ERR pr_fmt("ip_frag_create: no memory left !\n")); 305 303 return NULL; 306 304 } 307 305 ··· 639 637 return 0; 640 638 641 639 out_nomem: 642 - LIMIT_NETDEBUG(KERN_ERR "IP: queue_glue: no memory for gluing " 643 - "queue %p\n", qp); 640 + LIMIT_NETDEBUG(KERN_ERR pr_fmt("queue_glue: no memory for gluing queue %p\n"), 641 + qp); 644 642 err = -ENOMEM; 645 643 goto out_fail; 646 644 out_oversize:
+2
net/ipv4/ip_gre.c
··· 10 10 * 11 11 */ 12 12 13 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 + 13 15 #include <linux/capability.h> 14 16 #include <linux/module.h> 15 17 #include <linux/types.h>
+2
net/ipv4/ip_input.c
··· 113 113 * 2 of the License, or (at your option) any later version. 114 114 */ 115 115 116 + #define pr_fmt(fmt) "IPv4: " fmt 117 + 116 118 #include <asm/system.h> 117 119 #include <linux/module.h> 118 120 #include <linux/types.h>
+2
net/ipv4/ip_options.c
··· 9 9 * 10 10 */ 11 11 12 + #define pr_fmt(fmt) "IPv4: " fmt 13 + 12 14 #include <linux/capability.h> 13 15 #include <linux/module.h> 14 16 #include <linux/slab.h>
+3 -1
net/ipv4/route.c
··· 62 62 * 2 of the License, or (at your option) any later version. 63 63 */ 64 64 65 + #define pr_fmt(fmt) "IPv4: " fmt 66 + 65 67 #include <linux/module.h> 66 68 #include <asm/uaccess.h> 67 69 #include <asm/system.h> ··· 1300 1298 } 1301 1299 1302 1300 if (net_ratelimit()) 1303 - pr_warn("ipv4: Neighbour table overflow\n"); 1301 + pr_warn("Neighbour table overflow\n"); 1304 1302 rt_drop(rt); 1305 1303 return ERR_PTR(-ENOBUFS); 1306 1304 }
+7 -4
net/ipv4/tcp.c
··· 245 245 * TCP_CLOSE socket is finished 246 246 */ 247 247 248 + #define pr_fmt(fmt) "TCP: " fmt 249 + 248 250 #include <linux/kernel.h> 249 251 #include <linux/module.h> 250 252 #include <linux/types.h> ··· 1677 1675 1678 1676 if (tp->ucopy.dma_cookie < 0) { 1679 1677 1680 - pr_alert("dma_cookie < 0\n"); 1678 + pr_alert("%s: dma_cookie < 0\n", 1679 + __func__); 1681 1680 1682 1681 /* Exception. Bailout! */ 1683 1682 if (!copied) ··· 1887 1884 out_of_socket_memory = tcp_out_of_memory(sk); 1888 1885 1889 1886 if (too_many_orphans && net_ratelimit()) 1890 - pr_info("TCP: too many orphaned sockets\n"); 1887 + pr_info("too many orphaned sockets\n"); 1891 1888 if (out_of_socket_memory && net_ratelimit()) 1892 - pr_info("TCP: out of memory -- consider tuning tcp_mem\n"); 1889 + pr_info("out of memory -- consider tuning tcp_mem\n"); 1893 1890 return too_many_orphans || out_of_socket_memory; 1894 1891 } 1895 1892 ··· 3314 3311 sysctl_tcp_rmem[1] = 87380; 3315 3312 sysctl_tcp_rmem[2] = max(87380, max_share); 3316 3313 3317 - pr_info("TCP: Hash tables configured (established %u bind %u)\n", 3314 + pr_info("Hash tables configured (established %u bind %u)\n", 3318 3315 tcp_hashinfo.ehash_mask + 1, tcp_hashinfo.bhash_size); 3319 3316 3320 3317 tcp_register_congestion_control(&tcp_reno);
+5 -3
net/ipv4/tcp_cong.c
··· 6 6 * Copyright (C) 2005 Stephen Hemminger <shemminger@osdl.org> 7 7 */ 8 8 9 + #define pr_fmt(fmt) "TCP: " fmt 10 + 9 11 #include <linux/module.h> 10 12 #include <linux/mm.h> 11 13 #include <linux/types.h> ··· 43 41 44 42 /* all algorithms must implement ssthresh and cong_avoid ops */ 45 43 if (!ca->ssthresh || !ca->cong_avoid) { 46 - pr_err("TCP %s does not implement required ops\n", ca->name); 44 + pr_err("%s does not implement required ops\n", ca->name); 47 45 return -EINVAL; 48 46 } 49 47 50 48 spin_lock(&tcp_cong_list_lock); 51 49 if (tcp_ca_find(ca->name)) { 52 - pr_notice("TCP %s already registered\n", ca->name); 50 + pr_notice("%s already registered\n", ca->name); 53 51 ret = -EEXIST; 54 52 } else { 55 53 list_add_tail_rcu(&ca->list, &tcp_cong_list); 56 - pr_info("TCP %s registered\n", ca->name); 54 + pr_info("%s registered\n", ca->name); 57 55 } 58 56 spin_unlock(&tcp_cong_list_lock); 59 57
+2
net/ipv4/tcp_input.c
··· 61 61 * Pasi Sarolahti: F-RTO for dealing with spurious RTOs 62 62 */ 63 63 64 + #define pr_fmt(fmt) "TCP: " fmt 65 + 64 66 #include <linux/mm.h> 65 67 #include <linux/slab.h> 66 68 #include <linux/module.h>
+3 -3
net/ipv4/tcp_ipv4.c
··· 50 50 * a single port at the same time. 51 51 */ 52 52 53 + #define pr_fmt(fmt) "TCP: " fmt 53 54 54 55 #include <linux/bottom_half.h> 55 56 #include <linux/types.h> ··· 877 876 lopt = inet_csk(sk)->icsk_accept_queue.listen_opt; 878 877 if (!lopt->synflood_warned) { 879 878 lopt->synflood_warned = 1; 880 - pr_info("%s: Possible SYN flooding on port %d. %s. " 881 - " Check SNMP counters.\n", 879 + pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n", 882 880 proto, ntohs(tcp_hdr(skb)->dest), msg); 883 881 } 884 882 return want_cookie; ··· 1399 1399 * to destinations, already remembered 1400 1400 * to the moment of synflood. 1401 1401 */ 1402 - LIMIT_NETDEBUG(KERN_DEBUG "TCP: drop open request from %pI4/%u\n", 1402 + LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("drop open request from %pI4/%u\n"), 1403 1403 &saddr, ntohs(tcp_hdr(skb)->source)); 1404 1404 goto drop_and_release; 1405 1405 }
+3 -1
net/ipv4/tcp_probe.c
··· 18 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 */ 20 20 21 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 22 + 21 23 #include <linux/kernel.h> 22 24 #include <linux/kprobes.h> 23 25 #include <linux/socket.h> ··· 241 239 if (ret) 242 240 goto err1; 243 241 244 - pr_info("TCP probe registered (port=%d) bufsize=%u\n", port, bufsize); 242 + pr_info("probe registered (port=%d) bufsize=%u\n", port, bufsize); 245 243 return 0; 246 244 err1: 247 245 proc_net_remove(&init_net, procname);
+8 -6
net/ipv4/tcp_timer.c
··· 333 333 */ 334 334 struct inet_sock *inet = inet_sk(sk); 335 335 if (sk->sk_family == AF_INET) { 336 - LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI4:%u/%u unexpectedly shrunk window %u:%u (repaired)\n", 337 - &inet->inet_daddr, ntohs(inet->inet_dport), 338 - inet->inet_num, tp->snd_una, tp->snd_nxt); 336 + LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("Peer %pI4:%u/%u unexpectedly shrunk window %u:%u (repaired)\n"), 337 + &inet->inet_daddr, 338 + ntohs(inet->inet_dport), inet->inet_num, 339 + tp->snd_una, tp->snd_nxt); 339 340 } 340 341 #if IS_ENABLED(CONFIG_IPV6) 341 342 else if (sk->sk_family == AF_INET6) { 342 343 struct ipv6_pinfo *np = inet6_sk(sk); 343 - LIMIT_NETDEBUG(KERN_DEBUG "TCP: Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n", 344 - &np->daddr, ntohs(inet->inet_dport), 345 - inet->inet_num, tp->snd_una, tp->snd_nxt); 344 + LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("Peer %pI6:%u/%u unexpectedly shrunk window %u:%u (repaired)\n"), 345 + &np->daddr, 346 + ntohs(inet->inet_dport), inet->inet_num, 347 + tp->snd_una, tp->snd_nxt); 346 348 } 347 349 #endif 348 350 if (tcp_time_stamp - tp->rcv_tstamp > TCP_RTO_MAX) {
+14 -20
net/ipv4/udp.c
··· 77 77 * 2 of the License, or (at your option) any later version. 78 78 */ 79 79 80 + #define pr_fmt(fmt) "UDP: " fmt 81 + 80 82 #include <asm/system.h> 81 83 #include <asm/uaccess.h> 82 84 #include <asm/ioctls.h> ··· 977 975 /* ... which is an evident application bug. --ANK */ 978 976 release_sock(sk); 979 977 980 - LIMIT_NETDEBUG(KERN_DEBUG "udp cork app bug 2\n"); 978 + LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("cork app bug 2\n")); 981 979 err = -EINVAL; 982 980 goto out; 983 981 } ··· 1056 1054 if (unlikely(!up->pending)) { 1057 1055 release_sock(sk); 1058 1056 1059 - LIMIT_NETDEBUG(KERN_DEBUG "udp cork app bug 3\n"); 1057 + LIMIT_NETDEBUG(KERN_DEBUG pr_fmt("udp cork app bug 3\n")); 1060 1058 return -EINVAL; 1061 1059 } 1062 1060 ··· 1449 1447 * provided by the application." 1450 1448 */ 1451 1449 if (up->pcrlen == 0) { /* full coverage was set */ 1452 - LIMIT_NETDEBUG(KERN_WARNING "UDPLITE: partial coverage " 1453 - "%d while full coverage %d requested\n", 1454 - UDP_SKB_CB(skb)->cscov, skb->len); 1450 + LIMIT_NETDEBUG(KERN_WARNING "UDPLite: partial coverage %d while full coverage %d requested\n", 1451 + UDP_SKB_CB(skb)->cscov, skb->len); 1455 1452 goto drop; 1456 1453 } 1457 1454 /* The next case involves violating the min. coverage requested ··· 1460 1459 * Therefore the above ...()->partial_cov statement is essential. 1461 1460 */ 1462 1461 if (UDP_SKB_CB(skb)->cscov < up->pcrlen) { 1463 - LIMIT_NETDEBUG(KERN_WARNING 1464 - "UDPLITE: coverage %d too small, need min %d\n", 1465 - UDP_SKB_CB(skb)->cscov, up->pcrlen); 1462 + LIMIT_NETDEBUG(KERN_WARNING "UDPLite: coverage %d too small, need min %d\n", 1463 + UDP_SKB_CB(skb)->cscov, up->pcrlen); 1466 1464 goto drop; 1467 1465 } 1468 1466 } ··· 1689 1689 1690 1690 short_packet: 1691 1691 LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: short packet: From %pI4:%u %d/%d to %pI4:%u\n", 1692 - proto == IPPROTO_UDPLITE ? "-Lite" : "", 1693 - &saddr, 1694 - ntohs(uh->source), 1695 - ulen, 1696 - skb->len, 1697 - &daddr, 1698 - ntohs(uh->dest)); 1692 + proto == IPPROTO_UDPLITE ? "Lite" : "", 1693 + &saddr, ntohs(uh->source), 1694 + ulen, skb->len, 1695 + &daddr, ntohs(uh->dest)); 1699 1696 goto drop; 1700 1697 1701 1698 csum_error: ··· 1701 1704 * the network is concerned, anyway) as per 4.1.3.4 (MUST). 1702 1705 */ 1703 1706 LIMIT_NETDEBUG(KERN_DEBUG "UDP%s: bad checksum. From %pI4:%u to %pI4:%u ulen %d\n", 1704 - proto == IPPROTO_UDPLITE ? "-Lite" : "", 1705 - &saddr, 1706 - ntohs(uh->source), 1707 - &daddr, 1708 - ntohs(uh->dest), 1707 + proto == IPPROTO_UDPLITE ? "Lite" : "", 1708 + &saddr, ntohs(uh->source), &daddr, ntohs(uh->dest), 1709 1709 ulen); 1710 1710 drop: 1711 1711 UDP_INC_STATS_BH(net, UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
+3
net/ipv4/udplite.c
··· 10 10 * as published by the Free Software Foundation; either version 11 11 * 2 of the License, or (at your option) any later version. 12 12 */ 13 + 14 + #define pr_fmt(fmt) "UDPLite: " fmt 15 + 13 16 #include <linux/export.h> 14 17 #include "udp_impl.h" 15 18
+2
net/ipv4/xfrm4_tunnel.c
··· 3 3 * Copyright (C) 2003 David S. Miller (davem@redhat.com) 4 4 */ 5 5 6 + #define pr_fmt(fmt) "IPsec: " fmt 7 + 6 8 #include <linux/skbuff.h> 7 9 #include <linux/module.h> 8 10 #include <linux/mutex.h>