summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2012-12-31 13:45:15 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2012-12-31 13:45:15 +0000
commitdb5c4ca34559582b057d407858cf99546e09419a (patch)
tree0aae3194ed3c5be293228b9b48cfb67700a031e4 /sys/kern
parent1ede03dd7fa608e6291d01ed820fe1d9af24eba4 (diff)
Extend the sbcheck() function to make it work with socket buffers
containing m_nextpkt chains. OK markus@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket2.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 7a04f0d4c12..bd9a9e739d2 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.53 2012/04/13 09:38:32 deraadt Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.54 2012/12/31 13:45:14 bluhm Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -573,16 +573,18 @@ sbappendstream(struct sockbuf *sb, struct mbuf *m)
void
sbcheck(struct sockbuf *sb)
{
- struct mbuf *m;
+ struct mbuf *m, *n;
u_long len = 0, mbcnt = 0;
- for (m = sb->sb_mb; m; m = m->m_next) {
- len += m->m_len;
- mbcnt += MSIZE;
- if (m->m_flags & M_EXT)
- mbcnt += m->m_ext.ext_size;
- if (m->m_nextpkt)
- panic("sbcheck nextpkt");
+ for (m = sb->sb_mb; m; m = m->m_nextpkt) {
+ for (n = m; n; n = n->m_next) {
+ len += n->m_len;
+ mbcnt += MSIZE;
+ if (n->m_flags & M_EXT)
+ mbcnt += n->m_ext.ext_size;
+ if (m != n && n->m_nextpkt)
+ panic("sbcheck nextpkt");
+ }
}
if (len != sb->sb_cc || mbcnt != sb->sb_mbcnt) {
printf("cc %lu != %lu || mbcnt %lu != %lu\n", len, sb->sb_cc,