summaryrefslogtreecommitdiffstats
path: root/ospf6d/ospf6_network.c
diff options
context:
space:
mode:
authorPat Ruddy <pat@voltanet.io>2021-03-03 12:59:30 +0100
committerPat Ruddy <pat@voltanet.io>2021-06-18 10:40:42 +0200
commitaa6a96ba78bacb2792f2a6c26b6873b3ff4e35b8 (patch)
tree4456cb2e9b7ac2a91b3302bbc1c54bf9986a1212 /ospf6d/ospf6_network.c
parentospf6d: create an ospf_read_helper function (diff)
downloadfrr-aa6a96ba78bacb2792f2a6c26b6873b3ff4e35b8.tar.xz
frr-aa6a96ba78bacb2792f2a6c26b6873b3ff4e35b8.zip
ospf6d: read ospf6 socket until failure
To ensure we read all the datagrams availabe from a socket when the read task is scheduled, make the read helper return and error or continue enum and loop unitl an error is received. This requires the read from the socket to be non blocking Signed-off-by: Pat Ruddy <pat@voltanet.io>
Diffstat (limited to 'ospf6d/ospf6_network.c')
-rw-r--r--ospf6d/ospf6_network.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c
index 76f98fecd..5961cfe66 100644
--- a/ospf6d/ospf6_network.c
+++ b/ospf6d/ospf6_network.c
@@ -257,10 +257,13 @@ int ospf6_recvmsg(struct in6_addr *src, struct in6_addr *dst,
rmsghdr.msg_control = (caddr_t)cmsgbuf;
rmsghdr.msg_controllen = sizeof(cmsgbuf);
- retval = recvmsg(ospf6_sock, &rmsghdr, 0);
- if (retval < 0)
- zlog_warn("recvmsg failed: %s", safe_strerror(errno));
- else if (retval == iov_totallen(message))
+ retval = recvmsg(ospf6_sock, &rmsghdr, MSG_DONTWAIT);
+ if (retval < 0) {
+ if (errno != EAGAIN && errno != EWOULDBLOCK)
+ zlog_warn("stream_recvmsg failed: %s",
+ safe_strerror(errno));
+ return retval;
+ } else if (retval == iov_totallen(message))
zlog_warn("recvmsg read full buffer size: %d", retval);
/* source address */