aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_socket.c
Commit message (Collapse)AuthorAgeFilesLines
...
* When making a peer of unknown type framework tries to load moduleGleb Smirnoff2004-07-271-0/+34
| | | | | | | | | | | | | | | | | using linker_load_module(). This works OK if NGM_MKPEER message came from userland and we have process associated with thread. But when NGM_MKPEER was queued because target node was busy, linker_load_module() is called from netisr thread leading to panic. To workaround that we do not load modules by framework, instead ng_socket loads module (if this is required) before sending NGM_MKPEER. However, the race condition between return from NgSendMsg() and actual creation of node still exist and needs to be solved. PR: kern/62789 Approved by: julian Notes: svn path=/head/; revision=132705
* Introduce a global mtx 'ngsocketlist_mtx' to protect the globalRobert Watson2004-07-121-0/+8
| | | | | | | ng_socket list during insert/delete. Notes: svn path=/head/; revision=132013
* Update for the KDB framework:Marcel Moolenaar2004-07-101-2/+2
| | | | | | | | o Call kdb_enter() instead of Debugger(). o Change comments accordingly. Notes: svn path=/head/; revision=131933
* Switch to using C99 sparse initialisers for the type methods array.Julian Elischer2004-05-291-12/+10
| | | | | | | | | | | Should make no binary difference. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru> Reviewed by: Harti Brandt <harti@freebsd.org> MFC after: 1 week Notes: svn path=/head/; revision=129823
* Correct the description of the net.graph.recvspace sysctl.Ruslan Ermilov2004-01-271-1/+1
| | | | Notes: svn path=/head/; revision=125116
* Get rid of the deprecated *LEN constants in favour of the newHartmut Brandt2004-01-261-5/+5
| | | | | | | *SIZ constants that include the trailing \0 byte. Notes: svn path=/head/; revision=125028
* Allow the socket buffer sizes to be controlled via sysctl(8).Ruslan Ermilov2004-01-231-0/+4
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=124871
* Introduce a MAC label reference in 'struct inpcb', which cachesRobert Watson2003-11-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the MAC label referenced from 'struct socket' in the IPv4 and IPv6-based protocols. This permits MAC labels to be checked during network delivery operations without dereferencing inp->inp_socket to get to so->so_label, which will eventually avoid our having to grab the socket lock during delivery at the network layer. This change introduces 'struct inpcb' as a labeled object to the MAC Framework, along with the normal circus of entry points: initialization, creation from socket, destruction, as well as a delivery access control check. For most policies, the inpcb label will simply be a cache of the socket label, so a new protocol switch method is introduced, pr_sosetlabel() to notify protocols that the socket layer label has been updated so that the cache can be updated while holding appropriate locks. Most protocols implement this using pru_sosetlabel_null(), but IPv4/IPv6 protocols using inpcbs use the the worker function in_pcbsosetlabel(), which calls into the MAC Framework to perform a cache update. Biba, LOMAC, and MLS implement these entry points, as do the stub policy, and test policy. Reviewed by: sam, bms Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=122875
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-5/+5
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-5/+5
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Bow to the whining masses and change a union back into void *. RetainMatthew Dillon2003-01-131-1/+1
| | | | | | | | removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it. Notes: svn path=/head/; revision=109153
* Change struct file f_data to un_data, a union of the correct structMatthew Dillon2003-01-121-1/+1
| | | | | | | | | | | | | pointer types, and remove a huge number of casts from code using it. Change struct xfile xf_data to xun_data (ABI is still compatible). If we need to add a #define for f_data and xf_data we can, but I don't think it will be necessary. There are no operational changes in this commit. Notes: svn path=/head/; revision=109123
* Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,Jens Schweikhardt2003-01-011-2/+2
| | | | | | | especially in troff files. Notes: svn path=/head/; revision=108533
* Don't use "NULL" when "0" is really meant.Archie Cobbs2002-08-221-2/+2
| | | | Notes: svn path=/head/; revision=102244
* Const'ify variables to make it clear we're not writing to the mbuf data.Archie Cobbs2002-06-051-1/+1
| | | | | | | | Reviewed by: julian, brian MFC after: 1 week Notes: svn path=/head/; revision=97897
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.Seigo Tanimura2002-05-311-16/+0
| | | | | | | Requested by: hsu Notes: svn path=/head/; revision=97658
* Lock down a socket, milestone 1.Seigo Tanimura2002-05-201-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred Notes: svn path=/head/; revision=96972
* Revert the change of #includes in sys/filedesc.h and sys/socketvar.h.Seigo Tanimura2002-04-301-3/+5
| | | | | | | | | | | | | Requested by: bde Since locking sigio_lock is usually followed by calling pgsigio(), move the declaration of sigio_lock and the definitions of SIGIO_*() to sys/signalvar.h. While I am here, sort include files alphabetically, where possible. Notes: svn path=/head/; revision=95759
* Change the suser() API to take advantage of td_ucred as well as do aJohn Baldwin2002-04-011-1/+1
| | | | | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ Notes: svn path=/head/; revision=93593
* Replace ffind_* with fget calls.Alfred Perlstein2002-01-141-3/+2
| | | | | | | | | | | Make fget MPsafe. Make fgetvp and fgetsock use the fget subsystem to reduce code bloat. Push giant down in fpathconf(). Notes: svn path=/head/; revision=89319
* SMP Lock struct file, filedesc and the global file list.Alfred Perlstein2002-01-131-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap. Notes: svn path=/head/; revision=89306
* Staticise the socket list.Mike Smith2002-01-081-1/+1
| | | | Notes: svn path=/head/; revision=89066
* Update to C99, s/__FUNCTION__/__func__/,David E. O'Brien2001-12-101-1/+1
| | | | | | | also don't use ANSI string concatenation. Notes: svn path=/head/; revision=87599
* Fix bug that cheated hook names out of the last 2 bytes.Archie Cobbs2001-10-101-2/+2
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=84777
* Hopefully improve control message passing over Unix domain sockets.David Malone2001-10-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Allow the sending of more than one control message at a time over a unix domain socket. This should cover the PR 29499. 2) This requires that unp_{ex,in}ternalize and unp_scan understand mbufs with more than one control message at a time. 3) Internalize and externalize used to work on the mbuf in-place. This made life quite complicated and the code for sizeof(int) < sizeof(file *) could end up doing the wrong thing. The patch always create a new mbuf/cluster now. This resulted in the change of the prototype for the domain externalise function. 4) You can now send SCM_TIMESTAMP messages. 5) Always use CMSG_DATA(cm) to determine the start where the data in unp_{ex,in}ternalize. It was using ((struct cmsghdr *)cm + 1) in some places, which gives the wrong alignment on the alpha. (NetBSD made this fix some time ago). This results in an ABI change for discriptor passing and creds passing on the alpha. (Probably on the IA64 and Spare ports too). 6) Fix userland programs to use CMSG_* macros too. 7) Be more careful about freeing mbufs containing (file *)s. This is made possible by the prototype change of externalise. PR: 29499 MFC after: 6 weeks Notes: svn path=/head/; revision=84472
* KSE Milestone 2Julian Elischer2001-09-121-12/+12
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Shuffle sysctls a bit (thankyou whoever made them dynamic for modules)Julian Elischer2001-02-231-1/+0
| | | | | | | | | | | | | | | and add a sysctl to pppoe to activate non standard ethertypes so that idiot ISPs (apparently in France) who use equipment from idiot suppliers (rumour says 3com) who use nonstandard ethertypes can still connect. "yep, sure we do pppoe, we use a different identifier to that dictated in the standard, but sure it's pppoe!" sysctl -w net.graph.stupid_isp=1 enables the changeover. Notes: svn path=/head/; revision=72946
* Add a dummy disconnect function so that the socket code doesn't leap intoJulian Elischer2001-02-051-2/+7
| | | | | | | | space when it calls the disconnect PRU function without checking that it there. Notes: svn path=/head/; revision=72055
* Make netgraph modules refuse to link with modules of a different ABI version.Julian Elischer2001-02-051-37/+70
| | | | | | | | | also try implement teh documented behaviour in socket nodes so that when there is only one hook, an unaddressed write/send will DTRT and send the data to that hook. Notes: svn path=/head/; revision=72053
* Fix some memory leaksJulian Elischer2001-01-101-7/+15
| | | | | | | Add memory leak detection assitance. Notes: svn path=/head/; revision=70870
* Part 2 of the netgraph rewrite.Julian Elischer2001-01-081-29/+68
| | | | | | | | | This is mostly cosmetic changes, (though I caught a bug or two while makeing them) Reviewed by: archie@freebsd.org Notes: svn path=/head/; revision=70784
* Rewrite of netgraph to start getting ready for SMP.Julian Elischer2001-01-061-107/+96
| | | | | | | | | | | This version is functional and is aproaching solid.. notice I said APROACHING. There are many node types I cannot test I have tested: echo hole ppp socket vjc iface tee bpf async tty The rest compile and "Look" right. More changes to follow. DEBUGGING is enabled in this code to help if people have problems. Notes: svn path=/head/; revision=70700
* Divorce the kernel binary ABI version number from the messageJulian Elischer2000-12-181-1/+1
| | | | | | | | | | | | format version number. (userland programs should not need to be recompiled when the netgraph kernel internal ABI is changed. Also fix modules that don;t handle the fact that a caller may not supply a return message pointer. (benign at the moment because the calling code checks, but that will change) Notes: svn path=/head/; revision=70159
* Reviewed by: Archie@freebsd.orgJulian Elischer2000-12-121-8/+9
| | | | | | | | | | | | | | | | This clears out my outstanding netgraph changes. There is a netgraph change of design in the offing and this is to some extent a superset of soem of the new functionality and some of the old functionality that may be removed. This code works as before, but allows some new features that I want to work with and evaluate. It is the basis for a version of netgraph with integral locking for SMP use. This is running on my test machine with no new problems :-) Notes: svn path=/head/; revision=69922
* Add the use of M_ZERO to netgraph.David Malone2000-11-181-6/+3
| | | | | | | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Submitted by: archie Approved by: archie Notes: svn path=/head/; revision=68876
* Move suser() and suser_xxx() prototypes and a related #define fromPoul-Henning Kamp2000-10-291-1/+0
| | | | | | | | | | | | <sys/proc.h> to <sys/systm.h>. Correctly document the #includes needed in the manpage. Add one now needed #include of <sys/systm.h>. Remove the consequent 48 unused #includes of <sys/proc.h>. Notes: svn path=/head/; revision=67893
* Since neither archie nor I work at Whistle any more, change our emailJulian Elischer2000-10-241-1/+1
| | | | | | | | | addresses to be the more usefu @freebsd.org ones so we can keep getting bug-reports. - man pages to follow.. Notes: svn path=/head/; revision=67506
* Increase the maximum allowable datagram length.Archie Cobbs2000-08-101-1/+1
| | | | Notes: svn path=/head/; revision=64512
* Back out the previous change to the queue(3) interface.Jake Burkholder2000-05-261-1/+1
| | | | | | | | | It was not discussed and should probably not happen. Requested by: msmith and others Notes: svn path=/head/; revision=60938
* Change the way that the queue(3) structures are declared; don't assume thatJake Burkholder2000-05-231-1/+1
| | | | | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd Notes: svn path=/head/; revision=60833
* Two simple changes to the kernel internal API for netgraph modules,Julian Elischer2000-04-281-3/+4
| | | | | | | | | | to support future work in flow-control and 'packet reject/replace' processing modes. reviewed by: phk, archie Notes: svn path=/head/; revision=59728
* Remove a bunch of un-needed includes.Julian Elischer1999-12-071-1/+0
| | | | | | | Submitted by: phk@freebsd.org Notes: svn path=/head/; revision=54249
* Add two new generic control messages, NGM_ASCII2BINARY andArchie Cobbs1999-11-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | NGM_BINARY2ASCII, which convert control messages to ASCII and back. This allows control messages to be sent and received in ASCII form using ngctl(8), which makes ngctl a lot more useful. This also allows all the type-specific debugging code in libnetgraph to go away -- instead, we just ask the node itself to do the ASCII translation for us. Currently, all generic control messages are supported, as well as messages associated with the following node types: async, cisco, ksocket, and ppp. See /usr/share/examples/netgraph/ngctl for an example of using this. Also give ngctl(8) the ability to print out incoming data and control messages at any time. Eventually nghook(8) may be subsumed. Several other misc. bug fixes. Reviewed by: julian Notes: svn path=/head/; revision=53913
* oops cut-n-paste errorJulian Elischer1999-11-211-1/+1
| | | | Notes: svn path=/head/; revision=53532
* It's time to only allow root to manipulate netgraph nodes.Julian Elischer1999-11-211-0/+2
| | | | | | | (I meant to do this before checking in to FreeBSD and forgot) Notes: svn path=/head/; revision=53530
* Hopefully the last patch from Brian to get server side PPPoE working.Julian Elischer1999-11-211-4/+2
| | | | | | | remove a 'free' that is no longer needed. Notes: svn path=/head/; revision=53526
* Fixes from brian. With some changes from me.Julian Elischer1999-11-211-21/+37
| | | | | | | | Allows FreeBSD to run as a PPPOE server One patch still not included. Notes: svn path=/head/; revision=53498
* Provide an empty name to getsockname() if one hasn't been set up.Brian Somers1999-11-111-15/+28
| | | | | | | Ok'd (for now) by: julian Notes: svn path=/head/; revision=53098
* Move a structure Netstat needs back out to ng_socketvar.h (yech)Julian Elischer1999-11-061-18/+1
| | | | Notes: svn path=/head/; revision=52919
* Add the option for a socket node to shut down when the last hookJulian Elischer1999-11-051-2/+55
| | | | | | | | to an adjoining node is removed. Also move file scope definitions back within the file, and remove un-needed include file. Notes: svn path=/head/; revision=52885