diff --git a/lib/core/context.c b/lib/core/context.c index fdee4fe08..17b34cb39 100644 --- a/lib/core/context.c +++ b/lib/core/context.c @@ -134,7 +134,9 @@ lws_state_notify_protocol_init(struct lws_state_manager *mgr, * us to OPERATIONAL */ - if (target == LWS_SYSTATE_IFACE_COLDPLUG && !context->nl_initial_done) { + if (target == LWS_SYSTATE_IFACE_COLDPLUG && + context->netlink && + !context->nl_initial_done) { lwsl_info("%s: waiting for netlink coldplug\n", __func__); return 1; diff --git a/lib/roles/netlink/ops-netlink.c b/lib/roles/netlink/ops-netlink.c index 338e17b25..b86efe2e3 100644 --- a/lib/roles/netlink/ops-netlink.c +++ b/lib/roles/netlink/ops-netlink.c @@ -480,7 +480,7 @@ rops_pt_init_destroy_netlink(struct lws_context *context, struct msghdr msg; struct iovec iov; struct lws *wsi; - int n; + int n, ret = 1; if (destroy) { @@ -533,8 +533,10 @@ rops_pt_init_destroy_netlink(struct lws_context *context, #endif ; - if (bind(wsi->desc.sockfd, (struct sockaddr*)&sanl, sizeof(sanl)) < 0) { - lwsl_err("%s: netlink bind failed\n", __func__); + if (lws_fi(&context->fic, "netlink_bind") || + bind(wsi->desc.sockfd, (struct sockaddr*)&sanl, sizeof(sanl)) < 0) { + lwsl_warn("%s: netlink bind failed\n", __func__); + ret = 0; /* some systems deny access, just ignore */ goto bail2; } @@ -600,7 +602,7 @@ bail2: bail1: lws_free(wsi); bail: - return 1; + return ret; } static const lws_rops_t rops_table_netlink[] = {