summaryrefslogtreecommitdiffstats
path: root/net/ifup.c
diff options
context:
space:
mode:
authorEnrico Jorns <ejo@pengutronix.de>2016-09-19 18:03:48 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-09-22 11:30:38 +0200
commit841d83ff0a30dfdb58ae94f497097b52aecacf67 (patch)
treea6e746d2d428392afb0a0525018c1974a7053815 /net/ifup.c
parentd60230bded854fe5a357c77038cf6089defcfd24 (diff)
downloadbarebox-841d83ff0a30dfdb58ae94f497097b52aecacf67.tar.gz
barebox-841d83ff0a30dfdb58ae94f497097b52aecacf67.tar.xz
net: add linux.bootarg parameter from ifup call
This sets a `ip=dhcp` or `ip=<clientip>:<serverip>:<gatewayip>:<netmaskip>::<iface>:` bootarg for the network device upon execution of 'ifup'. This is the only point where we can distinguish between a static ip and a dhcp-based network setup and thus set a valid bootarg options as it will be required for nfs boot, for example. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net/ifup.c')
-rw-r--r--net/ifup.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/ifup.c b/net/ifup.c
index 30ac3f5861..5113d13832 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -106,12 +106,21 @@ int ifup(const char *name, unsigned flags)
ret = eth_set_param(dev, "serverip");
if (ret)
goto out;
+ dev_set_param(dev, "linux.bootargs", "ip=dhcp");
} else if (!strcmp(ip, "static")) {
+ char *bootarg;
for (i = 0; i < ARRAY_SIZE(vars); i++) {
ret = eth_set_param(dev, vars[i]);
if (ret)
goto out;
}
+ bootarg = basprintf("ip=%pI4:%pI4:%pI4:%pI4:::",
+ &edev->ipaddr,
+ &edev->serverip,
+ &edev->gateway,
+ &edev->netmask);
+ dev_set_param(dev, "linux.bootargs", bootarg);
+ free(bootarg);
} else {
pr_err("unknown ip type: %s\n", ip);
ret = -EINVAL;