diff options
author | Steven Barth <steven@midlink.org> | 2014-04-06 16:27:27 +0200 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2014-04-06 16:27:27 +0200 |
commit | fba0952c18b46f9385f43d7f7be2592f076d8402 (patch) | |
tree | b294e4a74983937496d2126c74088fad9bd4717b /src | |
parent | 2441f9629ddae3656313565c4e48236661c130ff (diff) |
odhcpd: managed PD wait for 250ms initial period
Diffstat (limited to 'src')
-rw-r--r-- | src/dhcpv6-ia.c | 9 |
1 files changed, 9 insertions, 0 deletions
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 <errno.h> #include <fcntl.h> #include <stdio.h> +#include <poll.h> #include <alloca.h> #include <resolv.h> #include <limits.h> @@ -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; |