From: Steven Barth Date: Sun, 6 Apr 2014 14:27:27 +0000 (+0200) Subject: odhcpd: managed PD wait for 250ms initial period X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=fba0952c18b46f9385f43d7f7be2592f076d8402;p=oweals%2Fodhcpd.git odhcpd: managed PD wait for 250ms initial period --- 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;