Commit 09605cc1 authored by Bastian Stender's avatar Bastian Stender Committed by David S. Miller

net ipv4: use preferred log methods

Replace printk calls with preferred unconditional log method calls to keep
kernel messages clean.

Added newline to "too small MTU" message.
Signed-off-by: default avatarBastian Stender <bst@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 34258a32
...@@ -65,15 +65,6 @@ ...@@ -65,15 +65,6 @@
#include <net/checksum.h> #include <net/checksum.h>
#include <asm/processor.h> #include <asm/processor.h>
/* Define this to allow debugging output */
#undef IPCONFIG_DEBUG
#ifdef IPCONFIG_DEBUG
#define DBG(x) printk x
#else
#define DBG(x) do { } while(0)
#endif
#if defined(CONFIG_IP_PNP_DHCP) #if defined(CONFIG_IP_PNP_DHCP)
#define IPCONFIG_DHCP #define IPCONFIG_DHCP
#endif #endif
...@@ -227,7 +218,7 @@ static int __init ic_open_devs(void) ...@@ -227,7 +218,7 @@ static int __init ic_open_devs(void)
if (dev->mtu >= 364) if (dev->mtu >= 364)
able |= IC_BOOTP; able |= IC_BOOTP;
else else
pr_warn("DHCP/BOOTP: Ignoring device %s, MTU %d too small", pr_warn("DHCP/BOOTP: Ignoring device %s, MTU %d too small\n",
dev->name, dev->mtu); dev->name, dev->mtu);
if (!(dev->flags & IFF_NOARP)) if (!(dev->flags & IFF_NOARP))
able |= IC_RARP; able |= IC_RARP;
...@@ -254,8 +245,8 @@ static int __init ic_open_devs(void) ...@@ -254,8 +245,8 @@ static int __init ic_open_devs(void)
else else
d->xid = 0; d->xid = 0;
ic_proto_have_if |= able; ic_proto_have_if |= able;
DBG(("IP-Config: %s UP (able=%d, xid=%08x)\n", pr_debug("IP-Config: %s UP (able=%d, xid=%08x)\n",
dev->name, able, d->xid)); dev->name, able, d->xid);
} }
} }
...@@ -311,7 +302,7 @@ static void __init ic_close_devs(void) ...@@ -311,7 +302,7 @@ static void __init ic_close_devs(void)
next = d->next; next = d->next;
dev = d->dev; dev = d->dev;
if (dev != ic_dev && !netdev_uses_dsa(dev)) { if (dev != ic_dev && !netdev_uses_dsa(dev)) {
DBG(("IP-Config: Downing %s\n", dev->name)); pr_debug("IP-Config: Downing %s\n", dev->name);
dev_change_flags(dev, d->flags); dev_change_flags(dev, d->flags);
} }
kfree(d); kfree(d);
...@@ -464,7 +455,8 @@ static int __init ic_defaults(void) ...@@ -464,7 +455,8 @@ static int __init ic_defaults(void)
&ic_myaddr); &ic_myaddr);
return -1; return -1;
} }
printk("IP-Config: Guessing netmask %pI4\n", &ic_netmask); pr_notice("IP-Config: Guessing netmask %pI4\n",
&ic_netmask);
} }
return 0; return 0;
...@@ -675,9 +667,7 @@ ic_dhcp_init_options(u8 *options) ...@@ -675,9 +667,7 @@ ic_dhcp_init_options(u8 *options)
u8 *e = options; u8 *e = options;
int len; int len;
#ifdef IPCONFIG_DEBUG pr_debug("DHCP: Sending message type %d\n", mt);
printk("DHCP: Sending message type %d\n", mt);
#endif
memcpy(e, ic_bootp_cookie, 4); /* RFC1048 Magic Cookie */ memcpy(e, ic_bootp_cookie, 4); /* RFC1048 Magic Cookie */
e += 4; e += 4;
...@@ -847,7 +837,8 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d ...@@ -847,7 +837,8 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
else if (dev->type == ARPHRD_FDDI) else if (dev->type == ARPHRD_FDDI)
b->htype = ARPHRD_ETHER; b->htype = ARPHRD_ETHER;
else { else {
printk("Unknown ARP type 0x%04x for device %s\n", dev->type, dev->name); pr_warn("Unknown ARP type 0x%04x for device %s\n", dev->type,
dev->name);
b->htype = dev->type; /* can cause undefined behavior */ b->htype = dev->type; /* can cause undefined behavior */
} }
...@@ -904,14 +895,12 @@ static void __init ic_do_bootp_ext(u8 *ext) ...@@ -904,14 +895,12 @@ static void __init ic_do_bootp_ext(u8 *ext)
int i; int i;
__be16 mtu; __be16 mtu;
#ifdef IPCONFIG_DEBUG
u8 *c; u8 *c;
printk("DHCP/BOOTP: Got extension %d:",*ext); pr_debug("DHCP/BOOTP: Got extension %d:", *ext);
for (c=ext+2; c<ext+2+ext[1]; c++) for (c=ext+2; c<ext+2+ext[1]; c++)
printk(" %02x", *c); pr_debug(" %02x", *c);
printk("\n"); pr_debug("\n");
#endif
switch (*ext++) { switch (*ext++) {
case 1: /* Subnet mask */ case 1: /* Subnet mask */
...@@ -1080,9 +1069,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ...@@ -1080,9 +1069,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
} }
} }
#ifdef IPCONFIG_DEBUG pr_debug("DHCP: Got message type %d\n", mt);
printk("DHCP: Got message type %d\n", mt);
#endif
switch (mt) { switch (mt) {
case DHCPOFFER: case DHCPOFFER:
...@@ -1095,10 +1082,8 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str ...@@ -1095,10 +1082,8 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
/* Let's accept that offer. */ /* Let's accept that offer. */
ic_myaddr = b->your_ip; ic_myaddr = b->your_ip;
ic_servaddr = server_id; ic_servaddr = server_id;
#ifdef IPCONFIG_DEBUG pr_debug("DHCP: Offered address %pI4 by server %pI4\n",
printk("DHCP: Offered address %pI4 by server %pI4\n",
&ic_myaddr, &b->iph.saddr); &ic_myaddr, &b->iph.saddr);
#endif
/* The DHCP indicated server address takes /* The DHCP indicated server address takes
* precedence over the bootp header one if * precedence over the bootp header one if
* they are different. * they are different.
...@@ -1254,13 +1239,13 @@ static int __init ic_dynamic(void) ...@@ -1254,13 +1239,13 @@ static int __init ic_dynamic(void)
(ic_proto_enabled & IC_USE_DHCP) && (ic_proto_enabled & IC_USE_DHCP) &&
ic_dhcp_msgtype != DHCPACK) { ic_dhcp_msgtype != DHCPACK) {
ic_got_reply = 0; ic_got_reply = 0;
pr_cont(","); pr_notice(",");
continue; continue;
} }
#endif /* IPCONFIG_DHCP */ #endif /* IPCONFIG_DHCP */
if (ic_got_reply) { if (ic_got_reply) {
pr_cont(" OK\n"); pr_notice(" OK\n");
break; break;
} }
...@@ -1268,7 +1253,7 @@ static int __init ic_dynamic(void) ...@@ -1268,7 +1253,7 @@ static int __init ic_dynamic(void)
continue; continue;
if (! --retries) { if (! --retries) {
pr_cont(" timed out!\n"); pr_notice(" timed out!\n");
break; break;
} }
...@@ -1278,7 +1263,7 @@ static int __init ic_dynamic(void) ...@@ -1278,7 +1263,7 @@ static int __init ic_dynamic(void)
if (timeout > CONF_TIMEOUT_MAX) if (timeout > CONF_TIMEOUT_MAX)
timeout = CONF_TIMEOUT_MAX; timeout = CONF_TIMEOUT_MAX;
pr_cont("."); pr_notice(".");
} }
#ifdef IPCONFIG_BOOTP #ifdef IPCONFIG_BOOTP
...@@ -1295,11 +1280,11 @@ static int __init ic_dynamic(void) ...@@ -1295,11 +1280,11 @@ static int __init ic_dynamic(void)
return -1; return -1;
} }
printk("IP-Config: Got %s answer from %pI4, ", pr_info("IP-Config: Got %s answer from %pI4, ",
((ic_got_reply & IC_RARP) ? "RARP" ((ic_got_reply & IC_RARP) ? "RARP"
: (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"),
&ic_addrservaddr); &ic_addrservaddr);
pr_cont("my address is %pI4\n", &ic_myaddr); pr_info("my address is %pI4\n", &ic_myaddr);
return 0; return 0;
} }
...@@ -1426,7 +1411,7 @@ static int __init ip_auto_config(void) ...@@ -1426,7 +1411,7 @@ static int __init ip_auto_config(void)
if (!ic_enable) if (!ic_enable)
return 0; return 0;
DBG(("IP-Config: Entered.\n")); pr_debug("IP-Config: Entered.\n");
#ifdef IPCONFIG_DYNAMIC #ifdef IPCONFIG_DYNAMIC
try_try_again: try_try_again:
#endif #endif
...@@ -1548,8 +1533,8 @@ static int __init ip_auto_config(void) ...@@ -1548,8 +1533,8 @@ static int __init ip_auto_config(void)
} }
for (i++; i < CONF_NAMESERVERS_MAX; i++) for (i++; i < CONF_NAMESERVERS_MAX; i++)
if (ic_nameservers[i] != NONE) if (ic_nameservers[i] != NONE)
pr_cont(", nameserver%u=%pI4", i, &ic_nameservers[i]); pr_info(", nameserver%u=%pI4", i, &ic_nameservers[i]);
pr_cont("\n"); pr_info("\n");
#endif /* !SILENT */ #endif /* !SILENT */
return 0; return 0;
...@@ -1585,7 +1570,7 @@ static int __init ic_proto_name(char *name) ...@@ -1585,7 +1570,7 @@ static int __init ic_proto_name(char *name)
return 1; return 1;
*v = 0; *v = 0;
if (kstrtou8(client_id, 0, dhcp_client_identifier)) if (kstrtou8(client_id, 0, dhcp_client_identifier))
DBG("DHCP: Invalid client identifier type\n"); pr_debug("DHCP: Invalid client identifier type\n");
strncpy(dhcp_client_identifier + 1, v + 1, 251); strncpy(dhcp_client_identifier + 1, v + 1, 251);
*v = ','; *v = ',';
} }
...@@ -1644,7 +1629,7 @@ static int __init ip_auto_config_setup(char *addrs) ...@@ -1644,7 +1629,7 @@ static int __init ip_auto_config_setup(char *addrs)
if ((cp = strchr(ip, ':'))) if ((cp = strchr(ip, ':')))
*cp++ = '\0'; *cp++ = '\0';
if (strlen(ip) > 0) { if (strlen(ip) > 0) {
DBG(("IP-Config: Parameter #%d: `%s'\n", num, ip)); pr_debug("IP-Config: Parameter #%d: `%s'\n", num, ip);
switch (num) { switch (num) {
case 0: case 0:
if ((ic_myaddr = in_aton(ip)) == ANY) if ((ic_myaddr = in_aton(ip)) == ANY)
...@@ -1716,7 +1701,7 @@ static int __init vendor_class_identifier_setup(char *addrs) ...@@ -1716,7 +1701,7 @@ static int __init vendor_class_identifier_setup(char *addrs)
if (strlcpy(vendor_class_identifier, addrs, if (strlcpy(vendor_class_identifier, addrs,
sizeof(vendor_class_identifier)) sizeof(vendor_class_identifier))
>= sizeof(vendor_class_identifier)) >= sizeof(vendor_class_identifier))
pr_warn("DHCP: vendorclass too long, truncated to \"%s\"", pr_warn("DHCP: vendorclass too long, truncated to \"%s\"\n",
vendor_class_identifier); vendor_class_identifier);
return 1; return 1;
} }
......
...@@ -38,13 +38,13 @@ MODULE_DESCRIPTION("arptables core"); ...@@ -38,13 +38,13 @@ MODULE_DESCRIPTION("arptables core");
/*#define DEBUG_ARP_TABLES_USER*/ /*#define DEBUG_ARP_TABLES_USER*/
#ifdef DEBUG_ARP_TABLES #ifdef DEBUG_ARP_TABLES
#define dprintf(format, args...) printk(format , ## args) #define dprintf(format, args...) pr_debug(format, ## args)
#else #else
#define dprintf(format, args...) #define dprintf(format, args...)
#endif #endif
#ifdef DEBUG_ARP_TABLES_USER #ifdef DEBUG_ARP_TABLES_USER
#define duprintf(format, args...) printk(format , ## args) #define duprintf(format, args...) pr_debug(format, ## args)
#else #else
#define duprintf(format, args...) #define duprintf(format, args...)
#endif #endif
...@@ -1905,7 +1905,7 @@ static int __init arp_tables_init(void) ...@@ -1905,7 +1905,7 @@ static int __init arp_tables_init(void)
if (ret < 0) if (ret < 0)
goto err4; goto err4;
printk(KERN_INFO "arp_tables: (C) 2002 David S. Miller\n"); pr_info("arp_tables: (C) 2002 David S. Miller\n");
return 0; return 0;
err4: err4:
......
...@@ -451,7 +451,7 @@ static int __init nf_conntrack_l3proto_ipv4_init(void) ...@@ -451,7 +451,7 @@ static int __init nf_conntrack_l3proto_ipv4_init(void)
ret = nf_register_sockopt(&so_getorigdst); ret = nf_register_sockopt(&so_getorigdst);
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "Unable to register netfilter socket option\n"); pr_err("Unable to register netfilter socket option\n");
return ret; return ret;
} }
......
...@@ -1048,7 +1048,7 @@ static int snmp_parse_mangle(unsigned char *msg, ...@@ -1048,7 +1048,7 @@ static int snmp_parse_mangle(unsigned char *msg,
if (!asn1_uint_decode (&ctx, end, &vers)) if (!asn1_uint_decode (&ctx, end, &vers))
return 0; return 0;
if (debug > 1) if (debug > 1)
printk(KERN_DEBUG "bsalg: snmp version: %u\n", vers + 1); pr_debug("bsalg: snmp version: %u\n", vers + 1);
if (vers > 1) if (vers > 1)
return 1; return 1;
...@@ -1064,10 +1064,10 @@ static int snmp_parse_mangle(unsigned char *msg, ...@@ -1064,10 +1064,10 @@ static int snmp_parse_mangle(unsigned char *msg,
if (debug > 1) { if (debug > 1) {
unsigned int i; unsigned int i;
printk(KERN_DEBUG "bsalg: community: "); pr_debug("bsalg: community: ");
for (i = 0; i < comm.len; i++) for (i = 0; i < comm.len; i++)
printk("%c", comm.data[i]); pr_cont("%c", comm.data[i]);
printk("\n"); pr_cont("\n");
} }
kfree(comm.data); kfree(comm.data);
...@@ -1091,9 +1091,9 @@ static int snmp_parse_mangle(unsigned char *msg, ...@@ -1091,9 +1091,9 @@ static int snmp_parse_mangle(unsigned char *msg,
}; };
if (pdutype > SNMP_PDU_TRAP2) if (pdutype > SNMP_PDU_TRAP2)
printk(KERN_DEBUG "bsalg: bad pdu type %u\n", pdutype); pr_debug("bsalg: bad pdu type %u\n", pdutype);
else else
printk(KERN_DEBUG "bsalg: pdu: %s\n", pdus[pdutype]); pr_debug("bsalg: pdu: %s\n", pdus[pdutype]);
} }
if (pdutype != SNMP_PDU_RESPONSE && if (pdutype != SNMP_PDU_RESPONSE &&
pdutype != SNMP_PDU_TRAP1 && pdutype != SNMP_PDU_TRAP2) pdutype != SNMP_PDU_TRAP1 && pdutype != SNMP_PDU_TRAP2)
...@@ -1119,7 +1119,7 @@ static int snmp_parse_mangle(unsigned char *msg, ...@@ -1119,7 +1119,7 @@ static int snmp_parse_mangle(unsigned char *msg,
return 0; return 0;
if (debug > 1) if (debug > 1)
printk(KERN_DEBUG "bsalg: request: id=0x%lx error_status=%u " pr_debug("bsalg: request: id=0x%lx error_status=%u "
"error_index=%u\n", req.id, req.error_status, "error_index=%u\n", req.id, req.error_status,
req.error_index); req.error_index);
} }
...@@ -1145,13 +1145,13 @@ static int snmp_parse_mangle(unsigned char *msg, ...@@ -1145,13 +1145,13 @@ static int snmp_parse_mangle(unsigned char *msg,
} }
if (debug > 1) { if (debug > 1) {
printk(KERN_DEBUG "bsalg: object: "); pr_debug("bsalg: object: ");
for (i = 0; i < obj->id_len; i++) { for (i = 0; i < obj->id_len; i++) {
if (i > 0) if (i > 0)
printk("."); pr_cont(".");
printk("%lu", obj->id[i]); pr_cont("%lu", obj->id[i]);
} }
printk(": type=%u\n", obj->type); pr_cont(": type=%u\n", obj->type);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment