aboutsummaryrefslogtreecommitdiff
path: root/lib/roles
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2021-06-27 08:00:35 +0100
committerAndy Green <andy@warmcat.com>2021-06-27 08:42:26 +0100
commit34afca321c3dcb2f60d3523c178e5770647da274 (patch)
tree035d16efce4757a82ed07667c9e2c1a54b1971e0 /lib/roles
parentd5475807b0ee7cafa0ab5844007782c36e33e4a4 (diff)
downloadlibwebsockets-34afca321c3dcb2f60d3523c178e5770647da274.tar.gz
netlink: hold in COLDPLUG until we actually have some routing table contents
Diffstat (limited to 'lib/roles')
-rw-r--r--lib/roles/netlink/ops-netlink.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/roles/netlink/ops-netlink.c b/lib/roles/netlink/ops-netlink.c
index bd36c31e..f9ef3ebd 100644
--- a/lib/roles/netlink/ops-netlink.c
+++ b/lib/roles/netlink/ops-netlink.c
@@ -78,18 +78,6 @@ rops_handle_POLLIN_netlink(struct lws_context_per_thread *pt, struct lws *wsi,
if (!(pollfd->revents & LWS_POLLIN))
return LWS_HPI_RET_HANDLED;
- if (!cx->nl_initial_done && pt == &cx->pt[0]) {
- /*
- * While netlink info still coming, keep moving the timer for
- * calling it "done" to +100ms until after it stops coming
- */
- lws_context_lock(cx, __func__);
- lws_sul_schedule(cx, 0, &cx->sul_nl_coldplug,
- lws_netlink_coldplug_done_cb,
- 100 * LWS_US_PER_MS);
- lws_context_unlock(cx);
- }
-
memset(&msg, 0, sizeof(msg));
iov.iov_base = (void *)s;
@@ -450,6 +438,20 @@ inform:
}
#endif
+ if (!cx->nl_initial_done &&
+ pt == &cx->pt[0] &&
+ cx->routing_table.count) {
+ /*
+ * While netlink info still coming, keep moving the timer for
+ * calling it "done" to +100ms until after it stops coming
+ */
+ lws_context_lock(cx, __func__);
+ lws_sul_schedule(cx, 0, &cx->sul_nl_coldplug,
+ lws_netlink_coldplug_done_cb,
+ 100 * LWS_US_PER_MS);
+ lws_context_unlock(cx);
+ }
+
return LWS_HPI_RET_HANDLED;
}
@@ -572,15 +574,13 @@ rops_pt_init_destroy_netlink(struct lws_context *context,
}
/*
- * Responses are going to come asynchronously, since we can't process
- * DNS lookups properly until we collected the initial netlink responses
- * let's set a timer that will let us advance from lws_system
- * LWS_SYSTATE_IFACE_COLDPLUG
+ * Responses are going to come asynchronously, let's block moving
+ * off state IFACE_COLDPLUG until we have had them. This is important
+ * since if we don't hold there, when we do get the responses we may
+ * cull any ongoing connections as unroutable otherwise
*/
lwsl_debug("%s: starting netlink coldplug wait\n", __func__);
- lws_sul_schedule(context, 0, &context->sul_nl_coldplug,
- lws_netlink_coldplug_done_cb, 450 * LWS_US_PER_MS);
return 0;