diff options
author | 2011-04-03 17:01:23 +0000 | |
---|---|---|
committer | 2011-04-03 17:01:23 +0000 | |
commit | 213a5eebdfc5152a65053b5004afd989facebe4d (patch) | |
tree | 45e6b0c7e4f09712a47b09b10bc46c182e384e0d | |
parent | get rid of NO_CCB by moving to iopools. (diff) | |
download | wireguard-openbsd-213a5eebdfc5152a65053b5004afd989facebe4d.tar.xz wireguard-openbsd-213a5eebdfc5152a65053b5004afd989facebe4d.zip |
Always reserve space in the routing socket for a desync mbuf. This allows
a desync to be appended when the socket buffer becomes full, rather than
continuall retrying until space becomes available (which may be never).
ok claudio@
-rw-r--r-- | sys/net/rtsock.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 45c1203d88c..7d1dd8dc312 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.115 2011/03/31 10:36:42 jasper Exp $ */ +/* $OpenBSD: rtsock.c,v 1.116 2011/04/03 17:01:23 jsing Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -403,7 +403,8 @@ route_input(struct mbuf *m0, ...) if (last) { struct mbuf *n; if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) { - if (sbappendaddr(&last->so_rcv, sosrc, + if (sbspace(&last->so_rcv) < (2 * MSIZE) || + sbappendaddr(&last->so_rcv, sosrc, n, (struct mbuf *)0) == 0) { /* * Flag socket as desync'ed and @@ -423,7 +424,8 @@ route_input(struct mbuf *m0, ...) last = rp->rcb_socket; } if (last) { - if (sbappendaddr(&last->so_rcv, sosrc, + if (sbspace(&last->so_rcv) < (2 * MSIZE) || + sbappendaddr(&last->so_rcv, sosrc, m, (struct mbuf *)0) == 0) { /* Flag socket as desync'ed and flush required */ sotoroutecb(last)->flags |= |