summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPeter Hessler <phessler@cvs.openbsd.org>2017-01-21 10:15:16 +0000
committerPeter Hessler <phessler@cvs.openbsd.org>2017-01-21 10:15:16 +0000
commitafe63d21204212ddead6dafdfe20e0a6ed5c1e72 (patch)
treef4f7b46f46dcef412e0ddf63d3991525f2469d67 /sys
parent460908b8a3d93d1cb31f994c90eaab459f477848 (diff)
sockets tell us the size of their data. since we want one udp packet,
just use that. uses one less soreceive() loop per packet received. hints from claudio@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/bfd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/bfd.c b/sys/net/bfd.c
index 6f81d31e0da..dacc735ddc0 100644
--- a/sys/net/bfd.c
+++ b/sys/net/bfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bfd.c,v 1.53 2017/01/21 08:40:04 phessler Exp $ */
+/* $OpenBSD: bfd.c,v 1.54 2017/01/21 10:15:15 phessler Exp $ */
/*
* Copyright (c) 2016 Peter Hessler <phessler@openbsd.org>
@@ -595,7 +595,7 @@ bfd_upcall(struct socket *so, caddr_t arg, int waitflag)
uio.uio_procp = NULL;
do {
- uio.uio_resid = BFD_HDRLEN;
+ uio.uio_resid = so->so_rcv.sb_cc;
flags = MSG_DONTWAIT;
error = soreceive(so, NULL, &uio, &m, NULL, &flags, 0);
if (error && error != EAGAIN) {
@@ -604,7 +604,7 @@ bfd_upcall(struct socket *so, caddr_t arg, int waitflag)
}
if (m != NULL)
bfd_input(bfd, m);
- } while (m != NULL);
+ } while (so->so_rcv.sb_cc);
return;
}