Skip to content

Commit

Permalink
DYNDNS: force nsupdate as unconditional_online_cb
Browse files Browse the repository at this point in the history
This is to trigger an update for every (eligible) netlink event.

This hardly a real solution, more like a test.
  • Loading branch information
alexey-tikhonov committed Jan 23, 2025
1 parent c6294f5 commit 1a63202
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/providers/be_ptask.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ static void be_ptask_execute(struct tevent_context *ev,
return;
}

static void be_ptask_force_execute(void *pvt)
{
struct timeval tv;
gettimeofday(&tv, NULL);

be_ptask_execute(NULL, NULL, tv, pvt);
}

static void be_ptask_done(struct tevent_req *req)
{
struct be_ptask *task = NULL;
Expand Down Expand Up @@ -357,12 +365,16 @@ errno_t be_ptask_create(TALLOC_CTX *mem_ctx,

if (flags & BE_PTASK_OFFLINE_DISABLE) {
/* install offline and online callbacks */
ret = be_add_online_cb(task, be_ctx, be_ptask_online_cb, task, NULL);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
"Unable to install online callback [%d]: %s\n",
ret, sss_strerror(ret));
goto done;
if (strcmp(name, "Dyndns update") == 0) {
be_add_unconditional_online_cb(task, be_ctx, be_ptask_force_execute, task, NULL);
} else {
ret = be_add_online_cb(task, be_ctx, be_ptask_online_cb, task, NULL);
if (ret != EOK) {
DEBUG(SSSDBG_OP_FAILURE,
"Unable to install online callback [%d]: %s\n",
ret, sss_strerror(ret));
goto done;
}
}

ret = be_add_offline_cb(task, be_ctx, be_ptask_offline_cb, task, NULL);
Expand Down

0 comments on commit 1a63202

Please sign in to comment.