From 46f7781d361b2b4768c0a56c4fd6a9b11fe4157c Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 17 Nov 2017 21:47:40 +0100 Subject: 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 .gateway variables still exist, but are only aliases for the single gateway. Signed-off-by: Sascha Hauer --- net/ifup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net/ifup.c') 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); -- cgit v1.2.3