From 5ae21841acd7f55a4b57b99a5097ca99b84f07c4 Mon Sep 17 00:00:00 2001
From: David Gibson <david@gibson.dropbear.id.au>
Date: Tue, 19 Nov 2024 12:21:56 +1100
Subject: [PATCH] ndp: Don't send unsolicited RAs if NDP is disabled

We recently added support for sending unsolicited NDP Router Advertisement
packets.  While we (correctly) disable this if the --no-ra option is given
we incorrectly still send them if --no-ndp is set.  Fix the oversight.

Fixes: 6e1e44293ef9 ("ndp: Send unsolicited Router Advertisements")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
 passt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/passt.c b/passt.c
index a51a4e1..06e0a33 100644
--- a/passt.c
+++ b/passt.c
@@ -109,7 +109,8 @@ static void post_handler(struct ctx *c, const struct timespec *now)
 	flow_defer_handler(c, now);
 #undef CALL_PROTO_HANDLER
 
-	ndp_timer(c, now);
+	if (!c->no_ndp)
+		ndp_timer(c, now);
 }
 
 /**