[klibc] [klibc:master] ipconfig: Retry failed send after 1 second

klibc-bot for Ben Hutchings ben at decadent.org.uk
Sun Jun 4 16:48:10 PDT 2023


Commit-ID:  39fde2337ee32d2b21df6826b4173c8374ae65dd
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=39fde2337ee32d2b21df6826b4173c8374ae65dd
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Mon, 5 Jun 2023 01:04:47 +0200
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Mon, 5 Jun 2023 01:28:00 +0200

[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 at decadent.org.uk>

---
 usr/kinit/ipconfig/main.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index d45be354..64c53985 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -356,15 +356,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;
 


More information about the klibc mailing list