diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2018-07-02 14:47:51 -0500 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2018-07-26 14:08:18 -0500 |
commit | ac13270b49d55677aeea5a64dfbf1764118820e3 (patch) | |
tree | 2a8fe6eb4e638bb018f4f4661623fa47b553ccd0 /drivers | |
parent | 8c7988b6dbfb0aa05a935e602b8cdb67f7dd60b2 (diff) | |
download | u-boot-ac13270b49d55677aeea5a64dfbf1764118820e3.tar.gz u-boot-ac13270b49d55677aeea5a64dfbf1764118820e3.tar.xz u-boot-ac13270b49d55677aeea5a64dfbf1764118820e3.zip |
sandbox: eth-raw: Add a function to ask the host about localhost
Instead of doing a simple string compare against "lo", look for the flag
that indicates a localhost interface.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sandbox-raw.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c index 317e964019..c04b94c6e1 100644 --- a/drivers/net/sandbox-raw.c +++ b/drivers/net/sandbox-raw.c @@ -29,6 +29,8 @@ static int sb_eth_raw_start(struct udevice *dev) if (priv->local) { env_set("ipaddr", "127.0.0.1"); env_set("serverip", "127.0.0.1"); + net_ip = string_to_ip("127.0.0.1"); + net_server_ip = net_ip; } return ret; } @@ -140,6 +142,7 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev) struct eth_pdata *pdata = dev_get_platdata(dev); struct eth_sandbox_raw_priv *priv = dev_get_priv(dev); const char *ifname; + u32 local; pdata->iobase = dev_read_addr(dev); @@ -147,10 +150,13 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev) if (ifname) { strncpy(priv->host_ifname, ifname, IFNAMSIZ); printf(": Using %s from DT\n", priv->host_ifname); - if (strcmp(ifname, "lo") == 0) - priv->local = 1; } + local = sandbox_eth_raw_os_is_local(priv->host_ifname); + if (local < 0) + return local; + priv->local = local; + return 0; } |