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

netfilter: cleanup printk messages

Make sure all printk messages have a severity level.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>

authored by

Stephen Hemminger and committed by
Patrick McHardy
654d0fbd af567603

+64 -64
+2 -2
net/ipv4/netfilter/arp_tables.c
··· 222 222 arpt_error(struct sk_buff *skb, const struct xt_action_param *par) 223 223 { 224 224 if (net_ratelimit()) 225 - printk("arp_tables: error: '%s'\n", 225 + pr_err("arp_tables: error: '%s'\n", 226 226 (const char *)par->targinfo); 227 227 228 228 return NF_DROP; ··· 385 385 int visited = e->comefrom & (1 << hook); 386 386 387 387 if (e->comefrom & (1 << NF_ARP_NUMHOOKS)) { 388 - printk("arptables: loop hook %u pos %u %08X.\n", 388 + pr_notice("arptables: loop hook %u pos %u %08X.\n", 389 389 hook, pos, e->comefrom); 390 390 return 0; 391 391 }
+1 -1
net/ipv4/netfilter/ip_tables.c
··· 466 466 int visited = e->comefrom & (1 << hook); 467 467 468 468 if (e->comefrom & (1 << NF_INET_NUMHOOKS)) { 469 - printk("iptables: loop hook %u pos %u %08X.\n", 469 + pr_err("iptables: loop hook %u pos %u %08X.\n", 470 470 hook, pos, e->comefrom); 471 471 return 0; 472 472 }
+1 -1
net/ipv4/netfilter/iptable_filter.c
··· 89 89 int ret; 90 90 91 91 if (forward < 0 || forward > NF_MAX_VERDICT) { 92 - printk("iptables forward must be 0 or 1\n"); 92 + pr_err("iptables forward must be 0 or 1\n"); 93 93 return -EINVAL; 94 94 } 95 95
+5 -5
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
··· 382 382 383 383 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_tcp4); 384 384 if (ret < 0) { 385 - printk("nf_conntrack_ipv4: can't register tcp.\n"); 385 + pr_err("nf_conntrack_ipv4: can't register tcp.\n"); 386 386 goto cleanup_sockopt; 387 387 } 388 388 389 389 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_udp4); 390 390 if (ret < 0) { 391 - printk("nf_conntrack_ipv4: can't register udp.\n"); 391 + pr_err("nf_conntrack_ipv4: can't register udp.\n"); 392 392 goto cleanup_tcp; 393 393 } 394 394 395 395 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_icmp); 396 396 if (ret < 0) { 397 - printk("nf_conntrack_ipv4: can't register icmp.\n"); 397 + pr_err("nf_conntrack_ipv4: can't register icmp.\n"); 398 398 goto cleanup_udp; 399 399 } 400 400 401 401 ret = nf_conntrack_l3proto_register(&nf_conntrack_l3proto_ipv4); 402 402 if (ret < 0) { 403 - printk("nf_conntrack_ipv4: can't register ipv4\n"); 403 + pr_err("nf_conntrack_ipv4: can't register ipv4\n"); 404 404 goto cleanup_icmp; 405 405 } 406 406 407 407 ret = nf_register_hooks(ipv4_conntrack_ops, 408 408 ARRAY_SIZE(ipv4_conntrack_ops)); 409 409 if (ret < 0) { 410 - printk("nf_conntrack_ipv4: can't register hooks.\n"); 410 + pr_err("nf_conntrack_ipv4: can't register hooks.\n"); 411 411 goto cleanup_ipv4; 412 412 } 413 413 #if defined(CONFIG_PROC_FS) && defined(CONFIG_NF_CONNTRACK_PROC_COMPAT)
+8 -8
net/ipv4/netfilter/nf_nat_h323.c
··· 43 43 addroff, sizeof(buf), 44 44 (char *) &buf, sizeof(buf))) { 45 45 if (net_ratelimit()) 46 - printk("nf_nat_h323: nf_nat_mangle_tcp_packet" 46 + pr_notice("nf_nat_h323: nf_nat_mangle_tcp_packet" 47 47 " error\n"); 48 48 return -1; 49 49 } ··· 59 59 addroff, sizeof(buf), 60 60 (char *) &buf, sizeof(buf))) { 61 61 if (net_ratelimit()) 62 - printk("nf_nat_h323: nf_nat_mangle_udp_packet" 62 + pr_notice("nf_nat_h323: nf_nat_mangle_udp_packet" 63 63 " error\n"); 64 64 return -1; 65 65 } ··· 215 215 /* Run out of expectations */ 216 216 if (i >= H323_RTP_CHANNEL_MAX) { 217 217 if (net_ratelimit()) 218 - printk("nf_nat_h323: out of expectations\n"); 218 + pr_notice("nf_nat_h323: out of expectations\n"); 219 219 return 0; 220 220 } 221 221 ··· 234 234 235 235 if (nated_port == 0) { /* No port available */ 236 236 if (net_ratelimit()) 237 - printk("nf_nat_h323: out of RTP ports\n"); 237 + pr_notice("nf_nat_h323: out of RTP ports\n"); 238 238 return 0; 239 239 } 240 240 ··· 291 291 292 292 if (nated_port == 0) { /* No port available */ 293 293 if (net_ratelimit()) 294 - printk("nf_nat_h323: out of TCP ports\n"); 294 + pr_notice("nf_nat_h323: out of TCP ports\n"); 295 295 return 0; 296 296 } 297 297 ··· 341 341 342 342 if (nated_port == 0) { /* No port available */ 343 343 if (net_ratelimit()) 344 - printk("nf_nat_q931: out of TCP ports\n"); 344 + pr_notice("nf_nat_q931: out of TCP ports\n"); 345 345 return 0; 346 346 } 347 347 ··· 425 425 426 426 if (nated_port == 0) { /* No port available */ 427 427 if (net_ratelimit()) 428 - printk("nf_nat_ras: out of TCP ports\n"); 428 + pr_notice("nf_nat_ras: out of TCP ports\n"); 429 429 return 0; 430 430 } 431 431 ··· 507 507 508 508 if (nated_port == 0) { /* No port available */ 509 509 if (net_ratelimit()) 510 - printk("nf_nat_q931: out of TCP ports\n"); 510 + pr_notice("nf_nat_q931: out of TCP ports\n"); 511 511 return 0; 512 512 } 513 513
+8 -8
net/ipv4/netfilter/nf_nat_snmp_basic.c
··· 401 401 *octets = kmalloc(eoc - ctx->pointer, GFP_ATOMIC); 402 402 if (*octets == NULL) { 403 403 if (net_ratelimit()) 404 - printk("OOM in bsalg (%d)\n", __LINE__); 404 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 405 405 return 0; 406 406 } 407 407 ··· 452 452 *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); 453 453 if (*oid == NULL) { 454 454 if (net_ratelimit()) 455 - printk("OOM in bsalg (%d)\n", __LINE__); 455 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 456 456 return 0; 457 457 } 458 458 ··· 729 729 if (*obj == NULL) { 730 730 kfree(id); 731 731 if (net_ratelimit()) 732 - printk("OOM in bsalg (%d)\n", __LINE__); 732 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 733 733 return 0; 734 734 } 735 735 (*obj)->syntax.l[0] = l; ··· 746 746 kfree(p); 747 747 kfree(id); 748 748 if (net_ratelimit()) 749 - printk("OOM in bsalg (%d)\n", __LINE__); 749 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 750 750 return 0; 751 751 } 752 752 memcpy((*obj)->syntax.c, p, len); ··· 761 761 if (*obj == NULL) { 762 762 kfree(id); 763 763 if (net_ratelimit()) 764 - printk("OOM in bsalg (%d)\n", __LINE__); 764 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 765 765 return 0; 766 766 } 767 767 if (!asn1_null_decode(ctx, end)) { ··· 782 782 kfree(lp); 783 783 kfree(id); 784 784 if (net_ratelimit()) 785 - printk("OOM in bsalg (%d)\n", __LINE__); 785 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 786 786 return 0; 787 787 } 788 788 memcpy((*obj)->syntax.ul, lp, len); ··· 803 803 kfree(p); 804 804 kfree(id); 805 805 if (net_ratelimit()) 806 - printk("OOM in bsalg (%d)\n", __LINE__); 806 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 807 807 return 0; 808 808 } 809 809 memcpy((*obj)->syntax.uc, p, len); ··· 821 821 if (*obj == NULL) { 822 822 kfree(id); 823 823 if (net_ratelimit()) 824 - printk("OOM in bsalg (%d)\n", __LINE__); 824 + pr_notice("OOM in bsalg (%d)\n", __LINE__); 825 825 return 0; 826 826 } 827 827 (*obj)->syntax.ul[0] = ul;
+2 -2
net/ipv4/netfilter/nf_nat_standalone.c
··· 293 293 #endif 294 294 ret = nf_nat_rule_init(); 295 295 if (ret < 0) { 296 - printk("nf_nat_init: can't setup rules.\n"); 296 + pr_err("nf_nat_init: can't setup rules.\n"); 297 297 goto cleanup_decode_session; 298 298 } 299 299 ret = nf_register_hooks(nf_nat_ops, ARRAY_SIZE(nf_nat_ops)); 300 300 if (ret < 0) { 301 - printk("nf_nat_init: can't register hooks.\n"); 301 + pr_err("nf_nat_init: can't register hooks.\n"); 302 302 goto cleanup_rule_init; 303 303 } 304 304 return ret;
+1 -1
net/ipv6/netfilter/ip6_tables.c
··· 481 481 int visited = e->comefrom & (1 << hook); 482 482 483 483 if (e->comefrom & (1 << NF_INET_NUMHOOKS)) { 484 - printk("iptables: loop hook %u pos %u %08X.\n", 484 + pr_err("iptables: loop hook %u pos %u %08X.\n", 485 485 hook, pos, e->comefrom); 486 486 return 0; 487 487 }
+1 -1
net/ipv6/netfilter/ip6table_filter.c
··· 81 81 int ret; 82 82 83 83 if (forward < 0 || forward > NF_MAX_VERDICT) { 84 - printk("iptables forward must be 0 or 1\n"); 84 + pr_err("iptables forward must be 0 or 1\n"); 85 85 return -EINVAL; 86 86 } 87 87
+1 -1
net/ipv6/netfilter/ip6table_mangle.c
··· 43 43 if (skb->len < sizeof(struct iphdr) || 44 44 ip_hdrlen(skb) < sizeof(struct iphdr)) { 45 45 if (net_ratelimit()) 46 - printk("ip6t_hook: happy cracking.\n"); 46 + pr_warning("ip6t_hook: happy cracking.\n"); 47 47 return NF_ACCEPT; 48 48 } 49 49 #endif
+7 -7
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
··· 280 280 /* root is playing with raw sockets. */ 281 281 if (skb->len < sizeof(struct ipv6hdr)) { 282 282 if (net_ratelimit()) 283 - printk("ipv6_conntrack_local: packet too short\n"); 283 + pr_notice("ipv6_conntrack_local: packet too short\n"); 284 284 return NF_ACCEPT; 285 285 } 286 286 return __ipv6_conntrack_in(dev_net(out), hooknum, skb, okfn); ··· 406 406 407 407 ret = nf_ct_frag6_init(); 408 408 if (ret < 0) { 409 - printk("nf_conntrack_ipv6: can't initialize frag6.\n"); 409 + pr_err("nf_conntrack_ipv6: can't initialize frag6.\n"); 410 410 return ret; 411 411 } 412 412 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_tcp6); 413 413 if (ret < 0) { 414 - printk("nf_conntrack_ipv6: can't register tcp.\n"); 414 + pr_err("nf_conntrack_ipv6: can't register tcp.\n"); 415 415 goto cleanup_frag6; 416 416 } 417 417 418 418 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_udp6); 419 419 if (ret < 0) { 420 - printk("nf_conntrack_ipv6: can't register udp.\n"); 420 + pr_err("nf_conntrack_ipv6: can't register udp.\n"); 421 421 goto cleanup_tcp; 422 422 } 423 423 424 424 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_icmpv6); 425 425 if (ret < 0) { 426 - printk("nf_conntrack_ipv6: can't register icmpv6.\n"); 426 + pr_err("nf_conntrack_ipv6: can't register icmpv6.\n"); 427 427 goto cleanup_udp; 428 428 } 429 429 430 430 ret = nf_conntrack_l3proto_register(&nf_conntrack_l3proto_ipv6); 431 431 if (ret < 0) { 432 - printk("nf_conntrack_ipv6: can't register ipv6\n"); 432 + pr_err("nf_conntrack_ipv6: can't register ipv6\n"); 433 433 goto cleanup_icmpv6; 434 434 } 435 435 436 436 ret = nf_register_hooks(ipv6_conntrack_ops, 437 437 ARRAY_SIZE(ipv6_conntrack_ops)); 438 438 if (ret < 0) { 439 - printk("nf_conntrack_ipv6: can't register pre-routing defrag " 439 + pr_err("nf_conntrack_ipv6: can't register pre-routing defrag " 440 440 "hook.\n"); 441 441 goto cleanup_ipv6; 442 442 }
+1 -1
net/netfilter/nf_conntrack_amanda.c
··· 108 108 dataoff = protoff + sizeof(struct udphdr); 109 109 if (dataoff >= skb->len) { 110 110 if (net_ratelimit()) 111 - printk("amanda_help: skblen = %u\n", skb->len); 111 + printk(KERN_ERR "amanda_help: skblen = %u\n", skb->len); 112 112 return NF_ACCEPT; 113 113 } 114 114
+1 -1
net/netfilter/nf_conntrack_core.c
··· 1335 1335 } 1336 1336 nf_conntrack_max = max_factor * nf_conntrack_htable_size; 1337 1337 1338 - printk("nf_conntrack version %s (%u buckets, %d max)\n", 1338 + printk(KERN_INFO "nf_conntrack version %s (%u buckets, %d max)\n", 1339 1339 NF_CONNTRACK_VERSION, nf_conntrack_htable_size, 1340 1340 nf_conntrack_max); 1341 1341
+2 -2
net/netfilter/nf_conntrack_ftp.c
··· 573 573 ftp[i][j].tuple.src.l3num, ports[i]); 574 574 ret = nf_conntrack_helper_register(&ftp[i][j]); 575 575 if (ret) { 576 - printk("nf_ct_ftp: failed to register helper " 577 - " for pf: %d port: %d\n", 576 + printk(KERN_ERR "nf_ct_ftp: failed to register" 577 + " helper for pf: %d port: %d\n", 578 578 ftp[i][j].tuple.src.l3num, ports[i]); 579 579 nf_conntrack_ftp_fini(); 580 580 return ret;
+3 -3
net/netfilter/nf_conntrack_h323_main.c
··· 607 607 drop: 608 608 spin_unlock_bh(&nf_h323_lock); 609 609 if (net_ratelimit()) 610 - printk("nf_ct_h245: packet dropped\n"); 610 + pr_info("nf_ct_h245: packet dropped\n"); 611 611 return NF_DROP; 612 612 } 613 613 ··· 1152 1152 drop: 1153 1153 spin_unlock_bh(&nf_h323_lock); 1154 1154 if (net_ratelimit()) 1155 - printk("nf_ct_q931: packet dropped\n"); 1155 + pr_info("nf_ct_q931: packet dropped\n"); 1156 1156 return NF_DROP; 1157 1157 } 1158 1158 ··· 1727 1727 drop: 1728 1728 spin_unlock_bh(&nf_h323_lock); 1729 1729 if (net_ratelimit()) 1730 - printk("nf_ct_ras: packet dropped\n"); 1730 + pr_info("nf_ct_ras: packet dropped\n"); 1731 1731 return NF_DROP; 1732 1732 } 1733 1733
+2 -2
net/netfilter/nf_conntrack_irc.c
··· 235 235 char *tmpname; 236 236 237 237 if (max_dcc_channels < 1) { 238 - printk("nf_ct_irc: max_dcc_channels must not be zero\n"); 238 + printk(KERN_ERR "nf_ct_irc: max_dcc_channels must not be zero\n"); 239 239 return -EINVAL; 240 240 } 241 241 ··· 267 267 268 268 ret = nf_conntrack_helper_register(&irc[i]); 269 269 if (ret) { 270 - printk("nf_ct_irc: failed to register helper " 270 + printk(KERN_ERR "nf_ct_irc: failed to register helper " 271 271 "for pf: %u port: %u\n", 272 272 irc[i].tuple.src.l3num, ports[i]); 273 273 nf_conntrack_irc_fini();
+6 -6
net/netfilter/nf_conntrack_netlink.c
··· 2057 2057 { 2058 2058 int ret; 2059 2059 2060 - printk("ctnetlink v%s: registering with nfnetlink.\n", version); 2060 + pr_info("ctnetlink v%s: registering with nfnetlink.\n", version); 2061 2061 ret = nfnetlink_subsys_register(&ctnl_subsys); 2062 2062 if (ret < 0) { 2063 - printk("ctnetlink_init: cannot register with nfnetlink.\n"); 2063 + pr_err("ctnetlink_init: cannot register with nfnetlink.\n"); 2064 2064 goto err_out; 2065 2065 } 2066 2066 2067 2067 ret = nfnetlink_subsys_register(&ctnl_exp_subsys); 2068 2068 if (ret < 0) { 2069 - printk("ctnetlink_init: cannot register exp with nfnetlink.\n"); 2069 + pr_err("ctnetlink_init: cannot register exp with nfnetlink.\n"); 2070 2070 goto err_unreg_subsys; 2071 2071 } 2072 2072 2073 2073 #ifdef CONFIG_NF_CONNTRACK_EVENTS 2074 2074 ret = nf_conntrack_register_notifier(&ctnl_notifier); 2075 2075 if (ret < 0) { 2076 - printk("ctnetlink_init: cannot register notifier.\n"); 2076 + pr_err("ctnetlink_init: cannot register notifier.\n"); 2077 2077 goto err_unreg_exp_subsys; 2078 2078 } 2079 2079 2080 2080 ret = nf_ct_expect_register_notifier(&ctnl_notifier_exp); 2081 2081 if (ret < 0) { 2082 - printk("ctnetlink_init: cannot expect register notifier.\n"); 2082 + pr_err("ctnetlink_init: cannot expect register notifier.\n"); 2083 2083 goto err_unreg_notifier; 2084 2084 } 2085 2085 #endif ··· 2100 2100 2101 2101 static void __exit ctnetlink_exit(void) 2102 2102 { 2103 - printk("ctnetlink: unregistering from nfnetlink.\n"); 2103 + pr_info("ctnetlink: unregistering from nfnetlink.\n"); 2104 2104 2105 2105 #ifdef CONFIG_NF_CONNTRACK_EVENTS 2106 2106 nf_ct_expect_unregister_notifier(&ctnl_notifier_exp);
+2 -2
net/netfilter/nf_conntrack_proto_sctp.c
··· 717 717 718 718 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_sctp4); 719 719 if (ret) { 720 - printk("nf_conntrack_l4proto_sctp4: protocol register failed\n"); 720 + pr_err("nf_conntrack_l4proto_sctp4: protocol register failed\n"); 721 721 goto out; 722 722 } 723 723 ret = nf_conntrack_l4proto_register(&nf_conntrack_l4proto_sctp6); 724 724 if (ret) { 725 - printk("nf_conntrack_l4proto_sctp6: protocol register failed\n"); 725 + pr_err("nf_conntrack_l4proto_sctp6: protocol register failed\n"); 726 726 goto cleanup_sctp4; 727 727 } 728 728
+2 -2
net/netfilter/nf_conntrack_sip.c
··· 1549 1549 1550 1550 ret = nf_conntrack_helper_register(&sip[i][j]); 1551 1551 if (ret) { 1552 - printk("nf_ct_sip: failed to register helper " 1553 - "for pf: %u port: %u\n", 1552 + printk(KERN_ERR "nf_ct_sip: failed to register" 1553 + " helper for pf: %u port: %u\n", 1554 1554 sip[i][j].tuple.src.l3num, ports[i]); 1555 1555 nf_conntrack_sip_fini(); 1556 1556 return ret;
+1 -1
net/netfilter/nf_conntrack_standalone.c
··· 446 446 if (net_eq(net, &init_net)) 447 447 unregister_sysctl_table(nf_ct_netfilter_header); 448 448 out: 449 - printk("nf_conntrack: can't register to sysctl.\n"); 449 + printk(KERN_ERR "nf_conntrack: can't register to sysctl.\n"); 450 450 return -ENOMEM; 451 451 } 452 452
+2 -2
net/netfilter/nf_conntrack_tftp.c
··· 138 138 139 139 ret = nf_conntrack_helper_register(&tftp[i][j]); 140 140 if (ret) { 141 - printk("nf_ct_tftp: failed to register helper " 142 - "for pf: %u port: %u\n", 141 + printk(KERN_ERR "nf_ct_tftp: failed to register" 142 + " helper for pf: %u port: %u\n", 143 143 tftp[i][j].tuple.src.l3num, ports[i]); 144 144 nf_conntrack_tftp_fini(); 145 145 return ret;
+1 -1
net/netfilter/nf_internals.h
··· 6 6 #include <linux/netdevice.h> 7 7 8 8 #ifdef CONFIG_NETFILTER_DEBUG 9 - #define NFDEBUG(format, args...) printk(format , ## args) 9 + #define NFDEBUG(format, args...) printk(KERN_DEBUG format , ## args) 10 10 #else 11 11 #define NFDEBUG(format, args...) 12 12 #endif
+2 -2
net/netfilter/nfnetlink.c
··· 212 212 213 213 static int __init nfnetlink_init(void) 214 214 { 215 - printk("Netfilter messages via NETLINK v%s.\n", nfversion); 215 + pr_info("Netfilter messages via NETLINK v%s.\n", nfversion); 216 216 return register_pernet_subsys(&nfnetlink_net_ops); 217 217 } 218 218 219 219 static void __exit nfnetlink_exit(void) 220 220 { 221 - printk("Removing netfilter NETLINK layer.\n"); 221 + pr_info("Removing netfilter NETLINK layer.\n"); 222 222 unregister_pernet_subsys(&nfnetlink_net_ops); 223 223 } 224 224 module_init(nfnetlink_init);