aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netconsole.c
diff options
context:
space:
mode:
authorJon Hunter <jon-hunter@ti.com>2013-04-01 15:33:50 -0400
committerJon Hunter <jon-hunter@ti.com>2013-04-01 15:33:50 -0400
commitdca3a783400a18e2bf4503b1d4a85c4d0ca1a7e4 (patch)
treea3689b801070c1360b120b7280c6adc4de5f692a /drivers/net/netconsole.c
parent71856843fb1d8ee455a4c1a60696c74afa4809e5 (diff)
parent31d9adca82ce65e5c99d045b5fd917c702b6fce3 (diff)
Merge commit '31d9adca82ce65e5c99d045b5fd917c702b6fce3' into tmp
Conflicts: arch/arm/plat-omap/dmtimer.c
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r--drivers/net/netconsole.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 6989ebe2bc79..37add21a3d7d 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -269,12 +269,18 @@ static ssize_t show_remote_port(struct netconsole_target *nt, char *buf)
269 269
270static ssize_t show_local_ip(struct netconsole_target *nt, char *buf) 270static ssize_t show_local_ip(struct netconsole_target *nt, char *buf)
271{ 271{
272 return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.local_ip); 272 if (nt->np.ipv6)
273 return snprintf(buf, PAGE_SIZE, "%pI6c\n", &nt->np.local_ip.in6);
274 else
275 return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.local_ip);
273} 276}
274 277
275static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf) 278static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf)
276{ 279{
277 return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip); 280 if (nt->np.ipv6)
281 return snprintf(buf, PAGE_SIZE, "%pI6c\n", &nt->np.remote_ip.in6);
282 else
283 return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip);
278} 284}
279 285
280static ssize_t show_local_mac(struct netconsole_target *nt, char *buf) 286static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
@@ -410,7 +416,22 @@ static ssize_t store_local_ip(struct netconsole_target *nt,
410 return -EINVAL; 416 return -EINVAL;
411 } 417 }
412 418
413 nt->np.local_ip = in_aton(buf); 419 if (strnchr(buf, count, ':')) {
420 const char *end;
421 if (in6_pton(buf, count, nt->np.local_ip.in6.s6_addr, -1, &end) > 0) {
422 if (*end && *end != '\n') {
423 printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end);
424 return -EINVAL;
425 }
426 nt->np.ipv6 = true;
427 } else
428 return -EINVAL;
429 } else {
430 if (!nt->np.ipv6) {
431 nt->np.local_ip.ip = in_aton(buf);
432 } else
433 return -EINVAL;
434 }
414 435
415 return strnlen(buf, count); 436 return strnlen(buf, count);
416} 437}
@@ -426,7 +447,22 @@ static ssize_t store_remote_ip(struct netconsole_target *nt,
426 return -EINVAL; 447 return -EINVAL;
427 } 448 }
428 449
429 nt->np.remote_ip = in_aton(buf); 450 if (strnchr(buf, count, ':')) {
451 const char *end;
452 if (in6_pton(buf, count, nt->np.remote_ip.in6.s6_addr, -1, &end) > 0) {
453 if (*end && *end != '\n') {
454 printk(KERN_ERR "netconsole: invalid IPv6 address at: <%c>\n", *end);
455 return -EINVAL;
456 }
457 nt->np.ipv6 = true;
458 } else
459 return -EINVAL;
460 } else {
461 if (!nt->np.ipv6) {
462 nt->np.remote_ip.ip = in_aton(buf);
463 } else
464 return -EINVAL;
465 }
430 466
431 return strnlen(buf, count); 467 return strnlen(buf, count);
432} 468}