diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-08-19 14:20:13 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-13 10:49:21 +0200 |
commit | 9296260a7858f0e9cb4d0123bdabd72f1e457bbd (patch) | |
tree | 1759e33bbd3ffed2fad8007f53ad753ef3f8c036 /net | |
parent | 3487f1ee8e0345ed22c6097be4466c0b96590604 (diff) | |
download | barebox-9296260a7858f0e9cb4d0123bdabd72f1e457bbd.tar.gz barebox-9296260a7858f0e9cb4d0123bdabd72f1e457bbd.tar.xz |
net: split NetLoop in NetLoop and NetLoopInit
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 8 | ||||
-rw-r--r-- | net/ping.c | 3 | ||||
-rw-r--r-- | net/sntp.c | 3 |
3 files changed, 12 insertions, 2 deletions
@@ -238,8 +238,7 @@ void ArpTimeoutCheck(void) * Main network processing loop. */ -int -NetLoop(proto_t protocol) +int NetLoopInit(proto_t protocol) { struct eth_device *eth_current = eth_get_current(); IPaddr_t ip; @@ -292,6 +291,11 @@ NetLoop(proto_t protocol) NetOurNativeVLAN = getenv_VLAN("nvlan"); NetServerIP = dev_get_param_ip(ð_current->dev, "serverip"); + return 0; +} + +int NetLoop(proto_t protocol) +{ /* * Start the ball rolling with the given start function. From * here on, this code is a state machine driven by received diff --git a/net/ping.c b/net/ping.c index 1fef18ae0b..26b7778823 100644 --- a/net/ping.c +++ b/net/ping.c @@ -97,6 +97,9 @@ int do_ping (cmd_tbl_t *cmdtp, int argc, char *argv[]) return -1; } + if (NetLoopInit(PING) < 0) + return 1; + if (NetLoop(PING) < 0) { printf("ping failed; host %s is not alive\n", argv[1]); return 1; diff --git a/net/sntp.c b/net/sntp.c index df22caef24..3be166a372 100644 --- a/net/sntp.c +++ b/net/sntp.c @@ -110,6 +110,9 @@ int do_sntp (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) if (toff == NULL) NetTimeOffset = 0; else NetTimeOffset = simple_strtol (toff, NULL, 10); + if (NetLoopInit(SNTP) < 0) + return 1; + if (NetLoop(SNTP) < 0) { printf("SNTP failed: host %s not responding\n", argv[1]); return 1; |