X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fcmd_net.c;h=b2f3c7b709bc59f7449b86a540faaf78d1cce292;hb=618a51e9aefe1e03f498ea48bfab70a0b2c9be39;hp=87c4ed112b1e8f37f1546cfb23eea76666533139;hpb=586cbe51ab8ef357bcf3a52c6885ab00bc7293dd;p=u-boot diff --git a/common/cmd_net.c b/common/cmd_net.c index 87c4ed112b..b2f3c7b709 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -157,15 +157,13 @@ static void netboot_update_env(void) if (net_nis_domain[0]) setenv("domain", net_nis_domain); -#if defined(CONFIG_CMD_SNTP) \ - && defined(CONFIG_BOOTP_TIMEOFFSET) - if (NetTimeOffset) { - sprintf(tmp, "%d", NetTimeOffset); +#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET) + if (net_ntp_time_offset) { + sprintf(tmp, "%d", net_ntp_time_offset); setenv("timeoffset", tmp); } #endif -#if defined(CONFIG_CMD_SNTP) \ - && defined(CONFIG_BOOTP_NTPSERVER) +#if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_NTPSERVER) if (net_ntp_server.s_addr) { ip_to_string(net_ntp_server, tmp); setenv("ntpserverip", tmp); @@ -183,9 +181,9 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, ulong addr; /* pre-set load_addr */ - if ((s = getenv("loadaddr")) != NULL) { + s = getenv("loadaddr"); + if (s != NULL) load_addr = simple_strtoul(s, NULL, 16); - } switch (argc) { case 1: @@ -205,7 +203,8 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, sizeof(net_boot_file_name)); break; - case 3: load_addr = simple_strtoul(argv[1], NULL, 16); + case 3: + load_addr = simple_strtoul(argv[1], NULL, 16); copy_filename(net_boot_file_name, argv[2], sizeof(net_boot_file_name)); @@ -214,7 +213,7 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, #ifdef CONFIG_CMD_TFTPPUT case 4: if (strict_strtoul(argv[1], 16, &save_addr) < 0 || - strict_strtoul(argv[2], 16, &save_size) < 0) { + strict_strtoul(argv[2], 16, &save_size) < 0) { printf("Invalid address/size\n"); return CMD_RET_USAGE; } @@ -228,13 +227,14 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, } bootstage_mark(BOOTSTAGE_ID_NET_START); - if ((size = NetLoop(proto)) < 0) { + size = net_loop(proto); + if (size < 0) { bootstage_error(BOOTSTAGE_ID_NET_NETLOOP_OK); return CMD_RET_FAILURE; } bootstage_mark(BOOTSTAGE_ID_NET_NETLOOP_OK); - /* NetLoop ok, update environment */ + /* net_loop ok, update environment */ netboot_update_env(); /* done if no file was loaded (no errors though) */ @@ -267,7 +267,7 @@ static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (net_ping_ip.s_addr == 0) return CMD_RET_USAGE; - if (NetLoop(PING) < 0) { + if (net_loop(PING) < 0) { printf("ping failed; host %s is not alive\n", argv[1]); return CMD_RET_FAILURE; } @@ -290,27 +290,27 @@ static void cdp_update_env(void) { char tmp[16]; - if (CDPApplianceVLAN != htons(-1)) { - printf("CDP offered appliance VLAN %d\n", ntohs(CDPApplianceVLAN)); - VLAN_to_string(CDPApplianceVLAN, tmp); + if (cdp_appliance_vlan != htons(-1)) { + printf("CDP offered appliance VLAN %d\n", + ntohs(cdp_appliance_vlan)); + vlan_to_string(cdp_appliance_vlan, tmp); setenv("vlan", tmp); - NetOurVLAN = CDPApplianceVLAN; + net_our_vlan = cdp_appliance_vlan; } - if (CDPNativeVLAN != htons(-1)) { - printf("CDP offered native VLAN %d\n", ntohs(CDPNativeVLAN)); - VLAN_to_string(CDPNativeVLAN, tmp); + if (cdp_native_vlan != htons(-1)) { + printf("CDP offered native VLAN %d\n", ntohs(cdp_native_vlan)); + vlan_to_string(cdp_native_vlan, tmp); setenv("nvlan", tmp); - NetOurNativeVLAN = CDPNativeVLAN; + net_native_vlan = cdp_native_vlan; } - } int do_cdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { int r; - r = NetLoop(CDP); + r = net_loop(CDP); if (r < 0) { printf("cdp failed; perhaps not a CISCO switch?\n"); return CMD_RET_FAILURE; @@ -349,13 +349,13 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) toff = getenv("timeoffset"); if (toff == NULL) - NetTimeOffset = 0; + net_ntp_time_offset = 0; else - NetTimeOffset = simple_strtol(toff, NULL, 10); + net_ntp_time_offset = simple_strtol(toff, NULL, 10); - if (NetLoop(SNTP) < 0) { + if (net_loop(SNTP) < 0) { printf("SNTP failed: host %pI4 not responding\n", - &net_ntp_server); + &net_ntp_server); return CMD_RET_FAILURE; } @@ -392,14 +392,14 @@ int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_FAILURE; } - NetDNSResolve = argv[1]; + net_dns_resolve = argv[1]; if (argc == 3) - NetDNSenvvar = argv[2]; + net_dns_env_var = argv[2]; else - NetDNSenvvar = NULL; + net_dns_env_var = NULL; - if (NetLoop(DNS) < 0) { + if (net_loop(DNS) < 0) { printf("dns lookup of %s failed, check setup\n", argv[1]); return CMD_RET_FAILURE; } @@ -421,7 +421,7 @@ static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc, { char tmp[22]; - if (NetLoop(LINKLOCAL) < 0) + if (net_loop(LINKLOCAL) < 0) return CMD_RET_FAILURE; net_gateway.s_addr = 0;