aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netconsole.c
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2013-01-07 15:52:39 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-08 20:56:09 -0500
commitb7394d2429c198b1da3d46ac39192e891029ec0f (patch)
treeb051c22f9ea4451604ec40786e9a377e58c830ea /drivers/net/netconsole.c
parent0c7768a0985f281e71c0229c0531ccfc0d3dd1f9 (diff)
netpoll: prepare for ipv6
This patch adjusts some struct and functions, to prepare for supporting IPv6. Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netconsole.c')
-rw-r--r--drivers/net/netconsole.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 6989ebe2bc79..998fa0257a92 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -269,12 +269,14 @@ 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, "%pI4\n", &nt->np.local_ip);
273} 274}
274 275
275static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf) 276static ssize_t show_remote_ip(struct netconsole_target *nt, char *buf)
276{ 277{
277 return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip); 278 if (!nt->np.ipv6)
279 return snprintf(buf, PAGE_SIZE, "%pI4\n", &nt->np.remote_ip);
278} 280}
279 281
280static ssize_t show_local_mac(struct netconsole_target *nt, char *buf) 282static ssize_t show_local_mac(struct netconsole_target *nt, char *buf)
@@ -410,7 +412,8 @@ static ssize_t store_local_ip(struct netconsole_target *nt,
410 return -EINVAL; 412 return -EINVAL;
411 } 413 }
412 414
413 nt->np.local_ip = in_aton(buf); 415 if (!strnchr(buf, count, ':'))
416 nt->np.local_ip.ip = in_aton(buf);
414 417
415 return strnlen(buf, count); 418 return strnlen(buf, count);
416} 419}
@@ -426,7 +429,8 @@ static ssize_t store_remote_ip(struct netconsole_target *nt,
426 return -EINVAL; 429 return -EINVAL;
427 } 430 }
428 431
429 nt->np.remote_ip = in_aton(buf); 432 if (!strnchr(buf, count, ':'))
433 nt->np.remote_ip.ip = in_aton(buf);
430 434
431 return strnlen(buf, count); 435 return strnlen(buf, count);
432} 436}