mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
confd: Avoid initctl reload after exiting previous generation
Instead of running initctl reload, which also prematurely enables services which are not supposed to be started until we have run through the netdag and evolved to the next generation. Handle the original use-case of disabling zeroconf is managed by asking finit to stop the service immediately in the exit action, and deferring the cleanup of the service until we call `initctl reload` after the init action of the new generation.
This commit is contained in:
@@ -148,30 +148,6 @@ static int ifchange_cand(sr_session_ctx_t *session, uint32_t sub_id, const char
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
int netdag_exit_reload(struct dagger *net)
|
||||
{
|
||||
FILE *initctl;
|
||||
|
||||
if (systemf("runlevel >/dev/null 2>&1"))
|
||||
/* If we are still bootstrapping, there is nothing to
|
||||
* reload. */
|
||||
return 0;
|
||||
|
||||
/* We may end up writing this file multiple times, e.g. if
|
||||
* multiple services are disabled in the same config cycle,
|
||||
* but since the contents of the file are static it doesn't
|
||||
* matter.
|
||||
*/
|
||||
initctl = dagger_fopen_current(net, "exit", "@post",
|
||||
90, "reload.sh");
|
||||
if (!initctl)
|
||||
return -EIO;
|
||||
|
||||
fputs("initctl -bnq reload\n", initctl);
|
||||
fclose(initctl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int netdag_gen_link_mtu(FILE *ip, struct lyd_node *dif)
|
||||
{
|
||||
const char *ifname = lydx_get_cattr(dif, "name");
|
||||
|
||||
@@ -47,7 +47,6 @@ int netdag_gen_ethtool(struct dagger *net, struct lyd_node *cif, struct lyd_node
|
||||
|
||||
/* ietf-interfaces.c */
|
||||
char *get_phys_addr(struct lyd_node *parent, int *deleted);
|
||||
int netdag_exit_reload(struct dagger *net);
|
||||
|
||||
/* ietf-ip.c */
|
||||
int netdag_gen_ipv6_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
|
||||
@@ -145,9 +145,9 @@ int netdag_gen_ipv4_autoconf(struct dagger *net, struct lyd_node *cif,
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
fprintf(initctl, "initctl -bnq stop zeroconf:%s\n", ifname);
|
||||
fprintf(initctl, "initctl -bnq disable zeroconf@%s.conf\n", ifname);
|
||||
fprintf(initctl, "rm -f %s\n", defaults);
|
||||
err = netdag_exit_reload(net);
|
||||
}
|
||||
|
||||
fclose(initctl);
|
||||
|
||||
Reference in New Issue
Block a user