aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clients/net-snk/app/netapps/netboot.c22
-rw-r--r--clients/net-snk/app/netlib/bootp.c5
2 files changed, 14 insertions, 13 deletions
diff --git a/clients/net-snk/app/netapps/netboot.c b/clients/net-snk/app/netapps/netboot.c
index cf20b59..5b7cefa 100644
--- a/clients/net-snk/app/netapps/netboot.c
+++ b/clients/net-snk/app/netapps/netboot.c
@@ -332,7 +332,8 @@ int dhcp(char *ret_buffer, filename_ip_t * fn_ip, unsigned int retries, int flag
int i = (int) retries+1;
int rc = -1;
- printf(" ");
+ printf(" Requesting information via DHCP%s: ",
+ flags == F_IPV4 ? "v4" : flags == F_IPV6 ? "v6" : "");
do {
printf("\b\b\b%03d", i-1);
@@ -353,7 +354,6 @@ int dhcp(char *ret_buffer, filename_ip_t * fn_ip, unsigned int retries, int flag
set_ipv6_address(fn_ip->fd, 0);
rc = dhcpv6(ret_buffer, fn_ip);
if (rc == 0) {
- printf("\n");
memcpy(&fn_ip->own_ip6, get_ipv6_address(), 16);
break;
}
@@ -362,7 +362,7 @@ int dhcp(char *ret_buffer, filename_ip_t * fn_ip, unsigned int retries, int flag
if (rc != -1) /* either success or non-dhcp failure */
break;
} while (1);
- printf("\b\b\b\b");
+ printf("\b\b\b\bdone\n");
return rc;
}
@@ -388,8 +388,7 @@ netboot(int argc, char *argv[])
int32_t block_size = strtol(argv[5], 0, 10);
uint8_t own_mac[6];
- printf("\n");
- printf(" Bootloader 1.6 \n");
+ puts("\n Initializing NIC");
memset(&fn_ip, 0, sizeof(filename_ip_t));
/***********************************************************
@@ -484,7 +483,6 @@ netboot(int argc, char *argv[])
// construction of fn_ip from parameter
switch(obp_tftp_args.ip_init) {
case IP_INIT_BOOTP:
- printf(" Requesting IP address via BOOTP: ");
// if giaddr in not specified, then we have to identify
// the BOOTP server via broadcasts
if(memcmp(obp_tftp_args.giaddr, null_ip, 4) == 0) {
@@ -499,11 +497,9 @@ netboot(int argc, char *argv[])
rc = bootp(ret_buffer, &fn_ip, obp_tftp_args.bootp_retries);
break;
case IP_INIT_DHCP:
- printf(" Requesting IP address via DHCPv4: ");
rc = dhcp(ret_buffer, &fn_ip, obp_tftp_args.bootp_retries, F_IPV4);
break;
case IP_INIT_DHCPV6_STATELESS:
- printf(" Requesting information via DHCPv6: ");
rc = dhcp(ret_buffer, &fn_ip,
obp_tftp_args.bootp_retries, F_IPV6);
break;
@@ -511,7 +507,6 @@ netboot(int argc, char *argv[])
set_ipv6_address(fn_ip.fd, &obp_tftp_args.ci6addr);
break;
case IP_INIT_DEFAULT:
- printf(" Requesting IP address via DHCP: ");
rc = dhcp(ret_buffer, &fn_ip, obp_tftp_args.bootp_retries, 0);
break;
case IP_INIT_NONE:
@@ -548,10 +543,15 @@ netboot(int argc, char *argv[])
return -101;
}
- if(ip_version == 4)
- printf("%d.%d.%d.%d\n",
+ if (ip_version == 4) {
+ printf(" Using IPv4 address: %d.%d.%d.%d\n",
((fn_ip.own_ip >> 24) & 0xFF), ((fn_ip.own_ip >> 16) & 0xFF),
((fn_ip.own_ip >> 8) & 0xFF), ( fn_ip.own_ip & 0xFF));
+ } else if (ip_version == 6) {
+ char ip6_str[40];
+ ipv6_to_str(fn_ip.own_ip6.addr, ip6_str);
+ printf(" Using IPv6 address: %s\n", ip6_str);
+ }
if (rc == -2) {
sprintf(buf,
diff --git a/clients/net-snk/app/netlib/bootp.c b/clients/net-snk/app/netlib/bootp.c
index 1bc6efe..6d58cef 100644
--- a/clients/net-snk/app/netlib/bootp.c
+++ b/clients/net-snk/app/netlib/bootp.c
@@ -232,7 +232,7 @@ bootp(char *ret_buffer, filename_ip_t * fn_ip, unsigned int retries)
int i = (int) retries+1;
fn_ip->own_ip = 0;
- printf(" ");
+ printf(" Requesting IP address via BOOTP: ");
response_buffer = ret_buffer;
@@ -249,6 +249,7 @@ bootp(char *ret_buffer, filename_ip_t * fn_ip, unsigned int retries)
* in case the previous one was lost. And because we don't
* trust the network cable we keep on doing this 30 times */
} while (receive_bootp(fn_ip) != 0);
- printf("\b\b\b");
+
+ printf("\b\b\bdone\n");
return 0;
}