From f03cb68e8fb6ea54b544153f41df865197530ae0 Mon Sep 17 00:00:00 2001
From: Chris Fiege <cfi@pengutronix.de>
Date: Sun, 29 Oct 2023 15:25:49 +0100
Subject: [PATCH] gluon-radv-filterd: Increase timeout when calling `ebtables`

A popen of `ebtables` can block, when there is already another instance
running.
This timeout was intended to be 1 second.
So we should wait at least that long.

Signed-off-by: Chris Fiege <cfi@pengutronix.de>
---
 package/gluon-radv-filterd/src/gluon-radv-filterd.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/gluon-radv-filterd/src/gluon-radv-filterd.c b/package/gluon-radv-filterd/src/gluon-radv-filterd.c
index 3506b351..067cfd55 100644
--- a/package/gluon-radv-filterd/src/gluon-radv-filterd.c
+++ b/package/gluon-radv-filterd/src/gluon-radv-filterd.c
@@ -53,8 +53,8 @@
 // seconds). Re-read it from the transtable afterwards.
 #define ORIGINATOR_CACHE_TTL 300
 
-// max execution time of a single ebtables call in nanoseconds
-#define EBTABLES_TIMEOUT 500000000 // 500ms
+// max execution time of a single ebtables call in seconds
+#define EBTABLES_TIMEOUT 2
 
 // TQ value assigned to local routers
 #define LOCAL_TQ 512
@@ -143,7 +143,7 @@ static int timespec_diff(struct timespec *tv1, struct timespec *tv2,
 static void cleanup(void) {
 	struct router *router;
 	struct timespec timeout = {
-		.tv_nsec = EBTABLES_TIMEOUT,
+		.tv_sec = EBTABLES_TIMEOUT,
 	};
 
 	close(G.sock);
@@ -658,7 +658,7 @@ static void update_tqs(void) {
 static void update_redirect(void) {
 	struct router *router;
 	struct timespec timeout = {
-		.tv_nsec = EBTABLES_TIMEOUT,
+		.tv_sec = EBTABLES_TIMEOUT,
 	};
 
 	foreach(router, G.routers) {
@@ -770,7 +770,7 @@ static bool election_required(void)
 
 static void update_ebtables(void) {
 	struct timespec timeout = {
-		.tv_nsec = EBTABLES_TIMEOUT,
+		.tv_sec = EBTABLES_TIMEOUT,
 	};
 	char mac[F_MAC_LEN + 1];
 	struct router *router;
-- 
GitLab