diff options
Diffstat (limited to 'src/libsystemd-network/sd-ndisc.c')
-rw-r--r-- | src/libsystemd-network/sd-ndisc.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsystemd-network/sd-ndisc.c b/src/libsystemd-network/sd-ndisc.c index 713438f212..5591bc7841 100644 --- a/src/libsystemd-network/sd-ndisc.c +++ b/src/libsystemd-network/sd-ndisc.c @@ -494,8 +494,11 @@ static int ndisc_router_advertisment_recv(sd_event_source *s, int fd, uint32_t r assert(nd->event); r = ioctl(fd, FIONREAD, &buflen); - if (r < 0 || buflen <= 0) - buflen = ICMP6_RECV_SIZE; + if (r < 0) + return -errno; + else if (buflen < 0) + /* This really should not happen */ + return -EIO; ra = malloc(buflen); if (!ra) @@ -503,8 +506,11 @@ static int ndisc_router_advertisment_recv(sd_event_source *s, int fd, uint32_t r len = recvfrom(fd, ra, buflen, 0, &router.sa, &router_len); if (len < 0) { + if (errno == EAGAIN || errno == EINTR) + return 0; + log_ndisc(nd, "Could not receive message from ICMPv6 socket: %m"); - return 0; + return -errno; } else if (router_len == 0) gw = NULL; /* only happens when running the test-suite over a socketpair */ else if (router_len != sizeof(router.in6)) { |