summaryrefslogtreecommitdiffstats
path: root/net/ifup.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-11-17 21:47:40 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-12-01 12:33:33 +0100
commit46f7781d361b2b4768c0a56c4fd6a9b11fe4157c (patch)
tree44e95caa85e5398cf42ef067e2c7228c24a3c637 /net/ifup.c
parent48a58879d18a21007cb7d6863c1bd569a54a5c03 (diff)
downloadbarebox-46f7781d361b2b4768c0a56c4fd6a9b11fe4157c.tar.gz
barebox-46f7781d361b2b4768c0a56c4fd6a9b11fe4157c.tar.xz
net: Use a single gateway
There is not much point in having a network device specific gateway. If barebox really is part of such a complicated network in which it needs multiple gateways, then we probably need a real routing table. Until this happens, a single gateway should be enough. This introduces global.net.gateway which holds the gateway ip. The previously used device specific <ethx>.gateway variables still exist, but are only aliases for the single gateway. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net/ifup.c')
-rw-r--r--net/ifup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ifup.c b/net/ifup.c
index 2d1feeb74a..c3ea1b6a45 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -113,6 +113,7 @@ int ifup(const char *name, unsigned flags)
} else if (!strcmp(ip, "static")) {
char *bootarg;
IPaddr_t serverip;
+ IPaddr_t gateway;
for (i = 0; i < ARRAY_SIZE(vars); i++) {
ret = eth_set_param(dev, vars[i]);
@@ -121,11 +122,12 @@ int ifup(const char *name, unsigned flags)
}
serverip = net_get_serverip();
+ gateway = net_get_gateway();
bootarg = basprintf("ip=%pI4:%pI4:%pI4:%pI4:::",
&edev->ipaddr,
&serverip,
- &edev->gateway,
+ &gateway,
&edev->netmask);
dev_set_param(dev, "linux.bootargs", bootarg);
free(bootarg);