Age | Commit message (Collapse) | Author |
|
ok mvs
|
|
of updating it blindly.
ok mvs
|
|
|
|
`pipex_session_list' foreach walkthrough with `pipex_list_mtx' mutex(9)
relocking. It inserts special item after acquired `session' and keeps it
linked until `session' release. Only owner can unlink it's own item, so
the LIST_NEXT(session) is always valid even the `session' was unlinked.
The iterator skips special items at the `session' acquisition time, as
all other foreach loops where `pipex_list_mtx' mutex(9) is not relocked.
ok yasuoka
|
|
ok yasuoka
|
|
handler out of kernel lock.
ok bluhm
|
|
rip6_output() did modify inp_outputopts6 temporarily to provide
different ip6_pktopts to in6_embedscope(). Better pass inp_outputopts6
and inp_moptions6 as separate arguments to in6_embedscope().
Simplify the code that deals with these options in in6_embedscope().
Doucument inp_moptions and inp_moptions6 as protected by net lock.
OK kn@
|
|
Using a scratch buffer makes it possible to take a consistent snapshot of
per-CPU counters without having to allocate memory.
Makes ddb(4) show uvmexp command work in OOM situations.
ok kn@, mvs@, cheloha@
|
|
Reported-by: syzbot+2eca95b271d07ab91b43@syzkaller.appspotmail.com
tested yasuoka@; OK mvs@ yasuoka@
|
|
We don't use "static" keyword for functions declaration to allow ddb(4)
debug. Also, many "Static" functions are called by pppx(4) layer outside
pipex(4) layer.
This is the mostly mechanic diff, except the `pipex_pppoe_padding' which
should be "static const".
ok bluhm@ yasuoka@
|
|
mutex(9) to protect session context. Except MPPE encryption, PPPOE
sessions are mostly immutable, so no lock required for that case.
Global pipex(4) data is already protected by `pipex_list_mtx' mutex(9),
so pipex(4) doesn't rely on netlock anymore.
Recursion was removed from pipex_mppe_input() and pipex_mppe_output().
ok bluhm@
|
|
Long time ago pipex(4) session can't be deleted until both pipex(4)
input and output queues become empty. Dead sessions were linked to the
stack and the `ip_forward' flag was used to prevent packets forwarding.
npppd(8) marked such sessions by doing PIPEXCSESSION ioctl(2) call.
But since we started to unlink close session from the stack, this logic
became unnecessary. Also pipex(4) session could be closed just after
close request.
npppd(8) was the only userland program which did PIPEXCSESSION ioctl(2)
call, and we removed it week ago. It's time to remove the remains.
Now the `flags' member of 'pipex_session' structure became immutable.
ok yasuoka@
|
|
pipex_ip_output(). The all sessions loop was reworked to make possible
to drop the lock within.
ok bluhm@ yasuoka@.
|
|
Also remove unneeded includes of <sys/poll.h> and <sys/select.h>.
Some addenda from jsg@.
OK miod@ mpi@
|
|
PPPOE packets within. Do (*if_output)() calls within netisr handler with
netlock held.
We can't predict netlock state when pipex(4) related (*if_qstart)()
handlers called. This means we can't use netlock within pppac_qstart()
and pppx_if_qstart() handlers.
ok bluhm@
|
|
(*if_qstart)() and we don't worry it's not serialized with the rest of
output path. Also we will process already enqueued pipex(4) packets
regardless on `pipex_enable' state.
Use the local copy of `pipex_enable' within pppx_if_output(), otherwise we
loose consistency.
pointed and ok by bluhm@
|
|
processing path. Such sessions already reached time to live timeout, and
the garbage collector waits a little to before kill them. Otherwise we
could make session's life time more then PIPEX_CLOSE_TIMEOUT.
ok bluhm@
|
|
|
|
(*if_qstart)() be always called with netlock held doesn't work anymore
with PPPOE sessions.
Introduce `pipex_list_mtx' mutex(9) and use it to protect global pipex(4)
lists and radix trees.
Protect pipex(4) `session' dereference with reference counters, because we
could sleep when accessing pipex(4) from ioctl(2) path, and this is not
possible with mutex(9) held.
ok bluhm@
|
|
which represent flags. We mix unlocked access to immutable flags with
protected access to mutable ones. This could be not MP independent on
some architectures, so convert these fields to u_int `flags' variables.
ok bluhm@
|
|
ok jmc@ reads ok tb@
|
|
With bluhm@'s diff for parallel forwarding pipex(4) could be accessed in
parallel through (*ifp->if_input)() -> ether_input() ->
pipex_pppoe_input(). PPPOE pipex(4) sessions are mostly immutable except
MPPE crypt.
The new per-session `pxs_mtx' mutex(9) used to protect session's
`ccp-id' which is incremented each time we send CCP reset-request.
The new `pxm_mtx' mutex(9) used to protect MPPE context. Each pipex(4)
session has two of them: one for the input and one for output path.
Where is no lock order limitations because those new mutex(9)'es never
held together.
ok bluhm@
|
|
more compliant to bluhm@'s work on traffic forwarding parallelization.
ok yasuoka@ bluhm@
|
|
PACKET_TAG_IPSEC_FLOWINFO to specify the IPsec flow.
ok mvs
|
|
ok gnezdo@ semarie@ mpi@
|
|
the first cut of this diff was made with coccinelle using this spatch:
@rule@
type caddr_t;
expression m, off, len, cp;
@@
-m_copydata(m, off, len, (caddr_t)cp)
+m_copydata(m, off, len, cp)
i had fix it's opinionated idea of formatting by hand though, so
i'm not sure it was worth it.
ok deraadt@ bluhm@
|
|
ok dlg@
|
|
OK millert@
|
|
and were kept only for backward compatibility reasons.
ok mpi@ yasuoka@
|
|
ok yasuoka@
|
|
pipex(4) layer this `ifnet' still uses `if_data'. Also pppx(4) doesn't
use per cpu counters but `if_data'.
Add per cpu counters to pppx(4) and pipex(4). This finishes interface
statistics collecting mess.
ok yasuoka@
|
|
pipex_iface of struct pipex_session with owner_sc which refers the
owner device. This makes ioctl commands for pppac or pppx device
simpler. PIPEX{S,G}MODE became dummy since both pppac and pppx is
always used with pipex. Also move some pppac specific things to the
pppac part on if_pppx.c.
suggestions from mvs, ok mvs
|
|
count them because `if_snd' does this.
ok yasuoka@
|
|
related mbufs. Each mbuf(9) passed to these queues stores the pointer to
corresponding pipex(4) session referenced as `m_pkthdr.ph_cookie'. When
session was destroyed its reference can still be in these queues so we
have use after free issue while pipexintr() dereference it.
I removed `pipexinq', `pipexoutq' and pipexintr(). This not only allows
us to avoid issue described above, but also removes unnecessary context
switch in packet processing. Also it makes code simpler.
ok mpi@ yasuoka@
|
|
as signed. u_int used within pipex(4) for consistency with other code.
ok dlg@ mpi@
|
|
ok mpi@
|
|
within pipex(4) layer.
ok mpi@
|
|
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@
|
|
pipex_destroy_session() instead of pool_put(9) to prevent memory leak.
ok mpi@
|
|
ok deraadt yasuoka
|
|
sessions by pipex_iface_fini() or by pipex_ioctl() with `PIPEXSMODE' command.
ok yasuoka@
|
|
listed below.
- pipex_init_session() to check request and alloc new session.
- pipex_link_session() to link session to pipex(4) layer.
- pipex_unlink_session() to unlink session from pipex(4) layer.
- pipex_rele_session() to release session and it's internal allocation.
ok mpi@
|
|
pipex output is part of pppx and pppac if_start functions, so it
can't rely on or know if it already has NET_LOCK. this defers the
ip output stuff to where it can take the NET_LOCK reliably.
tested by Vitaliy Makkoveev, who also found that this was necessary
after ifq.c 1.38 and provided an excellent analysis of the problem.
ok mpi@
|
|
From Vitaliy Makkoveev
OK yasuoka@
|
|
From Vitaliy Makkoveev
|
|
This way pppx(4) and pppac(4) can be further unified. This is an
intermediary step that does not introduce any behaviour change.
From Vitaliy Makkoveev
|
|
Issue reported by and fix from Vitaliy Makkoveev.
|
|
This makes a pattern emerge that should help when starting to protect
the global `session' list with something else than the KERNEL_LOCK().
from Vitaliy Makkoveev.
|
|
This function calls pipex_destroy_session() which requires the lock and
pipex_ioctl() already calls it with the NET_LOCK() held.
From Vitaliy Makkoveev.
|
|
C99 inline semantics resulted in undefined symbols.
OK deraadt@ mpi@ dlg@
|