Index: common/cmd_net.c =================================================================== RCS file: /home/cvsroot/Projects/u-boot/common/cmd_net.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -p -u -r1.1.1.1 -r1.2 --- common/cmd_net.c 28 Jun 2005 17:32:26 -0000 1.1.1.1 +++ common/cmd_net.c 24 Oct 2005 17:21:39 -0000 1.2 @@ -151,6 +151,17 @@ static void netboot_update_env (void) #endif } +static int +net_check_device(void) +{ + if(eth_get_dev() == NULL) { + printf("No network device available.\n"); + return -1; + } else { + return 0; + } +} + static int netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[]) { @@ -158,6 +169,9 @@ netboot_common (proto_t proto, cmd_tbl_t int rcode = 0; int size; + if (net_check_device() < 0) + return -1; + /* pre-set load_addr */ if ((s = getenv("loadaddr")) != NULL) { load_addr = simple_strtoul(s, NULL, 16); @@ -226,6 +240,9 @@ int do_ping (cmd_tbl_t *cmdtp, int flag, if (argc < 2) return -1; + if(net_check_device() < 0) + return -1; + NetPingIP = string_to_ip(argv[1]); if (NetPingIP == 0) { printf ("Usage:\n%s\n", cmdtp->usage); @@ -275,6 +292,9 @@ int do_cdp (cmd_tbl_t *cmdtp, int flag, { int r; + if(net_check_device() < 0) + return -1; + r = NetLoop(CDP); if (r < 0) { printf("cdp failed; perhaps not a CISCO switch?\n"); @@ -296,6 +316,9 @@ U_BOOT_CMD( int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) { char *toff; + + if(net_check_device() < 0) + return -1; if (argc < 2) { NetNtpServerIP = getenv_IPaddr ("ntpserverip");