From fba0952c18b46f9385f43d7f7be2592f076d8402 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sun, 6 Apr 2014 16:27:27 +0200 Subject: [PATCH] odhcpd: managed PD wait for 250ms initial period --- src/dhcpv6-ia.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c index 767a546..844dfd3 100644 --- a/src/dhcpv6-ia.c +++ b/src/dhcpv6-ia.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -464,6 +465,14 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign) assign->managed_size = -1; assign->valid_until = odhcpd_time() + 15; list_add(&assign->head, &iface->ia_assignments); + + // Wait initial period of up to 250ms for immediate assignment + struct pollfd pfd = { .fd = fd, .events = POLLIN }; + poll(&pfd, 1, 250); + managed_handle_pd_data(&assign->managed_sock.stream, 0); + + if (fcntl(fd, F_GETFL) >= 0 && assign->managed_size > 0) + return true; } return false; -- 2.30.2