[PATCH 16/21] ifup: Use dhcp C API rather than running command
Sascha Hauer
s.hauer at pengutronix.de
Fri Nov 24 00:12:32 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 859cee717a..a65956bba1 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(serverip, false);
- 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