diff options
author | mvs <mvs@cvs.openbsd.org> | 2020-07-06 20:37:52 +0000 |
---|---|---|
committer | mvs <mvs@cvs.openbsd.org> | 2020-07-06 20:37:52 +0000 |
commit | efa5c8fd0130d682124e5b29408493892e55174b (patch) | |
tree | 302bfdf7e23c0a64ce7620b77e89b6cb2cc3aa90 /sys/net/pipex.c | |
parent | 2fcdd4f483874920dcc0a31eb37d9bd776a368c7 (diff) |
Protect the whole pipex(4) layer by NET_LOCK(). pipex(4) was
simultaneously protected by KERNEL_LOCK() and NET_LOCK() and now we have
the only lock for it. This step reduces locking mess in this layer.
ok mpi@
Diffstat (limited to 'sys/net/pipex.c')
-rw-r--r-- | sys/net/pipex.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/net/pipex.c b/sys/net/pipex.c index 48da59f377c..fb6ea9137ec 100644 --- a/sys/net/pipex.c +++ b/sys/net/pipex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pipex.c,v 1.118 2020/07/06 20:28:38 mvs Exp $ */ +/* $OpenBSD: pipex.c,v 1.119 2020/07/06 20:37:51 mvs Exp $ */ /*- * Copyright (c) 2009 Internet Initiative Japan Inc. @@ -869,6 +869,7 @@ pipex_output(struct mbuf *m0, int af, int off, struct ip ip; struct mbuf *mret; + NET_ASSERT_LOCKED(); session = NULL; mret = NULL; switch (af) { @@ -962,6 +963,8 @@ pipex_ppp_output(struct mbuf *m0, struct pipex_session *session, int proto) { u_char *cp, hdr[16]; + NET_ASSERT_LOCKED(); + #ifdef PIPEX_MPPE if (pipex_session_is_mppe_enabled(session)) { if (proto == PPP_IP) { @@ -1355,6 +1358,7 @@ pipex_pppoe_input(struct mbuf *m0, struct pipex_session *session) int hlen; struct pipex_pppoe_header pppoe; + NET_ASSERT_LOCKED(); /* already checked at pipex_pppoe_lookup_session */ KASSERT(m0->m_pkthdr.len >= (sizeof(struct ether_header) + sizeof(pppoe))); @@ -1586,6 +1590,7 @@ pipex_pptp_input(struct mbuf *m0, struct pipex_session *session) struct pipex_pptp_session *pptp_session; int rewind = 0; + NET_ASSERT_LOCKED(); KASSERT(m0->m_pkthdr.len >= PIPEX_IPGRE_HDRLEN); pptp_session = &session->proto.pptp; @@ -2031,6 +2036,7 @@ pipex_l2tp_input(struct mbuf *m0, int off0, struct pipex_session *session, uint16_t flags, ns = 0, nr = 0; int rewind = 0; + NET_ASSERT_LOCKED(); length = offset = ns = nr = 0; l2tp_session = &session->proto.l2tp; l2tp_session->ipsecflowinfo = ipsecflowinfo; |