diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2011-04-03 17:01:24 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2011-04-03 17:01:24 +0000 |
commit | b37645ee58d04ccbc44eef24cadee005f9208de0 (patch) | |
tree | 2557df8c069d7fd2efe11828a4e7116c2068fe08 /sys/net/rtsock.c | |
parent | db29c8916631f56bffe351c6a1dfe77027f40df8 (diff) |
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@
Diffstat (limited to 'sys/net/rtsock.c')
-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 |= |