diff --git a/cond-w.c b/cond-w.c index efb1b263..cb5db443 100644 --- a/cond-w.c +++ b/cond-w.c @@ -21,6 +21,7 @@ * THE SOFTWARE. */ +#include #include #include #include @@ -124,6 +125,34 @@ void cond_reload(void) cond_update(NULL); } + +static int reassert(const char *fpath, const struct stat *UNUSED(sb), int tflg, struct FTW *ftw) +{ + char *nm; + + if (ftw->level == 0) + return 1; + + if (tflg != FTW_F) + return 0; + + nm = (char *)fpath + sizeof(COND_PATH); + _d("Reasserting %s => %s", fpath, nm); + cond_set(nm); + + return 0; +} +/* + * Used only by netlink plugin atm. + * type: is a one of svc/, net/, etc. + */ +void cond_reassert(const char *type) +{ + _d("%s", type); + nftw(cond_path(type), reassert, 20, FTW_DEPTH); +} + + /** * Local Variables: * indent-tabs-mode: t diff --git a/cond.h b/cond.h index 2327b31b..f8c94f4e 100644 --- a/cond.h +++ b/cond.h @@ -24,6 +24,7 @@ int cond_set_path(const char *path, enum cond_state new); void cond_set (const char *name); void cond_clear (const char *name); void cond_reload (void); +void cond_reassert(const char *pat); #endif /* FINIT_COND_H_ */ diff --git a/plugins/netlink.c b/plugins/netlink.c index ef7e7cb6..d5b4ce34 100644 --- a/plugins/netlink.c +++ b/plugins/netlink.c @@ -186,8 +186,16 @@ static void nl_callback(void *UNUSED(arg), int sd, int UNUSED(events)) } } +static void nl_reconf(void *_null) +{ + (void)_null; + + cond_reassert("net/"); +} + static plugin_t plugin = { .name = __FILE__, + .hook[HOOK_SVC_RECONF] = { .cb = nl_reconf }, .io = { .cb = nl_callback, .flags = PLUGIN_IO_READ,