History log of /src/sys/net/raw_usrreq.c |
Revision | | Date | Author | Comments |
1.66 |
| 05-Jul-2024 |
rin | sys: Drop redundant NULL check before m_freem(9)
m_freem(9) safely has accepted NULL argument at least since 4.2BSD: https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/sys/uipc_mbuf.c
Compile-tested on amd64/ALL.
Suggested by knakahara@
|
1.65 |
| 02-Sep-2022 |
thorpej | branches: 1.65.10; Remove unnecessary inclusion of <net/netisr.h>.
|
1.64 |
| 02-Aug-2019 |
ozaki-r | Fix typo (s/m_free/m_freem/) (one more)
|
1.63 |
| 02-Aug-2019 |
ozaki-r | Fix typo (s/m_free/m_freem/)
This fixes PR kern/54419 "mbuf leak when deleting route" from sc dying.
|
1.62 |
| 07-Sep-2018 |
maxv | branches: 1.62.4; Make raw_input non-variadic.
|
1.61 |
| 09-May-2018 |
maxv | branches: 1.61.2; Replace m_copym(m, 0, M_COPYALL, M_DONTWAIT) by m_copypacket(m, M_DONTWAIT) when it is clear that we are copying a packet (that has M_PKTHDR) and not a raw mbuf chain.
|
1.60 |
| 26-Apr-2018 |
maxv | m_copy -> m_copym
|
1.59 |
| 19-Mar-2018 |
roy | socket: report receive buffer overflows
Add soroverflow() which increments the overflow counter, sets so_error to ENOBUFS and wakes the receive socket up. Replace all code that manually increments this counter with soroverflow(). Add soroverflow() to raw_input().
This allows userland to detect route(4) overflows so it can re-sync with the current state.
|
1.58 |
| 25-Sep-2017 |
ozaki-r | branches: 1.58.2; Use a dedicated mutex for rt_rawcb instead of softnet_lock if NET_MPSAFE
|
1.57 |
| 25-Sep-2017 |
ozaki-r | Fix race condition on the rawcb list shared by rtsock and keysock
keysock now protects itself by its own mutex, which means that the rawcb list is protected by two different mutexes (keysock's one and softnet_lock for rtsock), of course it's useless.
Fix the situation by having a discrete rawcb list for each.
|
1.56 |
| 11-Apr-2017 |
roy | branches: 1.56.4; Add RO_MSGFILTER socket option to PF_ROUTE to filter out un-wanted route(4) messages.
Inspired by the ROUTE_MSGFILTER equivalent in OpenBSD, but with an API which allows the full range of potential message types.
|
1.55 |
| 20-Jan-2016 |
riastradh | branches: 1.55.2; 1.55.4; Eliminate struct protosw::pr_output.
You can't use this unless you know what it is a priori: the formal prototype is variadic, and the different instances (e.g., ip_output, route_output) have different real prototypes.
Convert the only user of it, raw_send in net/raw_cb.c, to take an explicit callback argument. Convert the only instances of it, route_output and key_output, to such explicit callbacks for raw_send. Use assertions to make sure the conversion to explicit callbacks is warranted.
Discussed on tech-net with no objections: https://mail-index.netbsd.org/tech-net/2016/01/16/msg005484.html
|
1.54 |
| 02-May-2015 |
rtr | make connect syscall use sockaddr_big and modify pr_{send,connect} nam parameter type from buf * to sockaddr *.
final commit for parameter type changes to protocol user requests
* bump kernel version to 7.99.15 for parameter type changes to pr_{send,connect}
|
1.53 |
| 24-Apr-2015 |
rtr | make accept, getsockname and getpeername syscalls use sockaddr_big and modify pr_{accept,sockname,peername} nam parameter type from mbuf * to sockaddr *.
* retained use of mbuftypes[MT_SONAME] for now. * bump to netbsd version 7.99.12 for parameter type change.
patch posted to tech-net@ 2015/04/19
|
1.52 |
| 09-Aug-2014 |
rtr | branches: 1.52.4; split PRU_CONNECT2 & PRU_PURGEIF function out of pr_generic() usrreq switches and put into separate functions
- always KASSERT(solocked(so)) even if not implemented (for PRU_CONNECT2 only)
- replace calls to pr_generic() with req = PRU_CONNECT2 with calls to pr_connect2()
- replace calls to pr_generic() with req = PRU_PURGEIF with calls to pr_purgeif()
put common code from unp_connect2() (used by unp_connect() into unp_connect1() and call out to it when needed
patch only briefly reviewed by rmind@
|
1.51 |
| 08-Aug-2014 |
rtr | split PRU_RCVD function out of pr_generic() usrreq switches and put into separate functions
- always KASSERT(solocked(so)) even if not implemented
- replace calls to pr_generic() with req = PRU_RCVD with calls to pr_rcvd()
|
1.50 |
| 05-Aug-2014 |
rtr | split PRU_SEND function out of pr_generic() usrreq switches and put into separate functions
xxx_send(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *)
- always KASSERT(solocked(so)) even if not implemented
- replace calls to pr_generic() with req = PRU_SEND with calls to pr_send()
rename existing functions that operate on PCB for consistency (and to free up their names for xxx_send() PRUs
- l2cap_send() -> l2cap_send_pcb() - sco_send() -> sco_send_pcb() - rfcomm_send() -> rfcomm_send_pcb()
patch reviewed by rmind
|
1.49 |
| 05-Aug-2014 |
rtr | revert the removal of struct lwp * parameter from bind, listen and connect user requests.
this should resolve the issue relating to nfs client hangs presented recently by wiz on current-users@
|
1.48 |
| 31-Jul-2014 |
rtr | fix missed conversion to call to pr_connect() from pr_generic() when PRU_CONNECT split was done.
- error = (*so->so_proto->pr_usrreqs->pr_generic)(so, - PRU_CONNECT, NULL, nam, NULL, l); + error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam);
without this change KASSERT() would be triggered if raw send needs to perform a connect.
|
1.47 |
| 31-Jul-2014 |
rtr | split PRU_DISCONNECT, PRU_SHUTDOWN and PRU_ABORT function out of pr_generic() usrreq switches and put into separate functions
xxx_disconnect(struct socket *) xxx_shutdown(struct socket *) xxx_abort(struct socket *)
- always KASSERT(solocked(so)) even if not implemented - replace calls to pr_generic() with req = PRU_{DISCONNECT,SHUTDOWN,ABORT} with calls to pr_{disconnect,shutdown,abort}() respectively
rename existing internal functions used to implement above functionality to permit use of the names for xxx_{disconnect,shutdown,abort}().
- {l2cap,sco,rfcomm}_disconnect() -> {l2cap,sco,rfcomm}_disconnect_pcb() - {unp,rip,tcp}_disconnect() -> {unp,rip,tcp}_disconnect1() - unp_shutdown() -> unp_shutdown1()
patch reviewed by rmind
|
1.46 |
| 30-Jul-2014 |
rtr | split PRU_CONNECT function out of pr_generic() usrreq switches and put into seaparate functions
xxx_listen(struct socket *, struct mbuf *)
- always KASSERT(solocked(so)) and KASSERT(nam != NULL) - replace calls to pr_generic() with req = PRU_CONNECT with pr_connect() - rename existin {l2cap,sco,rfcomm}_connect() to {l2cap,sco,rfcomm}_connect_pcb() respectively to permit naming consistency with other protocols functions. - drop struct lwp * parameter from unp_connect() and at_pcbconnect() and use curlwp instead where appropriate.
patch reviewed by rmind
|
1.45 |
| 24-Jul-2014 |
rtr | split PRU_BIND and PRU_LISTEN function out of pr_generic() usrreq switches and put into separate functions xxx_bind(struct socket *, struct mbuf *) xxx_listen(struct socket *)
- always KASSERT(solocked(so)) even if not implemented
- replace calls to pr_generic() with req = PRU_BIND with call to pr_bind()
- replace calls to pr_generic() with req = PRU_LISTEN with call to pr_listen()
- drop struct lwp * parameter from at_pcbsetaddr(), in_pcbbind() and unp_bind() and always use curlwp.
rename existing functions that operate on PCB for consistency (and to free up their names for xxx_{bind,listen}() PRUs
- l2cap_{bind,listen}() -> l2cap_{bind,listen}_pcb() - sco_{bind,listen}() -> sco_{bind,listen}_pcb() - rfcomm_{bind,listen}() -> rfcomm_{bind,listen}_pcb()
patch reviewed by rmind
welcome to netbsd 6.99.48
|
1.44 |
| 23-Jul-2014 |
rtr | split PRU_SENDOOB and PRU_RCVOOB function out of pr_generic() usrreq switches and put into separate functions xxx_sendoob(struct socket *, struct mbuf *, struct mbuf *) xxx_recvoob(struct socket *, struct mbuf *, int)
- always KASSERT(solocked(so)) even if request is not implemented
- replace calls to pr_generic() with req = PRU_{SEND,RCV}OOB with calls to pr_{send,recv}oob() respectively.
there is still some tweaking of m_freem(m) and m_freem(control) to come for consistency. not performed with this commit for clarity.
reviewed by rmind
|
1.43 |
| 09-Jul-2014 |
rtr | * split PRU_ACCEPT function out of pr_generic() usrreq switches and put into a separate function xxx_accept(struct socket *, struct mbuf *)
note: future cleanup will take place to remove struct mbuf parameter type and replace it with a more appropriate type.
patch reviewed by rmind
|
1.42 |
| 09-Jul-2014 |
rtr | * split PRU_PEERADDR and PRU_SOCKADDR function out of pr_generic() usrreq switches and put into separate functions xxx_{peer,sock}addr(struct socket *, struct mbuf *).
- KASSERT(solocked(so)) always in new functions even if request is not implemented
- KASSERT(pcb != NULL) and KASSERT(nam) if the request is implemented and not for tcp.
* for tcp roll #ifdef KPROF and #ifdef DEBUG code from tcp_usrreq() into easier to cut & paste functions tcp_debug_capture() and tcp_debug_trace()
- functions provided by rmind - remaining use of PRU_{PEER,SOCK}ADDR #define to be removed in a future commit.
* rename netbt functions to permit consistency of pru function names (as has been done with other requests already split out).
- l2cap_{peer,sock}addr() -> l2cap_{peer,sock}_addr_pcb() - rfcomm_{peer,sock}addr() -> rfcomm_{peer,sock}_addr_pcb() - sco_{peer,sock}addr() -> sco_{peer,sock}_addr_pcb()
* split/refactor do_sys_getsockname(lwp, fd, which, nam) into two functions do_sys_get{peer,sock}name(fd, nam).
- move PRU_PEERADDR handling into do_sys_getpeername() from do_sys_getsockname() - have svr4_stream directly call do_sys_get{sock,peer}name() respectively instead of providing `which' & fix a DPRINTF string that incorrectly wrote "getpeername" when it meant "getsockname" - fix sys_getpeername() and sys_getsockname() to call do_sys_get{sock,peer}name() without `which' and `lwp' & adjust comments - bump kernel version for removal of lwp & which parameters from do_sys_getsockname()
note: future cleanup to remove struct mbuf * abuse in xxx_{peer,sock}name() still to come, not done in this commit since it is easier to do post split.
patch reviewed by rmind
welcome to 6.99.47
|
1.41 |
| 06-Jul-2014 |
rtr | * split PRU_SENSE functionality out of xxx_usrreq() switches and place into separate xxx_stat(struct socket *, struct stat *) functions. * replace calls using pr_generic with req == PRU_SENSE with pr_stat().
further change will follow that cleans up the pattern used to extract the pcb and test for its presence.
reviewed by rmind
|
1.40 |
| 22-Jun-2014 |
rtr | * split PRU_CONTROL functionality out of xxx_userreq() switches and place into separate xxx_ioctl() functions. * place KASSERT(req != PRU_CONTROL) inside xxx_userreq() as it is now inappropriate for req = PRU_CONTROL in xxx_userreq(). * replace calls to pr_generic() with req = PRU_CONTROL with pr_ioctl(). * remove & fixup references to PRU_CONTROL xxx_userreq() function comments. * fix various comments references for xxx_userreq() that mentioned PRU_CONTROL as xxx_userreq() no longer handles the request.
a further change will follow to fix parameter and naming inconsistencies retained from original code.
Reviewed by rmind@
|
1.39 |
| 19-May-2014 |
rmind | - Split off PRU_ATTACH and PRU_DETACH logic into separate functions. - Replace malloc with kmem and eliminate M_PCB while here. - Sprinkle more asserts.
|
1.38 |
| 18-May-2014 |
rmind | Add struct pr_usrreqs with a pr_generic function and prepare for the dismantling of pr_usrreq in the protocols; no functional change intended. PRU_ATTACH/PRU_DETACH changes will follow soon.
Bump for struct protosw. Welcome to 6.99.62!
|
1.37 |
| 17-Jul-2011 |
joerg | branches: 1.37.12; 1.37.16; 1.37.26; Retire varargs.h support. Move machine/stdarg.h logic into MI sys/stdarg.h and expect compiler to provide proper builtins, defaulting to the GCC interface. lint still has a special fallback. Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and derive va_list as required by standards.
|
1.36 |
| 11-Jan-2011 |
pooka | Apply patch from PR kern/44369 by Wolfgang Stukenbrock.
|
1.35 |
| 29-May-2008 |
dyoung | branches: 1.35.8; 1.35.14; 1.35.20; 1.35.22; Delete local variable 'sockets', whose value is never used. Reported by J.T. Conklin.
|
1.34 |
| 24-Apr-2008 |
ad | branches: 1.34.2; 1.34.4; Merge the socket locking patch:
- Socket layer becomes MP safe. - Unix protocols become MP safe. - Allows protocol processing interrupts to safely block on locks. - Fixes a number of race conditions.
With much feedback from matt@ and plunky@.
|
1.33 |
| 06-May-2007 |
dyoung | branches: 1.33.28; 1.33.30; Cosmetic: make the macro 'equal' into an inline subroutine, bcmp -> memcmp, bcopy -> memcpy, 0 -> NULL, shorten staircases, remove needless cast to int.
|
1.32 |
| 04-Mar-2007 |
christos | branches: 1.32.2; 1.32.4; Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
|
1.31 |
| 17-Feb-2007 |
dyoung | KNF: de-__P, bzero -> memset, bcmp -> memcmp. Remove extraneous parentheses in return statements.
Cosmetic: don't open-code TAILQ_FOREACH().
Cosmetic: change types of variables to avoid oodles of casts: in in6_src.c, avoid casts by changing several route_in6 pointers to struct route pointers. Remove unnecessary casts to caddr_t elsewhere.
Pave the way for eliminating address family-specific route caches: soon, struct route will not embed a sockaddr, but it will hold a reference to an external sockaddr, instead. We will set the destination sockaddr using rtcache_setdst(). (I created a stub for it, but it isn't used anywhere, yet.) rtcache_free() will free the sockaddr. I have extracted from rtcache_free() a helper subroutine, rtcache_clear(). rtcache_clear() will "forget" a cached route, but it will not forget the destination by releasing the sockaddr. I use rtcache_clear() instead of rtcache_free() in rtcache_update(), because rtcache_update() is not supposed to forget the destination.
Constify:
1 Introduce const accessor for route->ro_dst, rtcache_getdst().
2 Constify the 'dst' argument to ifnet->if_output(). This led me to constify a lot of code called by output routines.
3 Constify the sockaddr argument to protosw->pr_ctlinput. This led me to constify a lot of code called by ctlinput routines.
4 Introduce const macros for converting from a generic sockaddr to family-specific sockaddrs, e.g., sockaddr_in: satocsin6, satocsin, et cetera.
|
1.30 |
| 16-Nov-2006 |
christos | branches: 1.30.4; __unused removal on arguments; approved by core.
|
1.29 |
| 25-Oct-2006 |
elad | Introduce KAUTH_REQ_NETWORK_SOCKET_OPEN, to check if opening a socket is allowed. It takes three int * arguments indicating domain, type, and protocol. Replace previous KAUTH_REQ_NETWORK_SOCKET_RAWSOCK with it (but keep it still).
Places that used to explicitly check for privileged context now don't need it anymore, so I replaced these with XXX comment indiacting it for future reference.
Documented and updated examples as well.
|
1.28 |
| 12-Oct-2006 |
christos | - sprinkle __unused on function decls. - fix a couple of unused bugs - no more -Wno-unused for i386
|
1.27 |
| 23-Jul-2006 |
ad | branches: 1.27.4; 1.27.6; Use the LWP cached credentials where sane.
|
1.26 |
| 14-May-2006 |
elad | integrate kauth.
|
1.25 |
| 11-Dec-2005 |
thorpej | branches: 1.25.4; 1.25.6; 1.25.8; 1.25.10; 1.25.12; ANSI function decls and application of static.
|
1.24 |
| 11-Dec-2005 |
christos | merge ktrace-lwp.
|
1.23 |
| 26-Feb-2005 |
perry | branches: 1.23.4; nuke trailing whitespace
|
1.22 |
| 26-Apr-2004 |
matt | branches: 1.22.4; 1.22.6; Remove #else of #if __STDC__
|
1.21 |
| 30-Sep-2003 |
christos | Fix off-by-one in PRC_NCMDS check. From FreeBSD via OpenBSD
|
1.20 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
|
1.19 |
| 29-Jun-2003 |
fvdl | branches: 1.19.2; Back out the lwp/ktrace changes. They contained a lot of colateral damage, and need to be examined and discussed more.
|
1.18 |
| 28-Jun-2003 |
darrenr | Pass lwp pointers throughtout the kernel, as required, so that the lwpid can be inserted into ktrace records. The general change has been to replace "struct proc *" with "struct lwp *" in various function prototypes, pass the lwp through and use l_proc to get the process pointer when needed.
Bump the kernel rev up to 1.6V
|
1.17 |
| 12-Nov-2001 |
lukem | add RCSIDs
|
1.16 |
| 05-Nov-2001 |
matt | Switch to using queue access macros instead of refering to the member fields explicitly.
|
1.15 |
| 30-Mar-2000 |
augustss | branches: 1.15.6; 1.15.8; 1.15.12; Kill some more register declarations.
|
1.14 |
| 28-May-1996 |
pk | branches: 1.14.28; Remove unused variable.
|
1.13 |
| 23-May-1996 |
mycroft | Fix race condition in PRU_DISCONNECT. Unimplement PRU_ABORT, as it's not needed and wasn't correct. Some stylistic cleanup. Make sure the control mbufs are freed in all cases. We must indirect through the higher-level protocol for PRU_{BIND,CONNECT} so that it can check the sockaddr.
|
1.12 |
| 22-May-1996 |
mycroft | Pass a proc pointer down to the usrreq and pcbbind functions for PRU_ATTACH, PRU_BIND and PRU_CONTROL. The usrreq interface really needs to be split up, but this will have to wait. Remove SS_PRIV completely.
|
1.11 |
| 13-Feb-1996 |
christos | branches: 1.11.4; Net prototypes
|
1.10 |
| 12-Jun-1995 |
mycroft | Various cleanup, including: * Convert several data structures to use queue.h. * Split in_pcbnotify() into two parts; one for notifying a specific PCB, and one for notifying all PCBs for a particular foreign address.
|
1.9 |
| 22-Apr-1995 |
cgd | quiet compiler warning via (ugly) cast
|
1.8 |
| 29-Jun-1994 |
cgd | New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
|
1.7 |
| 13-May-1994 |
mycroft | Update to 4.4-Lite networking code, with a few local changes.
|
1.6 |
| 16-Jan-1994 |
cgd | include <machine/cpu.h> not <machine/mtpr.h>
|
1.5 |
| 06-Jan-1994 |
deraadt | don't need to #include <sys/socket.h> twice.
|
1.4 |
| 18-Dec-1993 |
mycroft | Canonicalize all #includes.
|
1.3 |
| 22-May-1993 |
cgd | branches: 1.3.4; add include of select.h if necessary for protos, or delete if extraneous
|
1.2 |
| 18-May-1993 |
cgd | make kernel select interface be one-stop shopping & clean it all up.
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.2 |
| 01-Mar-1998 |
fvdl | Import 4.4BSD-Lite for reference
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.3.4.2 |
| 14-Nov-1993 |
mycroft | Canonicalize all #includes.
|
1.3.4.1 |
| 16-Oct-1993 |
mycroft | Nuke references to machine/mtpr.h.
|
1.11.4.1 |
| 11-Dec-1996 |
mycroft | From trunk: Eliminate SS_PRIV; instead, pass down a proc pointer to the usrreq methods that need it. Fix numerous memory leaks and bogus return values.
|
1.14.28.1 |
| 20-Nov-2000 |
bouyer | Update thorpej_scsipi to -current as of a month ago
|
1.15.12.1 |
| 12-Nov-2001 |
thorpej | Sync the thorpej-mips-cache branch with -current.
|
1.15.8.1 |
| 10-Jan-2002 |
thorpej | Sync kqueue branch with -current.
|
1.15.6.1 |
| 14-Nov-2001 |
nathanw | Catch up to -current.
|
1.19.2.5 |
| 04-Mar-2005 |
skrll | Sync with HEAD.
Hi Perry!
|
1.19.2.4 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.19.2.3 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.19.2.2 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.19.2.1 |
| 02-Jul-2003 |
darrenr | Apply the aborted ktrace-lwp changes to a specific branch. This is just for others to review, I'm concerned that patch fuziness may have resulted in some errant code being generated but I'll look at that later by comparing the diff from the base to the branch with the file I attempt to apply to it. This will, at the very least, put the changes in a better context for others to review them and attempt to tinker with removing passing of 'struct lwp' through the kernel.
|
1.22.6.1 |
| 19-Mar-2005 |
yamt | sync with head. xen and whitespace. xen part is not finished.
|
1.22.4.1 |
| 29-Apr-2005 |
kent | sync with -current
|
1.23.4.4 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.23.4.3 |
| 26-Feb-2007 |
yamt | sync with head.
|
1.23.4.2 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.23.4.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.25.12.1 |
| 24-May-2006 |
tron | Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
|
1.25.10.3 |
| 06-May-2006 |
christos | - Move kauth_cred_t declaration to <sys/types.h> - Cleanup struct ucred; forward declarations that are unused. - Don't include <sys/kauth.h> in any header, but include it in the c files that need it.
Approved by core.
|
1.25.10.2 |
| 10-Mar-2006 |
elad | generic_authorize() -> kauth_authorize_generic().
|
1.25.10.1 |
| 08-Mar-2006 |
elad | Adapt to kernel authorization KPI.
|
1.25.8.2 |
| 11-Aug-2006 |
yamt | sync with head
|
1.25.8.1 |
| 24-May-2006 |
yamt | sync with head.
|
1.25.6.1 |
| 01-Jun-2006 |
kardel | Sync with head.
|
1.25.4.1 |
| 09-Sep-2006 |
rpaulo | sync with head
|
1.27.6.2 |
| 10-Dec-2006 |
yamt | sync with head.
|
1.27.6.1 |
| 22-Oct-2006 |
yamt | sync with head
|
1.27.4.1 |
| 18-Nov-2006 |
ad | Sync with head.
|
1.30.4.3 |
| 07-May-2007 |
yamt | sync with head.
|
1.30.4.2 |
| 12-Mar-2007 |
rmind | Sync with HEAD.
|
1.30.4.1 |
| 27-Feb-2007 |
yamt | - sync with head. - move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
|
1.32.4.1 |
| 11-Jul-2007 |
mjf | Sync with head.
|
1.32.2.1 |
| 08-Jun-2007 |
ad | Sync with head.
|
1.33.30.2 |
| 04-Jun-2008 |
yamt | sync with head
|
1.33.30.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.33.28.1 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.34.4.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.34.2.1 |
| 04-May-2009 |
yamt | sync with head.
|
1.35.22.1 |
| 16-Jan-2011 |
bouyer | Pull up following revision(s) (requested by pooka in ticket #1529): sys/net/raw_usrreq.c: revision 1.36 Apply patch from PR kern/44369 by Wolfgang Stukenbrock.
|
1.35.20.1 |
| 05-Mar-2011 |
rmind | sync with head
|
1.35.14.1 |
| 16-Jan-2011 |
bouyer | Pull up following revision(s) (requested by pooka in ticket #1529): sys/net/raw_usrreq.c: revision 1.36 Apply patch from PR kern/44369 by Wolfgang Stukenbrock.
|
1.35.8.1 |
| 16-Jan-2011 |
bouyer | Pull up following revision(s) (requested by pooka in ticket #1529): sys/net/raw_usrreq.c: revision 1.36 Apply patch from PR kern/44369 by Wolfgang Stukenbrock.
|
1.37.26.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.37.16.1 |
| 28-Aug-2013 |
rmind | Checkpoint work in progress: - Initial split of the protocol user-request method into the following methods: pr_attach, pr_detach and pr_generic for old the pr_usrreq. - Adjust socreate(9) and sonewconn(9) to call pr_attach without the socket lock held (as a preparation for the locking scheme adjustment). - Adjust all pr_attach routines to assert that PCB is not set. - Sprinkle various comments, document some routines and their locking. - Remove M_PCB, replace with kmem(9). - Fix few bugs spotted on the way.
|
1.37.12.2 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.37.12.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.52.4.3 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.52.4.2 |
| 19-Mar-2016 |
skrll | Sync with HEAD
|
1.52.4.1 |
| 06-Jun-2015 |
skrll | Sync with HEAD
|
1.55.4.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.55.2.1 |
| 26-Apr-2017 |
pgoyette | Sync with HEAD
|
1.56.4.3 |
| 04-Aug-2019 |
martin | Pull up following revision(s) (requested by ozaki-r in ticket #1318):
sys/net/raw_usrreq.c: revision 1.63 sys/net/raw_usrreq.c: revision 1.64
Fix typo (s/m_free/m_freem/) This fixes PR kern/54419 "mbuf leak when deleting route" from sc dying.
-
Fix typo (s/m_free/m_freem/) (one more)
|
1.56.4.2 |
| 09-Apr-2018 |
bouyer | Pull up following revision(s) (requested by roy in ticket #724): tests/net/icmp/t_ping.c: revision 1.19 sys/netinet6/raw_ip6.c: revision 1.166 sys/netinet6/ip6_input.c: revision 1.195 sys/net/raw_usrreq.c: revision 1.59 sys/sys/socketvar.h: revision 1.151 sys/kern/uipc_socket2.c: revision 1.128 tests/lib/libc/sys/t_recvmmsg.c: revision 1.2 lib/libc/sys/recv.2: revision 1.38 sys/net/rtsock.c: revision 1.239 sys/netinet/udp_usrreq.c: revision 1.246 sys/netinet6/icmp6.c: revision 1.224 tests/net/icmp/t_ping.c: revision 1.20 sys/netipsec/keysock.c: revision 1.63 sys/netinet/raw_ip.c: revision 1.172 sys/kern/uipc_socket.c: revision 1.260 tests/net/icmp/t_ping.c: revision 1.22 sys/kern/uipc_socket.c: revision 1.261 tests/net/icmp/t_ping.c: revision 1.23 sys/netinet/ip_mroute.c: revision 1.155 sbin/route/route.c: revision 1.159 sys/netinet6/ip6_mroute.c: revision 1.123 sys/netatalk/ddp_input.c: revision 1.31 sys/netcan/can.c: revision 1.3 sys/kern/uipc_usrreq.c: revision 1.184 sys/netinet6/udp6_usrreq.c: revision 1.138 tests/net/icmp/t_ping.c: revision 1.18 socket: report receive buffer overflows Add soroverflow() which increments the overflow counter, sets so_error to ENOBUFS and wakes the receive socket up. Replace all code that manually increments this counter with soroverflow(). Add soroverflow() to raw_input(). This allows userland to detect route(4) overflows so it can re-sync with the current state. socket: clear error even when peeking The error has already been reported and it's pointless requiring another recv(2) call just to clear it. socket: remove now incorrect comment that so_error is only udp As it can be affected by route(4) sockets which are raw. rtsock: log dropped messages that we cannot report to userland Handle ENOBUFS when receiving messages. Don't send messages if the receiver has died. Sprinkle more soroverflow(). Handle ENOBUFS in recv Handle ENOBUFS in sendto Note value received. Harden another sendto for ENOBUFS. Handle the routing socket overflowing gracefully. Allow a valid sendto .... duh Handle errors better. Fix test for checking we sent all the data we asked to.
|
1.56.4.1 |
| 21-Oct-2017 |
snj | Pull up following revision(s) (requested by ozaki-r in ticket #300): crypto/dist/ipsec-tools/src/setkey/parse.y: 1.19 crypto/dist/ipsec-tools/src/setkey/token.l: 1.20 distrib/sets/lists/tests/mi: 1.754, 1.757, 1.759 doc/TODO.smpnet: 1.12-1.13 sys/net/pfkeyv2.h: 1.32 sys/net/raw_cb.c: 1.23-1.24, 1.28 sys/net/raw_cb.h: 1.28 sys/net/raw_usrreq.c: 1.57-1.58 sys/net/rtsock.c: 1.228-1.229 sys/netinet/in_proto.c: 1.125 sys/netinet/ip_input.c: 1.359-1.361 sys/netinet/tcp_input.c: 1.359-1.360 sys/netinet/tcp_output.c: 1.197 sys/netinet/tcp_var.h: 1.178 sys/netinet6/icmp6.c: 1.213 sys/netinet6/in6_proto.c: 1.119 sys/netinet6/ip6_forward.c: 1.88 sys/netinet6/ip6_input.c: 1.181-1.182 sys/netinet6/ip6_output.c: 1.193 sys/netinet6/ip6protosw.h: 1.26 sys/netipsec/ipsec.c: 1.100-1.122 sys/netipsec/ipsec.h: 1.51-1.61 sys/netipsec/ipsec6.h: 1.18-1.20 sys/netipsec/ipsec_input.c: 1.44-1.51 sys/netipsec/ipsec_netbsd.c: 1.41-1.45 sys/netipsec/ipsec_output.c: 1.49-1.64 sys/netipsec/ipsec_private.h: 1.5 sys/netipsec/key.c: 1.164-1.234 sys/netipsec/key.h: 1.20-1.32 sys/netipsec/key_debug.c: 1.18-1.21 sys/netipsec/key_debug.h: 1.9 sys/netipsec/keydb.h: 1.16-1.20 sys/netipsec/keysock.c: 1.59-1.62 sys/netipsec/keysock.h: 1.10 sys/netipsec/xform.h: 1.9-1.12 sys/netipsec/xform_ah.c: 1.55-1.74 sys/netipsec/xform_esp.c: 1.56-1.72 sys/netipsec/xform_ipcomp.c: 1.39-1.53 sys/netipsec/xform_ipip.c: 1.50-1.54 sys/netipsec/xform_tcp.c: 1.12-1.16 sys/rump/librump/rumpkern/Makefile.rumpkern: 1.170 sys/rump/librump/rumpnet/net_stub.c: 1.27 sys/sys/protosw.h: 1.67-1.68 tests/net/carp/t_basic.sh: 1.7 tests/net/if_gif/t_gif.sh: 1.11 tests/net/if_l2tp/t_l2tp.sh: 1.3 tests/net/ipsec/Makefile: 1.7-1.9 tests/net/ipsec/algorithms.sh: 1.5 tests/net/ipsec/common.sh: 1.4-1.6 tests/net/ipsec/t_ipsec_ah_keys.sh: 1.2 tests/net/ipsec/t_ipsec_esp_keys.sh: 1.2 tests/net/ipsec/t_ipsec_gif.sh: 1.6-1.7 tests/net/ipsec/t_ipsec_l2tp.sh: 1.6-1.7 tests/net/ipsec/t_ipsec_misc.sh: 1.8-1.18 tests/net/ipsec/t_ipsec_sockopt.sh: 1.1-1.2 tests/net/ipsec/t_ipsec_tcp.sh: 1.1-1.2 tests/net/ipsec/t_ipsec_transport.sh: 1.5-1.6 tests/net/ipsec/t_ipsec_tunnel.sh: 1.9 tests/net/ipsec/t_ipsec_tunnel_ipcomp.sh: 1.1-1.2 tests/net/ipsec/t_ipsec_tunnel_odd.sh: 1.3 tests/net/mcast/t_mcast.sh: 1.6 tests/net/net/t_ipaddress.sh: 1.11 tests/net/net_common.sh: 1.20 tests/net/npf/t_npf.sh: 1.3 tests/net/route/t_flags.sh: 1.20 tests/net/route/t_flags6.sh: 1.16 usr.bin/netstat/fast_ipsec.c: 1.22 Do m_pullup before mtod
It may fix panicks of some tests on anita/sparc and anita/GuruPlug. --- KNF --- Enable DEBUG for babylon5 --- Apply C99-style struct initialization to xformsw --- Tweak outputs of netstat -s for IPsec
- Get rid of "Fast" - Use ipsec and ipsec6 for titles to clarify protocol - Indent outputs of sub protocols
Original outputs were organized like this:
(Fast) IPsec: IPsec ah: IPsec esp: IPsec ipip: IPsec ipcomp: (Fast) IPsec: IPsec ah: IPsec esp: IPsec ipip: IPsec ipcomp:
New outputs are organized like this:
ipsec: ah: esp: ipip: ipcomp: ipsec6: ah: esp: ipip: ipcomp: --- Add test cases for IPComp --- Simplify IPSEC_OSTAT macro (NFC) --- KNF; replace leading whitespaces with hard tabs --- Introduce and use SADB_SASTATE_USABLE_P --- KNF --- Add update command for testing
Updating an SA (SADB_UPDATE) requires that a process issuing SADB_UPDATE is the same as a process issued SADB_ADD (or SADB_GETSPI). This means that update command must be used with add command in a configuration of setkey. This usage is normally meaningless but useful for testing (and debugging) purposes. --- Add test cases for updating SA/SP
The tests require newly-added udpate command of setkey. --- PR/52346: Frank Kardel: Fix checksumming for NAT-T See XXX for improvements. --- Remove codes for PACKET_TAG_IPSEC_IN_CRYPTO_DONE
It seems that PACKET_TAG_IPSEC_IN_CRYPTO_DONE is for network adapters that have IPsec accelerators; a driver sets the mtag to a packet when its device has already encrypted the packet.
Unfortunately no driver implements such offload features for long years and seems unlikely to implement them soon. (Note that neither FreeBSD nor Linux doesn't have such drivers.) Let's remove related (unused) codes and simplify the IPsec code. --- Fix usages of sadb_msg_errno --- Avoid updating sav directly
On SADB_UPDATE a target sav was updated directly, which was unsafe. Instead allocate another sav, copy variables of the old sav to the new one and replace the old one with the new one. --- Simplify; we can assume sav->tdb_xform cannot be NULL while it's valid --- Rename key_alloc* functions (NFC)
We shouldn't use the term "alloc" for functions that just look up data and actually don't allocate memory. --- Use explicit_memset to surely zero-clear key_auth and key_enc --- Make sure to clear keys on error paths of key_setsaval --- Add missing KEY_FREESAV --- Make sure a sav is inserted to a sah list after its initialization completes --- Remove unnecessary zero-clearing codes from key_setsaval
key_setsaval is now used only for a newly-allocated sav. (It was used to reset variables of an existing sav.) --- Correct wrong assumption of sav->refcnt in key_delsah
A sav in a list is basically not to be sav->refcnt == 0. And also KEY_FREESAV assumes sav->refcnt > 0. --- Let key_getsavbyspi take a reference of a returning sav --- Use time_mono_to_wall (NFC) --- Separate sending message routine (NFC) --- Simplify; remove unnecessary zero-clears
key_freesaval is used only when a target sav is being destroyed. --- Omit NULL checks for sav->lft_c
sav->lft_c can be NULL only when initializing or destroying sav. --- Omit unnecessary NULL checks for sav->sah --- Omit unnecessary check of sav->state
key_allocsa_policy picks a sav of either MATURE or DYING so we don't need to check its state again. --- Simplify; omit unnecessary saidx passing
- ipsec_nextisr returns a saidx but no caller uses it - key_checkrequest is passed a saidx but it can be gotton by another argument (isr) --- Fix splx isn't called on some error paths --- Fix header size calculation of esp where sav is NULL --- Fix header size calculation of ah in the case sav is NULL
This fix was also needed for esp. --- Pass sav directly to opencrypto callback
In a callback, use a passed sav as-is by default and look up a sav only if the passed sav is dead. --- Avoid examining freshness of sav on packet processing
If a sav list is sorted (by lft_c->sadb_lifetime_addtime) in advance, we don't need to examine each sav and also don't need to delete one on the fly and send up a message. Fortunately every sav lists are sorted as we need.
Added key_validate_savlist validates that each sav list is surely sorted (run only if DEBUG because it's not cheap). --- Add test cases for SAs with different SPIs --- Prepare to stop using isr->sav
isr is a shared resource and using isr->sav as a temporal storage for each packet processing is racy. And also having a reference from isr to sav makes the lifetime of sav non-deterministic; such a reference is removed when a packet is processed and isr->sav is overwritten by new one. Let's have a sav locally for each packet processing instead of using shared isr->sav.
However this change doesn't stop using isr->sav yet because there are some users of isr->sav. isr->sav will be removed after the users find a way to not use isr->sav. --- Fix wrong argument handling --- fix printf format. --- Don't validate sav lists of LARVAL or DEAD states
We don't sort the lists so the validation will always fail.
Fix PR kern/52405 --- Make sure to sort the list when changing the state by key_sa_chgstate --- Rename key_allocsa_policy to key_lookup_sa_bysaidx --- Separate test files --- Calculate ah_max_authsize on initialization as well as esp_max_ivlen --- Remove m_tag_find(PACKET_TAG_IPSEC_PENDING_TDB) because nobody sets the tag --- Restore a comment removed in previous
The comment is valid for the below code. --- Make tests more stable
sleep command seems to wait longer than expected on anita so use polling to wait for a state change. --- Add tests that explicitly delete SAs instead of waiting for expirations --- Remove invalid M_AUTHIPDGM check on ESP isr->sav
M_AUTHIPDGM flag is set to a mbuf in ah_input_cb. An sav of ESP can have AH authentication as sav->tdb_authalgxform. However, in that case esp_input and esp_input_cb are used to do ESP decryption and AH authentication and M_AUTHIPDGM never be set to a mbuf. So checking M_AUTHIPDGM of a mbuf on isr->sav of ESP is meaningless. --- Look up sav instead of relying on unstable sp->req->sav
This code is executed only in an error path so an additional lookup doesn't matter. --- Correct a comment --- Don't release sav if calling crypto_dispatch again --- Remove extra KEY_FREESAV from ipsec_process_done
It should be done by the caller. --- Don't bother the case of crp->crp_buf == NULL in callbacks --- Hold a reference to an SP during opencrypto processing
An SP has a list of isr (ipsecrequest) that represents a sequence of IPsec encryption/authentication processing. One isr corresponds to one opencrypto processing. The lifetime of an isr follows its SP.
We pass an isr to a callback function of opencrypto to continue to a next encryption/authentication processing. However nobody guaranteed that the isr wasn't freed, i.e., its SP wasn't destroyed.
In order to avoid such unexpected destruction of isr, hold a reference to its SP during opencrypto processing. --- Don't make SAs expired on tests that delete SAs explicitly --- Fix a debug message --- Dedup error paths (NFC) --- Use pool to allocate tdb_crypto
For ESP and AH, we need to allocate an extra variable space in addition to struct tdb_crypto. The fixed size of pool items may be larger than an actual requisite size of a buffer, but still the performance improvement by replacing malloc with pool wins. --- Don't use unstable isr->sav for header size calculations
We may need to optimize to not look up sav here for users that don't need to know an exact size of headers (e.g., TCP segmemt size caclulation). --- Don't use sp->req->sav when handling NAT-T ESP fragmentation
In order to do this we need to look up a sav however an additional look-up degrades performance. A sav is later looked up in ipsec4_process_packet so delay the fragmentation check until then to avoid an extra look-up. --- Don't use key_lookup_sp that depends on unstable sp->req->sav
It provided a fast look-up of SP. We will provide an alternative method in the future (after basic MP-ification finishes). --- Stop setting isr->sav on looking up sav in key_checkrequest --- Remove ipsecrequest#sav --- Stop setting mtag of PACKET_TAG_IPSEC_IN_DONE because there is no users anymore --- Skip ipsec_spi_*_*_preferred_new_timeout when running on qemu
Probably due to PR 43997 --- Add localcount to rump kernels --- Remove unused macro --- Fix key_getcomb_setlifetime
The fix adjusts a soft limit to be 80% of a corresponding hard limit.
I'm not sure the fix is really correct though, at least the original code is wrong. A passed comb is zero-cleared before calling key_getcomb_setlifetime, so comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100; is meaningless. --- Provide and apply key_sp_refcnt (NFC)
It simplifies further changes. --- Fix indentation
Pointed out by knakahara@ --- Use pslist(9) for sptree --- Don't acquire global locks for IPsec if NET_MPSAFE
Note that the change is just to make testing easy and IPsec isn't MP-safe yet. --- Let PF_KEY socks hold their own lock instead of softnet_lock
Operations on SAD and SPD are executed via PF_KEY socks. The operations include deletions of SAs and SPs that will use synchronization mechanisms such as pserialize_perform to wait for references to SAs and SPs to be released. It is known that using such mechanisms with holding softnet_lock causes a dead lock. We should avoid the situation. --- Make IPsec SPD MP-safe
We use localcount(9), not psref(9), to make the sptree and secpolicy (SP) entries MP-safe because SPs need to be referenced over opencrypto processing that executes a callback in a different context.
SPs on sockets aren't managed by the sptree and can be destroyed in softint. localcount_drain cannot be used in softint so we delay the destruction of such SPs to a thread context. To do so, a list to manage such SPs is added (key_socksplist) and key_timehandler_spd deletes dead SPs in the list.
For more details please read the locking notes in key.c.
Proposed on tech-kern@ and tech-net@ --- Fix updating ipsec_used
- key_update_used wasn't called in key_api_spddelete2 and key_api_spdflush - key_update_used wasn't called if an SP had been added/deleted but a reply to userland failed --- Fix updating ipsec_used; turn on when SPs on sockets are added --- Add missing IPsec policy checks to icmp6_rip6_input
icmp6_rip6_input is quite similar to rip6_input and the same checks exist in rip6_input. --- Add test cases for setsockopt(IP_IPSEC_POLICY) --- Don't use KEY_NEWSP for dummy SP entries
By the change KEY_NEWSP is now not called from softint anymore and we can use kmem_zalloc with KM_SLEEP for KEY_NEWSP. --- Comment out unused functions --- Add test cases that there are SPs but no relevant SAs --- Don't allow sav->lft_c to be NULL
lft_c of an sav that was created by SADB_GETSPI could be NULL. --- Clean up clunky eval strings
- Remove unnecessary \ at EOL - This allows to omit ; too - Remove unnecessary quotes for arguments of atf_set - Don't expand $DEBUG in eval - We expect it's expanded on execution
Suggested by kre@ --- Remove unnecessary KEY_FREESAV in an error path
sav should be freed (unreferenced) by the caller. --- Use pslist(9) for sahtree --- Use pslist(9) for sah->savtree --- Rename local variable newsah to sah
It may not be new. --- MP-ify SAD slightly
- Introduce key_sa_mtx and use it for some list operations - Use pserialize for some list iterations --- Introduce KEY_SA_UNREF and replace KEY_FREESAV with it where sav will never be actually freed in the future
KEY_SA_UNREF is still key_freesav so no functional change for now.
This change reduces diff of further changes. --- Remove out-of-date log output
Pointed out by riastradh@ --- Use KDASSERT instead of KASSERT for mutex_ownable
Because mutex_ownable is too heavy to run in a fast path even for DIAGNOSTIC + LOCKDEBUG.
Suggested by riastradh@ --- Assemble global lists and related locks into cache lines (NFCI)
Also rename variable names from *tree to *list because they are just lists, not trees.
Suggested by riastradh@ --- Move locking notes --- Update the locking notes
- Add locking order - Add locking notes for misc lists such as reglist - Mention pserialize, key_sp_ref and key_sp_unref on SP operations
Requested by riastradh@ --- Describe constraints of key_sp_ref and key_sp_unref
Requested by riastradh@ --- Hold key_sad.lock on SAVLIST_WRITER_INSERT_TAIL --- Add __read_mostly to key_psz
Suggested by riastradh@ --- Tweak wording (pserialize critical section => pserialize read section)
Suggested by riastradh@ --- Add missing mutex_exit --- Fix setkey -D -P outputs
The outputs were tweaked (by me), but I forgot updating libipsec in my local ATF environment... --- MP-ify SAD (key_sad.sahlist and sah entries)
localcount(9) is used to protect key_sad.sahlist and sah entries as well as SPD (and will be used for SAD sav).
Please read the locking notes of SAD for more details. --- Introduce key_sa_refcnt and replace sav->refcnt with it (NFC) --- Destroy sav only in the loop for DEAD sav --- Fix KASSERT(solocked(sb->sb_so)) failure in sbappendaddr that is called eventually from key_sendup_mbuf
If key_sendup_mbuf isn't passed a socket, the assertion fails. Originally in this case sb->sb_so was softnet_lock and callers held softnet_lock so the assertion was magically satisfied. Now sb->sb_so is key_so_mtx and also softnet_lock isn't always held by callers so the assertion can fail.
Fix it by holding key_so_mtx if key_sendup_mbuf isn't passed a socket.
Reported by knakahara@ Tested by knakahara@ and ozaki-r@ --- Fix locking notes of SAD --- Fix deadlock between key_sendup_mbuf called from key_acquire and localcount_drain
If we call key_sendup_mbuf from key_acquire that is called on packet processing, a deadlock can happen like this: - At key_acquire, a reference to an SP (and an SA) is held - key_sendup_mbuf will try to take key_so_mtx - Some other thread may try to localcount_drain to the SP with holding key_so_mtx in say key_api_spdflush - In this case localcount_drain never return because key_sendup_mbuf that has stuck on key_so_mtx never release a reference to the SP
Fix the deadlock by deferring key_sendup_mbuf to the timer (key_timehandler). --- Fix that prev isn't cleared on retry --- Limit the number of mbufs queued for deferred key_sendup_mbuf
It's easy to be queued hundreds of mbufs on the list under heavy network load. --- MP-ify SAD (savlist)
localcount(9) is used to protect savlist of sah. The basic design is similar to MP-ifications of SPD and SAD sahlist. Please read the locking notes of SAD for more details. --- Simplify ipsec_reinject_ipstack (NFC) --- Add per-CPU rtcache to ipsec_reinject_ipstack
It reduces route lookups and also reduces rtcache lock contentions when NET_MPSAFE is enabled. --- Use pool_cache(9) instead of pool(9) for tdb_crypto objects
The change improves network throughput especially on multi-core systems. --- Update
ipsec(4), opencrypto(9) and vlan(4) are now MP-safe. --- Write known issues on scalability --- Share a global dummy SP between PCBs
It's never be changed so it can be pre-allocated and shared safely between PCBs. --- Fix race condition on the rawcb list shared by rtsock and keysock
keysock now protects itself by its own mutex, which means that the rawcb list is protected by two different mutexes (keysock's one and softnet_lock for rtsock), of course it's useless.
Fix the situation by having a discrete rawcb list for each. --- Use a dedicated mutex for rt_rawcb instead of softnet_lock if NET_MPSAFE --- fix localcount leak in sav. fixed by ozaki-r@n.o.
I commit on behalf of him. --- remove unnecessary comment. --- Fix deadlock between pserialize_perform and localcount_drain
A typical ussage of localcount_drain looks like this:
mutex_enter(&mtx); item = remove_from_list(); pserialize_perform(psz); localcount_drain(&item->localcount, &cv, &mtx); mutex_exit(&mtx);
This sequence can cause a deadlock which happens for example on the following situation:
- Thread A calls localcount_drain which calls xc_broadcast after releasing a specified mutex - Thread B enters the sequence and calls pserialize_perform with holding the mutex while pserialize_perform also calls xc_broadcast - Thread C (xc_thread) that calls an xcall callback of localcount_drain tries to hold the mutex
xc_broadcast of thread B doesn't start until xc_broadcast of thread A finishes, which is a feature of xcall(9). This means that pserialize_perform never complete until xc_broadcast of thread A finishes. On the other hand, thread C that is a callee of xc_broadcast of thread A sticks on the mutex. Finally the threads block each other (A blocks B, B blocks C and C blocks A).
A possible fix is to serialize executions of the above sequence by another mutex, but adding another mutex makes the code complex, so fix the deadlock by another way; the fix is to release the mutex before pserialize_perform and instead use a condvar to prevent pserialize_perform from being called simultaneously.
Note that the deadlock has happened only if NET_MPSAFE is enabled. --- Add missing ifdef NET_MPSAFE --- Take softnet_lock on pr_input properly if NET_MPSAFE
Currently softnet_lock is taken unnecessarily in some cases, e.g., icmp_input and encap4_input from ip_input, or not taken even if needed, e.g., udp_input and tcp_input from ipsec4_common_input_cb. Fix them.
NFC if NET_MPSAFE is disabled (default). --- - sanitize key debugging so that we don't print extra newlines or unassociated debugging messages. - remove unused functions and make internal ones static - print information in one line per message --- humanize printing of ip addresses --- cast reduction, NFC. --- Fix typo in comment --- Pull out ipsec_fill_saidx_bymbuf (NFC) --- Don't abuse key_checkrequest just for looking up sav
It does more than expected for example key_acquire. --- Fix SP is broken on transport mode
isr->saidx was modified accidentally in ipsec_nextisr.
Reported by christos@ Helped investigations by christos@ and knakahara@ --- Constify isr at many places (NFC) --- Include socketvar.h for softnet_lock --- Fix buffer length for ipsec_logsastr
|
1.58.2.4 |
| 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.58.2.3 |
| 21-May-2018 |
pgoyette | Sync with HEAD
|
1.58.2.2 |
| 02-May-2018 |
pgoyette | Synch with HEAD
|
1.58.2.1 |
| 22-Mar-2018 |
pgoyette | Synch with HEAD, resolve conflicts
|
1.61.2.2 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.61.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.62.4.1 |
| 04-Aug-2019 |
martin | Pull up following revision(s) (requested by ozaki-r in ticket #7):
sys/net/raw_usrreq.c: revision 1.63 sys/net/raw_usrreq.c: revision 1.64
Fix typo (s/m_free/m_freem/) This fixes PR kern/54419 "mbuf leak when deleting route" from sc dying.
-
Fix typo (s/m_free/m_freem/) (one more)
|
1.65.10.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|