[PATCH 19/27] ifup: Use dhcp C API rather than running command

Sascha Hauer s.hauer at pengutronix.de
Fri Dec 1 03:22:48 PST 2017


DHCP has a C API, so use it instead of running as command.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 net/ifup.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ifup.c b/net/ifup.c
index f6ccd70378..0f5d2772e8 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -22,6 +22,7 @@
 #include <command.h>
 #include <common.h>
 #include <getopt.h>
+#include <dhcp.h>
 #include <net.h>
 #include <fs.h>
 #include <linux/stat.h>
@@ -114,15 +115,12 @@ int ifup(const char *name, unsigned flags)
 
 	if (!strcmp(ip, "dhcp")) {
 		IPaddr_t serverip;
-		char *dhcp_cmd;
 
 		serverip = getenv_ip("serverip");
 		if (serverip)
 			net_set_serverip_empty(serverip);
 
-		dhcp_cmd = basprintf("dhcp %s", name);
-		ret = run_command(dhcp_cmd);
-		free(dhcp_cmd);
+		ret = dhcp(edev, NULL);
 		if (ret)
 			goto out;
 		dev_set_param(dev, "linux.bootargs", "ip=dhcp");
-- 
2.11.0




More information about the barebox mailing list