aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipconfig.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-03-11 14:36:11 -0400
committerDavid S. Miller <davem@davemloft.net>2012-03-12 02:42:51 -0400
commit058bd4d2a4ff0aaa4a5381c67e776729d840c785 (patch)
tree4d1ea864a8740676c7e7c5a03cdaa67fc5f29418 /net/ipv4/ipconfig.c
parent43db362d3adda9e0a915ddb9a8d1a41186e19179 (diff)
net: Convert printks to pr_<level>
Use a more current kernel messaging style. Convert a printk block to print_hex_dump. Coalesce formats, align arguments. Use %s, __func__ instead of embedding function names. Some messages that were prefixed with <foo>_close are now prefixed with <foo>_fini. Some ah4 and esp messages are now not prefixed with "ip ". The intent of this patch is to later add something like #define pr_fmt(fmt) "IPv4: " fmt. to standardize the output messages. Text size is trivially reduced. (x86-32 allyesconfig) $ size net/ipv4/built-in.o* text data bss dec hex filename 887888 31558 249696 1169142 11d6f6 net/ipv4/built-in.o.new 887934 31558 249800 1169292 11d78c net/ipv4/built-in.o.old Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ipconfig.c')
-rw-r--r--net/ipv4/ipconfig.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 6e412a60a91f..92ac7e7363a0 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -214,7 +214,7 @@ static int __init ic_open_devs(void)
214 if (!(dev->flags & IFF_LOOPBACK)) 214 if (!(dev->flags & IFF_LOOPBACK))
215 continue; 215 continue;
216 if (dev_change_flags(dev, dev->flags | IFF_UP) < 0) 216 if (dev_change_flags(dev, dev->flags | IFF_UP) < 0)
217 printk(KERN_ERR "IP-Config: Failed to open %s\n", dev->name); 217 pr_err("IP-Config: Failed to open %s\n", dev->name);
218 } 218 }
219 219
220 for_each_netdev(&init_net, dev) { 220 for_each_netdev(&init_net, dev) {
@@ -223,7 +223,8 @@ static int __init ic_open_devs(void)
223 if (dev->mtu >= 364) 223 if (dev->mtu >= 364)
224 able |= IC_BOOTP; 224 able |= IC_BOOTP;
225 else 225 else
226 printk(KERN_WARNING "DHCP/BOOTP: Ignoring device %s, MTU %d too small", dev->name, dev->mtu); 226 pr_warn("DHCP/BOOTP: Ignoring device %s, MTU %d too small",
227 dev->name, dev->mtu);
227 if (!(dev->flags & IFF_NOARP)) 228 if (!(dev->flags & IFF_NOARP))
228 able |= IC_RARP; 229 able |= IC_RARP;
229 able &= ic_proto_enabled; 230 able &= ic_proto_enabled;
@@ -231,7 +232,8 @@ static int __init ic_open_devs(void)
231 continue; 232 continue;
232 oflags = dev->flags; 233 oflags = dev->flags;
233 if (dev_change_flags(dev, oflags | IFF_UP) < 0) { 234 if (dev_change_flags(dev, oflags | IFF_UP) < 0) {
234 printk(KERN_ERR "IP-Config: Failed to open %s\n", dev->name); 235 pr_err("IP-Config: Failed to open %s\n",
236 dev->name);
235 continue; 237 continue;
236 } 238 }
237 if (!(d = kmalloc(sizeof(struct ic_device), GFP_KERNEL))) { 239 if (!(d = kmalloc(sizeof(struct ic_device), GFP_KERNEL))) {
@@ -273,9 +275,10 @@ have_carrier:
273 275
274 if (!ic_first_dev) { 276 if (!ic_first_dev) {
275 if (user_dev_name[0]) 277 if (user_dev_name[0])
276 printk(KERN_ERR "IP-Config: Device `%s' not found.\n", user_dev_name); 278 pr_err("IP-Config: Device `%s' not found\n",
279 user_dev_name);
277 else 280 else
278 printk(KERN_ERR "IP-Config: No network devices available.\n"); 281 pr_err("IP-Config: No network devices available\n");
279 return -ENODEV; 282 return -ENODEV;
280 } 283 }
281 return 0; 284 return 0;
@@ -359,17 +362,20 @@ static int __init ic_setup_if(void)
359 strcpy(ir.ifr_ifrn.ifrn_name, ic_dev->name); 362 strcpy(ir.ifr_ifrn.ifrn_name, ic_dev->name);
360 set_sockaddr(sin, ic_myaddr, 0); 363 set_sockaddr(sin, ic_myaddr, 0);
361 if ((err = ic_devinet_ioctl(SIOCSIFADDR, &ir)) < 0) { 364 if ((err = ic_devinet_ioctl(SIOCSIFADDR, &ir)) < 0) {
362 printk(KERN_ERR "IP-Config: Unable to set interface address (%d).\n", err); 365 pr_err("IP-Config: Unable to set interface address (%d)\n",
366 err);
363 return -1; 367 return -1;
364 } 368 }
365 set_sockaddr(sin, ic_netmask, 0); 369 set_sockaddr(sin, ic_netmask, 0);
366 if ((err = ic_devinet_ioctl(SIOCSIFNETMASK, &ir)) < 0) { 370 if ((err = ic_devinet_ioctl(SIOCSIFNETMASK, &ir)) < 0) {
367 printk(KERN_ERR "IP-Config: Unable to set interface netmask (%d).\n", err); 371 pr_err("IP-Config: Unable to set interface netmask (%d)\n",
372 err);
368 return -1; 373 return -1;
369 } 374 }
370 set_sockaddr(sin, ic_myaddr | ~ic_netmask, 0); 375 set_sockaddr(sin, ic_myaddr | ~ic_netmask, 0);
371 if ((err = ic_devinet_ioctl(SIOCSIFBRDADDR, &ir)) < 0) { 376 if ((err = ic_devinet_ioctl(SIOCSIFBRDADDR, &ir)) < 0) {
372 printk(KERN_ERR "IP-Config: Unable to set interface broadcast address (%d).\n", err); 377 pr_err("IP-Config: Unable to set interface broadcast address (%d)\n",
378 err);
373 return -1; 379 return -1;
374 } 380 }
375 /* Handle the case where we need non-standard MTU on the boot link (a network 381 /* Handle the case where we need non-standard MTU on the boot link (a network
@@ -380,8 +386,8 @@ static int __init ic_setup_if(void)
380 strcpy(ir.ifr_name, ic_dev->name); 386 strcpy(ir.ifr_name, ic_dev->name);
381 ir.ifr_mtu = ic_dev_mtu; 387 ir.ifr_mtu = ic_dev_mtu;
382 if ((err = ic_dev_ioctl(SIOCSIFMTU, &ir)) < 0) 388 if ((err = ic_dev_ioctl(SIOCSIFMTU, &ir)) < 0)
383 printk(KERN_ERR "IP-Config: Unable to set interface mtu to %d (%d).\n", 389 pr_err("IP-Config: Unable to set interface mtu to %d (%d)\n",
384 ic_dev_mtu, err); 390 ic_dev_mtu, err);
385 } 391 }
386 return 0; 392 return 0;
387} 393}
@@ -396,7 +402,7 @@ static int __init ic_setup_routes(void)
396 402
397 memset(&rm, 0, sizeof(rm)); 403 memset(&rm, 0, sizeof(rm));
398 if ((ic_gateway ^ ic_myaddr) & ic_netmask) { 404 if ((ic_gateway ^ ic_myaddr) & ic_netmask) {
399 printk(KERN_ERR "IP-Config: Gateway not on directly connected network.\n"); 405 pr_err("IP-Config: Gateway not on directly connected network\n");
400 return -1; 406 return -1;
401 } 407 }
402 set_sockaddr((struct sockaddr_in *) &rm.rt_dst, 0, 0); 408 set_sockaddr((struct sockaddr_in *) &rm.rt_dst, 0, 0);
@@ -404,7 +410,8 @@ static int __init ic_setup_routes(void)
404 set_sockaddr((struct sockaddr_in *) &rm.rt_gateway, ic_gateway, 0); 410 set_sockaddr((struct sockaddr_in *) &rm.rt_gateway, ic_gateway, 0);
405 rm.rt_flags = RTF_UP | RTF_GATEWAY; 411 rm.rt_flags = RTF_UP | RTF_GATEWAY;
406 if ((err = ic_route_ioctl(SIOCADDRT, &rm)) < 0) { 412 if ((err = ic_route_ioctl(SIOCADDRT, &rm)) < 0) {
407 printk(KERN_ERR "IP-Config: Cannot add default route (%d).\n", err); 413 pr_err("IP-Config: Cannot add default route (%d)\n",
414 err);
408 return -1; 415 return -1;
409 } 416 }
410 } 417 }
@@ -437,8 +444,8 @@ static int __init ic_defaults(void)
437 else if (IN_CLASSC(ntohl(ic_myaddr))) 444 else if (IN_CLASSC(ntohl(ic_myaddr)))
438 ic_netmask = htonl(IN_CLASSC_NET); 445 ic_netmask = htonl(IN_CLASSC_NET);
439 else { 446 else {
440 printk(KERN_ERR "IP-Config: Unable to guess netmask for address %pI4\n", 447 pr_err("IP-Config: Unable to guess netmask for address %pI4\n",
441 &ic_myaddr); 448 &ic_myaddr);
442 return -1; 449 return -1;
443 } 450 }
444 printk("IP-Config: Guessing netmask %pI4\n", &ic_netmask); 451 printk("IP-Config: Guessing netmask %pI4\n", &ic_netmask);
@@ -688,8 +695,8 @@ ic_dhcp_init_options(u8 *options)
688 e += len; 695 e += len;
689 } 696 }
690 if (*vendor_class_identifier) { 697 if (*vendor_class_identifier) {
691 printk(KERN_INFO "DHCP: sending class identifier \"%s\"\n", 698 pr_info("DHCP: sending class identifier \"%s\"\n",
692 vendor_class_identifier); 699 vendor_class_identifier);
693 *e++ = 60; /* Class-identifier */ 700 *e++ = 60; /* Class-identifier */
694 len = strlen(vendor_class_identifier); 701 len = strlen(vendor_class_identifier);
695 *e++ = len; 702 *e++ = len;
@@ -949,8 +956,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
949 /* Fragments are not supported */ 956 /* Fragments are not supported */
950 if (ip_is_fragment(h)) { 957 if (ip_is_fragment(h)) {
951 if (net_ratelimit()) 958 if (net_ratelimit())
952 printk(KERN_ERR "DHCP/BOOTP: Ignoring fragmented " 959 pr_err("DHCP/BOOTP: Ignoring fragmented reply\n");
953 "reply.\n");
954 goto drop; 960 goto drop;
955 } 961 }
956 962
@@ -999,8 +1005,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
999 if (b->op != BOOTP_REPLY || 1005 if (b->op != BOOTP_REPLY ||
1000 b->xid != d->xid) { 1006 b->xid != d->xid) {
1001 if (net_ratelimit()) 1007 if (net_ratelimit())
1002 printk(KERN_ERR "DHCP/BOOTP: Reply not for us, " 1008 pr_err("DHCP/BOOTP: Reply not for us, op[%x] xid[%x]\n",
1003 "op[%x] xid[%x]\n",
1004 b->op, b->xid); 1009 b->op, b->xid);
1005 goto drop_unlock; 1010 goto drop_unlock;
1006 } 1011 }
@@ -1008,7 +1013,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
1008 /* Is it a reply for the device we are configuring? */ 1013 /* Is it a reply for the device we are configuring? */
1009 if (b->xid != ic_dev_xid) { 1014 if (b->xid != ic_dev_xid) {
1010 if (net_ratelimit()) 1015 if (net_ratelimit())
1011 printk(KERN_ERR "DHCP/BOOTP: Ignoring delayed packet\n"); 1016 pr_err("DHCP/BOOTP: Ignoring delayed packet\n");
1012 goto drop_unlock; 1017 goto drop_unlock;
1013 } 1018 }
1014 1019
@@ -1146,17 +1151,17 @@ static int __init ic_dynamic(void)
1146 * are missing, and without DHCP/BOOTP/RARP we are unable to get it. 1151 * are missing, and without DHCP/BOOTP/RARP we are unable to get it.
1147 */ 1152 */
1148 if (!ic_proto_enabled) { 1153 if (!ic_proto_enabled) {
1149 printk(KERN_ERR "IP-Config: Incomplete network configuration information.\n"); 1154 pr_err("IP-Config: Incomplete network configuration information\n");
1150 return -1; 1155 return -1;
1151 } 1156 }
1152 1157
1153#ifdef IPCONFIG_BOOTP 1158#ifdef IPCONFIG_BOOTP
1154 if ((ic_proto_enabled ^ ic_proto_have_if) & IC_BOOTP) 1159 if ((ic_proto_enabled ^ ic_proto_have_if) & IC_BOOTP)
1155 printk(KERN_ERR "DHCP/BOOTP: No suitable device found.\n"); 1160 pr_err("DHCP/BOOTP: No suitable device found\n");
1156#endif 1161#endif
1157#ifdef IPCONFIG_RARP 1162#ifdef IPCONFIG_RARP
1158 if ((ic_proto_enabled ^ ic_proto_have_if) & IC_RARP) 1163 if ((ic_proto_enabled ^ ic_proto_have_if) & IC_RARP)
1159 printk(KERN_ERR "RARP: No suitable device found.\n"); 1164 pr_err("RARP: No suitable device found\n");
1160#endif 1165#endif
1161 1166
1162 if (!ic_proto_have_if) 1167 if (!ic_proto_have_if)
@@ -1183,11 +1188,11 @@ static int __init ic_dynamic(void)
1183 * [Actually we could now, but the nothing else running note still 1188 * [Actually we could now, but the nothing else running note still
1184 * applies.. - AC] 1189 * applies.. - AC]
1185 */ 1190 */
1186 printk(KERN_NOTICE "Sending %s%s%s requests .", 1191 pr_notice("Sending %s%s%s requests .",
1187 do_bootp 1192 do_bootp
1188 ? ((ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP") : "", 1193 ? ((ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP") : "",
1189 (do_bootp && do_rarp) ? " and " : "", 1194 (do_bootp && do_rarp) ? " and " : "",
1190 do_rarp ? "RARP" : ""); 1195 do_rarp ? "RARP" : "");
1191 1196
1192 start_jiffies = jiffies; 1197 start_jiffies = jiffies;
1193 d = ic_first_dev; 1198 d = ic_first_dev;
@@ -1216,13 +1221,13 @@ static int __init ic_dynamic(void)
1216 (ic_proto_enabled & IC_USE_DHCP) && 1221 (ic_proto_enabled & IC_USE_DHCP) &&
1217 ic_dhcp_msgtype != DHCPACK) { 1222 ic_dhcp_msgtype != DHCPACK) {
1218 ic_got_reply = 0; 1223 ic_got_reply = 0;
1219 printk(KERN_CONT ","); 1224 pr_cont(",");
1220 continue; 1225 continue;
1221 } 1226 }
1222#endif /* IPCONFIG_DHCP */ 1227#endif /* IPCONFIG_DHCP */
1223 1228
1224 if (ic_got_reply) { 1229 if (ic_got_reply) {
1225 printk(KERN_CONT " OK\n"); 1230 pr_cont(" OK\n");
1226 break; 1231 break;
1227 } 1232 }
1228 1233
@@ -1230,7 +1235,7 @@ static int __init ic_dynamic(void)
1230 continue; 1235 continue;
1231 1236
1232 if (! --retries) { 1237 if (! --retries) {
1233 printk(KERN_CONT " timed out!\n"); 1238 pr_cont(" timed out!\n");
1234 break; 1239 break;
1235 } 1240 }
1236 1241
@@ -1240,7 +1245,7 @@ static int __init ic_dynamic(void)
1240 if (timeout > CONF_TIMEOUT_MAX) 1245 if (timeout > CONF_TIMEOUT_MAX)
1241 timeout = CONF_TIMEOUT_MAX; 1246 timeout = CONF_TIMEOUT_MAX;
1242 1247
1243 printk(KERN_CONT "."); 1248 pr_cont(".");
1244 } 1249 }
1245 1250
1246#ifdef IPCONFIG_BOOTP 1251#ifdef IPCONFIG_BOOTP
@@ -1260,8 +1265,8 @@ static int __init ic_dynamic(void)
1260 printk("IP-Config: Got %s answer from %pI4, ", 1265 printk("IP-Config: Got %s answer from %pI4, ",
1261 ((ic_got_reply & IC_RARP) ? "RARP" 1266 ((ic_got_reply & IC_RARP) ? "RARP"
1262 : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"), 1267 : (ic_proto_enabled & IC_USE_DHCP) ? "DHCP" : "BOOTP"),
1263 &ic_servaddr); 1268 &ic_servaddr);
1264 printk(KERN_CONT "my address is %pI4\n", &ic_myaddr); 1269 pr_cont("my address is %pI4\n", &ic_myaddr);
1265 1270
1266 return 0; 1271 return 0;
1267} 1272}
@@ -1437,24 +1442,22 @@ static int __init ip_auto_config(void)
1437 */ 1442 */
1438#ifdef CONFIG_ROOT_NFS 1443#ifdef CONFIG_ROOT_NFS
1439 if (ROOT_DEV == Root_NFS) { 1444 if (ROOT_DEV == Root_NFS) {
1440 printk(KERN_ERR 1445 pr_err("IP-Config: Retrying forever (NFS root)...\n");
1441 "IP-Config: Retrying forever (NFS root)...\n");
1442 goto try_try_again; 1446 goto try_try_again;
1443 } 1447 }
1444#endif 1448#endif
1445 1449
1446 if (--retries) { 1450 if (--retries) {
1447 printk(KERN_ERR 1451 pr_err("IP-Config: Reopening network devices...\n");
1448 "IP-Config: Reopening network devices...\n");
1449 goto try_try_again; 1452 goto try_try_again;
1450 } 1453 }
1451 1454
1452 /* Oh, well. At least we tried. */ 1455 /* Oh, well. At least we tried. */
1453 printk(KERN_ERR "IP-Config: Auto-configuration of network failed.\n"); 1456 pr_err("IP-Config: Auto-configuration of network failed\n");
1454 return -1; 1457 return -1;
1455 } 1458 }
1456#else /* !DYNAMIC */ 1459#else /* !DYNAMIC */
1457 printk(KERN_ERR "IP-Config: Incomplete network configuration information.\n"); 1460 pr_err("IP-Config: Incomplete network configuration information\n");
1458 ic_close_devs(); 1461 ic_close_devs();
1459 return -1; 1462 return -1;
1460#endif /* IPCONFIG_DYNAMIC */ 1463#endif /* IPCONFIG_DYNAMIC */
@@ -1492,19 +1495,16 @@ static int __init ip_auto_config(void)
1492 /* 1495 /*
1493 * Clue in the operator. 1496 * Clue in the operator.
1494 */ 1497 */
1495 printk("IP-Config: Complete:\n"); 1498 pr_info("IP-Config: Complete:\n");
1496 printk(" device=%s", ic_dev->name); 1499 pr_info(" device=%s, addr=%pI4, mask=%pI4, gw=%pI4\n",
1497 printk(KERN_CONT ", addr=%pI4", &ic_myaddr); 1500 ic_dev->name, &ic_myaddr, &ic_netmask, &ic_gateway);
1498 printk(KERN_CONT ", mask=%pI4", &ic_netmask); 1501 pr_info(" host=%s, domain=%s, nis-domain=%s\n",
1499 printk(KERN_CONT ", gw=%pI4", &ic_gateway); 1502 utsname()->nodename, ic_domain, utsname()->domainname);
1500 printk(KERN_CONT ",\n host=%s, domain=%s, nis-domain=%s", 1503 pr_info(" bootserver=%pI4, rootserver=%pI4, rootpath=%s",
1501 utsname()->nodename, ic_domain, utsname()->domainname); 1504 &ic_servaddr, &root_server_addr, root_server_path);
1502 printk(KERN_CONT ",\n bootserver=%pI4", &ic_servaddr);
1503 printk(KERN_CONT ", rootserver=%pI4", &root_server_addr);
1504 printk(KERN_CONT ", rootpath=%s", root_server_path);
1505 if (ic_dev_mtu) 1505 if (ic_dev_mtu)
1506 printk(KERN_CONT ", mtu=%d", ic_dev_mtu); 1506 pr_cont(", mtu=%d", ic_dev_mtu);
1507 printk(KERN_CONT "\n"); 1507 pr_cont("\n");
1508#endif /* !SILENT */ 1508#endif /* !SILENT */
1509 1509
1510 return 0; 1510 return 0;
@@ -1637,8 +1637,8 @@ static int __init vendor_class_identifier_setup(char *addrs)
1637 if (strlcpy(vendor_class_identifier, addrs, 1637 if (strlcpy(vendor_class_identifier, addrs,
1638 sizeof(vendor_class_identifier)) 1638 sizeof(vendor_class_identifier))
1639 >= sizeof(vendor_class_identifier)) 1639 >= sizeof(vendor_class_identifier))
1640 printk(KERN_WARNING "DHCP: vendorclass too long, truncated to \"%s\"", 1640 pr_warn("DHCP: vendorclass too long, truncated to \"%s\"",
1641 vendor_class_identifier); 1641 vendor_class_identifier);
1642 return 1; 1642 return 1;
1643} 1643}
1644 1644