Now that IPv6 performs basic in6pcb and inpcb locking, enable inpcb

lock assertions even if IPv6 is compiled into the kernel.  Previously,
inclusion of IPv6 and locking assertions would result in a rapid
assertion failure as IPv6 was not properly locking inpcbs.
This commit is contained in:
rwatson 2004-08-04 18:27:55 +00:00
parent f7237cd696
commit bc0c491205

View File

@ -243,16 +243,10 @@ struct inpcbinfo { /* XXX documentation, prefixes */
#define INP_LOCK_DESTROY(inp) mtx_destroy(&(inp)->inp_mtx)
#define INP_LOCK(inp) mtx_lock(&(inp)->inp_mtx)
#define INP_UNLOCK(inp) mtx_unlock(&(inp)->inp_mtx)
#ifndef INET6
#define INP_LOCK_ASSERT(inp) do { \
mtx_assert(&(inp)->inp_mtx, MA_OWNED); \
NET_ASSERT_GIANT(); \
} while (0)
#else
#define INP_LOCK_ASSERT(inp) do { \
NET_ASSERT_GIANT(); \
} while (0)
#endif
#define INP_INFO_LOCK_INIT(ipi, d) \
mtx_init(&(ipi)->ipi_mtx, (d), NULL, MTX_DEF | MTX_RECURSE)
@ -260,7 +254,6 @@ struct inpcbinfo { /* XXX documentation, prefixes */
#define INP_INFO_WLOCK(ipi) mtx_lock(&(ipi)->ipi_mtx)
#define INP_INFO_RUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx)
#define INP_INFO_WUNLOCK(ipi) mtx_unlock(&(ipi)->ipi_mtx)
#ifndef INET6
#define INP_INFO_RLOCK_ASSERT(ipi) do { \
mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \
NET_ASSERT_GIANT(); \
@ -269,14 +262,6 @@ struct inpcbinfo { /* XXX documentation, prefixes */
mtx_assert(&(ipi)->ipi_mtx, MA_OWNED); \
NET_ASSERT_GIANT(); \
} while (0)
#else
#define INP_INFO_RLOCK_ASSERT(ipi) do { \
NET_ASSERT_GIANT(); \
} while (0)
#define INP_INFO_WLOCK_ASSERT(ipi) do { \
NET_ASSERT_GIANT(); \
} while (0)
#endif
#define INP_PCBHASH(faddr, lport, fport, mask) \
(((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask))