confd: fix missing /etc/resolv.conf after 'no system'

When a CLI user performs the following command, the DNS resolver was
left in an undefined state.

    admin@infix-00-00-00:/config/> no system
    admin@infix-00-00-00:/config/> leave
    admin@infix:/>

The avahi-daemon reported the missing /etc/resolv.conf and the fix is to
ensure `resolvconf -u` runs on every major change ot ietf-system, even
if there is no new resolv.conf to roll in.  At bootstrap this has been
handled by another mechanism so has not been seen by most users.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-05-13 11:42:27 +02:00
committed by Tobias Waldekranz
parent c6b818d0bc
commit aa20f29b36
+5 -6
View File
@@ -544,12 +544,11 @@ static int change_dns(sr_session_ctx_t *session, uint32_t sub_id, const char *mo
case SR_EV_DONE:
/* Check if passed validation in previous event */
if (access(RESOLV_NEXT, F_OK))
return SR_ERR_OK;
(void)remove(RESOLV_PREV);
(void)rename(RESOLV_CONF, RESOLV_PREV);
(void)rename(RESOLV_NEXT, RESOLV_CONF);
if (!access(RESOLV_NEXT, F_OK)) {
(void)remove(RESOLV_PREV);
(void)rename(RESOLV_CONF, RESOLV_PREV);
(void)rename(RESOLV_NEXT, RESOLV_CONF);
}
/* in bootstrap, another resolvconf will soon take your call */
if (systemf("initctl -bq cond get hook/sys/up"))