]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_net.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / common / cmd_net.c
index 68183c49af9233666705f2025fad4ec0ccebb84b..b80a7ad8e33527832b33fdc9e3d17ebaaa52e5dc 100644 (file)
@@ -222,21 +222,6 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[])
                rcode = do_bootm (cmdtp, 0, 1, local_args);
        }
 
-#ifdef CONFIG_SOURCE
-       if (((s = getenv("autoscript")) != NULL) && (strcmp(s,"yes") == 0)) {
-               printf ("Running \"source\" command at addr 0x%08lX",
-                       load_addr);
-
-               s = getenv ("autoscript_uname");
-               if (s)
-                       printf (":%s ...\n", s);
-               else
-                       puts (" ...\n");
-
-               show_boot_progress (83);
-               rcode = source (load_addr, s);
-       }
-#endif
        if (rcode < 0)
                show_boot_progress (-83);
        else
@@ -353,3 +338,51 @@ U_BOOT_CMD(
        "[NTP server IP]\n"
 );
 #endif
+
+#if defined(CONFIG_CMD_DNS)
+int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+       if (argc == 1) {
+               cmd_usage(cmdtp);
+               return -1;
+       }
+
+       /*
+        * We should check for a valid hostname:
+        * - Each label must be between 1 and 63 characters long
+        * - the entire hostname has a maximum of 255 characters
+        * - only the ASCII letters 'a' through 'z' (case-insensitive),
+        *   the digits '0' through '9', and the hyphen
+        * - cannot begin or end with a hyphen
+        * - no other symbols, punctuation characters, or blank spaces are
+        *   permitted
+        * but hey - this is a minimalist implmentation, so only check length
+        * and let the name server deal with things.
+        */
+       if (strlen(argv[1]) >= 255) {
+               printf("dns error: hostname too long\n");
+               return 1;
+       }
+
+       NetDNSResolve = argv[1];
+
+       if (argc == 3)
+               NetDNSenvvar = argv[2];
+       else
+               NetDNSenvvar = NULL;
+
+       if (NetLoop(DNS) < 0) {
+               printf("dns lookup of %s failed, check setup\n", argv[1]);
+               return 1;
+       }
+
+       return 0;
+}
+
+U_BOOT_CMD(
+       dns,    3,      1,      do_dns,
+       "lookup the IP of a hostname",
+       "hostname [envvar]"
+);
+
+#endif /* CONFIG_CMD_DNS */