[SSSD] [PATCH] MONITOR: Poll for resolv.conf if not available during boot

Jakub Hrozek jhrozek at redhat.com
Tue Jun 23 11:48:06 UTC 2015


On Wed, Jun 17, 2015 at 07:13:17PM +0200, Michal Židek wrote:
> Hi,
> 
> this patch partially solves the ticket
> https://fedorahosted.org/sssd/ticket/2590
> 
> It does not subscribe to the systemd dbus interface and does only
> the polling (this would have to be done anyway for the case
> the interface is not available).
> 
> I will investigate how to add the systemd/dbus check as well,
> but the attached patch should decrease priority of the ticket.
> 
> 
> Thanks,
> Michal

> From bb57b2bcba891cd395d795a7706cf2ea77f8bca2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek at redhat.com>
> Date: Wed, 17 Jun 2015 18:54:14 +0200
> Subject: [PATCH] MONITOR: Poll for resolv.conf if not available during boot
> 
> If resolv.conf is not available when SSSD is starting,
> check for its existence later.
> 
> Ticket:
> https://fedorahosted.org/sssd/ticket/2590
> ---
>  src/monitor/monitor.c | 38 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 36 insertions(+), 2 deletions(-)
> 
> diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
> index 01c882a..24fca28 100644
> --- a/src/monitor/monitor.c
> +++ b/src/monitor/monitor.c
> @@ -2259,11 +2259,39 @@ static errno_t monitor_config_file_fallback(TALLOC_CTX *mem_ctx,
>      return EOK;
>  }
>  
> +#define MISSING_RESOLV_CONF_POLL_TIME 10
> +
> +static void missing_resolv_conf(struct tevent_context *ev,
> +                                struct tevent_timer *te,
> +                                struct timeval tv, void *data)
> +{
> +    int ret;
> +    struct mt_ctx *ctx = talloc_get_type(data, struct mt_ctx);
> +
> +    ret = monitor_config_file(ctx, ctx, RESOLV_CONF_PATH,
> +                              monitor_update_resolv, false);
> +    if (ret == ENOENT) {
> +        tv = tevent_timeval_current_ofs(MISSING_RESOLV_CONF_POLL_TIME, 0);
> +        te = tevent_add_timer(ctx->ev, ctx, tv, missing_resolv_conf, ctx);
> +        if (te == NULL) {
> +            DEBUG(SSSDBG_FATAL_FAILURE,
> +                  "tevent_add_timer failed. resolv.conf will be ignored.\n");
> +        }
> +    } else if (ret != EOK) {
> +        DEBUG(SSSDBG_FATAL_FAILURE,
> +              "Monitor_config_file failed. resolv.conf will be ignored.\n");
> +    }
> +

I think we should add signal_res_init() here, because in my testing the
inotify watch is established if I mv a resolv.conf file into place, but
the backends remain offline.

We should also (in a different patch) change the DEBUG levels in
monitor_config_file, because currently we print a 0x0010-level message.

> +    return;
> +}
> +



More information about the sssd-devel mailing list