[PATCH 7/8] net: dns: export resolved ip to var resolved_ip

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Mar 30 00:31:52 EDT 2012


This will allow to use it in scripting.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 net/dns.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/net/dns.c b/net/dns.c
index 3c7aa5f..50d953b 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -27,6 +27,7 @@
 #include <net.h>
 #include <clock.h>
 #include <environment.h>
+#include <magicvar.h>
 #include <linux/err.h>
 
 #define DNS_PORT 53
@@ -238,6 +239,8 @@ static int do_host(int argc, char *argv[])
 {
 	IPaddr_t ip;
 
+	setenv("resolved_ip", "");
+
 	if (argc != 2)
 		return COMMAND_ERROR_USAGE;
 
@@ -248,6 +251,7 @@ static int do_host(int argc, char *argv[])
 		printf("%s is at ", argv[1]);
 		print_IPaddr(ip);
 		printf("\n");
+		setenv_ip("resolved_ip", ip);
 	}
 
 	return 0;
@@ -262,3 +266,4 @@ BAREBOX_CMD_START(host)
 	BAREBOX_CMD_HELP(cmd_host_help)
 BAREBOX_CMD_END
 
+BAREBOX_MAGICVAR(resolved_ip, "Resolved IP");
-- 
1.7.9.1




More information about the barebox mailing list