net: Fix error if some network features are disabled
authorKrebs, Olaf <Olaf.Krebs@emh-metering.com>
Mon, 9 Mar 2020 14:27:55 +0000 (14:27 +0000)
committerTom Rini <trini@konsulko.com>
Fri, 12 Jun 2020 17:17:23 +0000 (13:17 -0400)
If 'CONFIG_CMD_TFTPBOOT' or 'CONFIG_CMD_BOOTP' are disabled, the usage must be disabled, too!

Signed-off-by: Olaf Krebs <olaf.krebs@emh-metering.com>
CC: Joe Hershberger <joe.hershberger@ni.com>
cmd/net.c
net/net.c

index 25390b0474f4c9032cea1c678a1053e9d195a3f5..9bbcdbcfe0762f50d1c39c1554def117e8ccdfed 100644 (file)
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -135,11 +135,15 @@ static void netboot_update_env(void)
                env_set("netmask", tmp);
        }
 
+#ifdef CONFIG_CMD_BOOTP
        if (net_hostname[0])
                env_set("hostname", net_hostname);
+#endif
 
+#ifdef CONFIG_CMD_BOOTP
        if (net_root_path[0])
                env_set("rootpath", net_root_path);
+#endif
 
        if (net_ip.s_addr) {
                ip_to_string(net_ip, tmp);
@@ -165,8 +169,10 @@ static void netboot_update_env(void)
                env_set("dnsip2", tmp);
        }
 #endif
+#ifdef CONFIG_CMD_BOOTP
        if (net_nis_domain[0])
                env_set("domain", net_nis_domain);
+#endif
 
 #if defined(CONFIG_CMD_SNTP) && defined(CONFIG_BOOTP_TIMEOFFSET)
        if (net_ntp_time_offset) {
index 37932919d049a7a834bb999e83f593f9b5d47a29..11683dd6d099cfc28b2c4888fa29371144f05909 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -456,6 +456,7 @@ restart:
                net_dev_exists = 1;
                net_boot_file_size = 0;
                switch (protocol) {
+#ifdef CONFIG_CMD_TFTPBOOT
                case TFTPGET:
 #ifdef CONFIG_CMD_TFTPPUT
                case TFTPPUT:
@@ -463,6 +464,7 @@ restart:
                        /* always use ARP to get server ethernet address */
                        tftp_start(protocol);
                        break;
+#endif
 #ifdef CONFIG_CMD_TFTPSRV
                case TFTPSRV:
                        tftp_start_server();
@@ -480,13 +482,13 @@ restart:
                        dhcp_request();         /* Basically same as BOOTP */
                        break;
 #endif
-
+#if defined(CONFIG_CMD_BOOTP)
                case BOOTP:
                        bootp_reset();
                        net_ip.s_addr = 0;
                        bootp_request();
                        break;
-
+#endif
 #if defined(CONFIG_CMD_RARP)
                case RARP:
                        rarp_try = 0;