From 83bd31a9acc5e234f938d40bd12a847d26d66a6e Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Thu, 13 Aug 2026 12:29:49 +0100
Subject: [PATCH] ipv4: clear added state if we didn't delete the address

Thanks to MatthieuLgs for the diagnosis and fix.

Fixes #674 and #693.
---
 src/ipv4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/ipv4.c b/src/ipv4.c
index 892d60bb9..138640b8b 100644
--- a/src/ipv4.c
+++ b/src/ipv4.c
@@ -757,6 +757,8 @@ ipv4_applyaddr(void *arg)
 				/* Someone might have deleted our address */
 				if (state->addr != NULL)
 					ipv4_deladdr(state->addr, 0);
+				/* No address, ensure state is cleared  */
+				state->added = 0;
 				rt_build(ifp->ctx, AF_INET);
 			}
 			script_runreason(ifp, state->reason);
