aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2023-06-05 01:04:47 +0200
committerBen Hutchings <ben@decadent.org.uk>2023-06-05 01:28:00 +0200
commit39fde2337ee32d2b21df6826b4173c8374ae65dd (patch)
treec29e3adb488c66e6075a878e3708fcf10dc97e58
parent4ae6735c9f899815325a100a4019a7b385662bb4 (diff)
downloadklibc-39fde2337ee32d2b21df6826b4173c8374ae65dd.tar.gz
[klibc] ipconfig: Retry failed send after 1 second
Currently we check whether a device has link down before attempting to send a packet, but the send can still fail with ENETDOWN - perhaps due to racing with the kernel's linkwatch work. After such an error we'll wait about 10 seconds before retrying. Since the link check isn't reliable, remove it. Instead, wait only 1 second if we fail to send a packet. Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--usr/kinit/ipconfig/main.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index d45be3548cd040..64c53985c50c67 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -357,15 +357,6 @@ static void process_timeout_event(struct state *s, time_t now)
int ret = 0;
/*
- * Is the link up? If not, try again in 1 second.
- */
- if (!netdev_running(s->dev)) {
- s->expire = now + 1;
- s->state = s->restart_state;
- return;
- }
-
- /*
* If we had an error, restore a sane state to
* restart from.
*/
@@ -394,7 +385,7 @@ static void process_timeout_event(struct state *s, time_t now)
if (ret == -1) {
s->state = DEVST_ERROR;
- s->expire = now + 10;
+ s->expire = now + 1;
} else {
s->expire = now + s->retry_period;