summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-11-21 20:15:30 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-12-14 14:30:19 +0100
commite612a5ca7aa8207efb119105a594e81a011ec7ce (patch)
tree2d4b5494c0ea7d62dc3fbda720dd3af59f11e843
parent7457f45528d486daebc8d7392416f547dbd2a828 (diff)
downloadbarebox-e612a5ca7aa8207efb119105a594e81a011ec7ce.tar.gz
barebox-e612a5ca7aa8207efb119105a594e81a011ec7ce.tar.xz
ifup: Use dhcp C API rather than running command
DHCP has a C API, so use it instead of running as command. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--net/ifup.c6
1 files 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");