diff options
author | sam <sam@FreeBSD.org> | 2003-09-29 22:57:43 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2003-09-29 22:57:43 +0000 |
commit | 0a6c1d4242d4d23328bf77b152fe0864e2db7f35 (patch) | |
tree | 8a7531562577bbc1732a8f3b1aa8301245449cab /sys/netipsec/ipsec_mbuf.c | |
parent | 9dc7c620e432a011a3fdcfb8183076ad041baeac (diff) | |
download | FreeBSD-src-0a6c1d4242d4d23328bf77b152fe0864e2db7f35.zip FreeBSD-src-0a6c1d4242d4d23328bf77b152fe0864e2db7f35.tar.gz |
MFp4: portability work, general cleanup, locking fixes
change 38496
o add ipsec_osdep.h that holds os-specific definitions for portability
o s/KASSERT/IPSEC_ASSERT/ for portability
o s/SPLASSERT/IPSEC_SPLASSERT/ for portability
o remove function names from ASSERT strings since line#+file pinpints
the location
o use __func__ uniformly to reduce string storage
o convert some random #ifdef DIAGNOSTIC code to assertions
o remove some debuggging assertions no longer needed
change 38498
o replace numerous bogus panic's with equally bogus assertions
that at least go away on a production system
change 38502 + 38530
o change explicit mtx operations to #defines to simplify
future changes to a different lock type
change 38531
o hookup ipv4 ctlinput paths to a noop routine; we should be
handling path mtu changes at least
o correct potential null pointer deref in ipsec4_common_input_cb
chnage 38685
o fix locking for bundled SA's and for when key exchange is required
change 38770
o eliminate recursion on the SAHTREE lock
change 38804
o cleanup some types: long -> time_t
o remove refrence to dead #define
change 38805
o correct some types: long -> time_t
o add scan generation # to secpolicy to deal with locking issues
change 38806
o use LIST_FOREACH_SAFE instead of handrolled code
o change key_flush_spd to drop the sptree lock before purging
an entry to avoid lock recursion and to avoid holding the lock
over a long-running operation
o misc cleanups of tangled and twisty code
There is still much to do here but for now things look to be
working again.
Supported by: FreeBSD Foundation
Diffstat (limited to 'sys/netipsec/ipsec_mbuf.c')
-rw-r--r-- | sys/netipsec/ipsec_mbuf.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/sys/netipsec/ipsec_mbuf.c b/sys/netipsec/ipsec_mbuf.c index a3a3b3f..7d7496d 100644 --- a/sys/netipsec/ipsec_mbuf.c +++ b/sys/netipsec/ipsec_mbuf.c @@ -60,7 +60,7 @@ m_clone(struct mbuf *m0) struct mbuf *n, *mfirst, *mlast; int len, off; - KASSERT(m0 != NULL, ("m_clone: null mbuf")); + IPSEC_ASSERT(m0 != NULL, ("null mbuf")); mprev = NULL; for (m = m0; m != NULL; m = mprev->m_next) { @@ -105,8 +105,7 @@ m_clone(struct mbuf *m0) * it anyway, we try to reduce the number of mbufs and * clusters so that future work is easier). */ - KASSERT(m->m_flags & M_EXT, - ("m_clone: m_flags 0x%x", m->m_flags)); + IPSEC_ASSERT(m->m_flags & M_EXT, ("m_flags 0x%x", m->m_flags)); /* NB: we only coalesce into a cluster or larger */ if (mprev != NULL && (mprev->m_flags & M_EXT) && m->m_len <= M_TRAILINGSPACE(mprev)) { @@ -208,8 +207,8 @@ m_makespace(struct mbuf *m0, int skip, int hlen, int *off) struct mbuf *m; unsigned remain; - KASSERT(m0 != NULL, ("m_dmakespace: null mbuf")); - KASSERT(hlen < MHLEN, ("m_makespace: hlen too big: %u", hlen)); + IPSEC_ASSERT(m0 != NULL, ("null mbuf")); + IPSEC_ASSERT(hlen < MHLEN, ("hlen too big: %u", hlen)); for (m = m0; m && skip > m->m_len; m = m->m_next) skip -= m->m_len; @@ -228,8 +227,7 @@ m_makespace(struct mbuf *m0, int skip, int hlen, int *off) struct mbuf *n; /* XXX code doesn't handle clusters XXX */ - KASSERT(remain < MLEN, - ("m_makespace: remainder too big: %u", remain)); + IPSEC_ASSERT(remain < MLEN, ("remainder too big: %u", remain)); /* * Not enough space in m, split the contents * of m, inserting new mbufs as required. @@ -313,7 +311,7 @@ m_pad(struct mbuf *m, int n) caddr_t retval; if (n <= 0) { /* No stupid arguments. */ - DPRINTF(("m_pad: pad length invalid (%d)\n", n)); + DPRINTF(("%s: pad length invalid (%d)\n", __func__, n)); m_freem(m); return NULL; } @@ -323,14 +321,14 @@ m_pad(struct mbuf *m, int n) m0 = m; while (m0->m_len < len) { -KASSERT(m0->m_next != NULL, ("m_pad: m0 null, len %u m_len %u", len, m0->m_len));/*XXX*/ len -= m0->m_len; m0 = m0->m_next; } if (m0->m_len != len) { - DPRINTF(("m_pad: length mismatch (should be %d instead of %d)\n", - m->m_pkthdr.len, m->m_pkthdr.len + m0->m_len - len)); + DPRINTF(("%s: length mismatch (should be %d instead of %d)\n", + __func__, m->m_pkthdr.len, + m->m_pkthdr.len + m0->m_len - len)); m_freem(m); return NULL; @@ -339,10 +337,10 @@ KASSERT(m0->m_next != NULL, ("m_pad: m0 null, len %u m_len %u", len, m0->m_len)) /* Check for zero-length trailing mbufs, and find the last one. */ for (m1 = m0; m1->m_next; m1 = m1->m_next) { if (m1->m_next->m_len != 0) { - DPRINTF(("m_pad: length mismatch (should be %d " - "instead of %d)\n", - m->m_pkthdr.len, - m->m_pkthdr.len + m1->m_next->m_len)); + DPRINTF(("%s: length mismatch (should be %d instead " + "of %d)\n", __func__, + m->m_pkthdr.len, + m->m_pkthdr.len + m1->m_next->m_len)); m_freem(m); return NULL; @@ -356,7 +354,7 @@ KASSERT(m0->m_next != NULL, ("m_pad: m0 null, len %u m_len %u", len, m0->m_len)) MGET(m1, M_DONTWAIT, MT_DATA); if (m1 == 0) { m_freem(m0); - DPRINTF(("m_pad: unable to get extra mbuf\n")); + DPRINTF(("%s: unable to get extra mbuf\n", __func__)); return NULL; } |