summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-06-22 16:32:31 +0200
committerHans Dedecker <dedeckeh@gmail.com>2018-06-22 16:38:12 +0200
commit5b087a66b0d85f828d56f8ccd745d14da78544bc (patch)
tree18adcd257b5bcaed3ed2cd6096020fabc7676d26 /src
parentc9114a14e3dd59c133d44ba33b977ef60b20b16e (diff)
dhcpv6-ia: improve error checking in assign_pd()
Detected by Coverity in CID1412267 Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/dhcpv6-ia.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dhcpv6-ia.c b/src/dhcpv6-ia.c
index 1c94a65..8eada74 100644
--- a/src/dhcpv6-ia.c
+++ b/src/dhcpv6-ia.c
@@ -581,7 +581,9 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign)
if (iface->dhcpv6_pd_manager[0]) {
int fd = usock(USOCK_UNIX | USOCK_TCP, iface->dhcpv6_pd_manager, NULL);
if (fd >= 0) {
+ struct pollfd pfd = { .fd = fd, .events = POLLIN };
char iaidbuf[298];
+
odhcpd_hexlify(iaidbuf, assign->clid_data, assign->clid_len);
assign->managed_sock.stream.notify_read = managed_handle_pd_data;
@@ -598,8 +600,11 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_assignment *assign)
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);
+ if (poll(&pfd, 1, 250) < 0) {
+ syslog(LOG_ERR, "poll(): %m");
+ return false;
+ }
+
managed_handle_pd_data(&assign->managed_sock.stream, 0);
if (fcntl(fd, F_GETFL) >= 0 && assign->managed_size > 0)