aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/ctld
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2022-10-12 22:44:09 +0000
committerAlan Somers <asomers@FreeBSD.org>2022-11-23 20:55:41 +0000
commit896282a37f5aff6dfdae4b02fc34cd4ef98dd7c6 (patch)
tree3bba22d523ab4306256f2162ce0127ffe71543f4 /usr.sbin/ctld
parent4a0c5d391f8a586ea0af4e18b6451ac2e84b6639 (diff)
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r--usr.sbin/ctld/ctld.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c
index 3f4bca632512..7ee381de08a7 100644
--- a/usr.sbin/ctld/ctld.c
+++ b/usr.sbin/ctld/ctld.c
@@ -2113,7 +2113,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
/*
* Now add new ports or modify existing ones.
*/
- TAILQ_FOREACH(newport, &newconf->conf_ports, p_next) {
+ TAILQ_FOREACH_SAFE(newport, &newconf->conf_ports, p_next, tmpport) {
if (port_is_dummy(newport))
continue;
oldport = port_find(oldconf, newport->p_name);
@@ -2130,6 +2130,8 @@ conf_apply(struct conf *oldconf, struct conf *newconf)
log_warnx("failed to %s port %s",
(oldport == NULL) ? "add" : "update",
newport->p_name);
+ if (oldport == NULL || port_is_dummy(oldport))
+ port_delete(newport);
/*
* XXX: Uncomment after fixing the root cause.
*