summaryrefslogtreecommitdiffstats
path: root/sys/netatalk
Commit message (Collapse)AuthorAgeFilesLines
...
* Run the netatalk netisrs without Giant.rwatson2005-02-181-4/+4
| | | | MFC after: 1 week
* /* -> /*- for license, minor formatting changes, insert COPYRIGHT into filesimp2005-01-0718-24/+202
|
* If MALLOC() fails in at_pcballoc(), return ENOBUFS rather thanrwatson2005-01-031-1/+3
| | | | | | potentially panicking. MFC after: 1 week
* Correct a misspelling in a comment.rwatson2004-12-051-1/+1
|
* Acquire socket receive buffer mutex before appending and then waking uprwatson2004-12-051-2/+4
| | | | | | a receive socket in DDP. This reduces the number of mutex operations required to deliver to a socket by two, and is the model used in other protocols.
* Initialize struct pr_userreqs in new/sparse style and fill in commonphk2004-11-081-21/+11
| | | | | | default elements in net_init_domain(). This makes it possible to grep these structures and see any bogosities.
* Push acquisition of the accept mutex out of sofree() into the callerrwatson2004-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (sorele()/sotryfree()): - This permits the caller to acquire the accept mutex before the socket mutex, avoiding sofree() having to drop the socket mutex and re-order, which could lead to races permitting more than one thread to enter sofree() after a socket is ready to be free'd. - This also covers clearing of the so_pcb weak socket reference from the protocol to the socket, preventing races in clearing and evaluation of the reference such that sofree() might be called more than once on the same socket. This appears to close a race I was able to easily trigger by repeatedly opening and resetting TCP connections to a host, in which the tcp_close() code called as a result of the RST raced with the close() of the accepted socket in the user process resulting in simultaneous attempts to de-allocate the same socket. The new locking increases the overhead for operations that may potentially free the socket, so we will want to revise the synchronization strategy here as we normalize the reference counting model for sockets. The use of the accept mutex in freeing of sockets that are not listen sockets is primarily motivated by the potential need to remove the socket from the incomplete connection queue on its parent (listen) socket, so cleaning up the reference model here may allow us to substantially weaken the synchronization requirements. RELENG_5_3 candidate. MFC after: 3 days Reviewed by: dwhite Discussed with: gnn, dwhite, green Reported by: Marc UBM Bocklet <ubm at u-boot-man dot de> Reported by: Vlad <marchenko at gmail dot com>
* Inline umich license from COPYRIGHT to make it clear what license therwatson2004-08-102-7/+92
| | | | | | | | | umich copyright is asserting. Clarify that the copyright I'm asserting is the standard Berkeley license. Remove Giant assertions from AARP and DDP input routines.
* Further function forward declaration white space tweaks.rwatson2004-07-191-14/+15
|
* Re-style at_control.c to bring it closer to style(9), primarily withrwatson2004-07-191-606/+594
| | | | | | regard to function prototypes and indentation. The lack of indentation in if clauses and case statements made this code extremely difficult to read.
* Procotol control block locking for netatalk DDP.rwatson2004-07-125-35/+134
|
* Imperfect synchronization solution to imperfect code: use a static 256rwatson2004-07-121-13/+16
| | | | | byte buffer in the stack for temporary printf results rather than a global buffer without synchronization.
* Remove 'Not used' comment: at_org_code is used, just not in netatalk/.rwatson2004-07-121-3/+0
|
* Remove spl's from netatalk in preparation to merge locking.rwatson2004-07-122-30/+1
|
* Socket MAC labels so_label and so_peerlabel are now protected byrwatson2004-06-132-0/+5
| | | | | | | | | | | | | SOCK_LOCK(so): - Hold socket lock over calls to MAC entry points reading or manipulating socket labels. - Assert socket lock in MAC entry point implementations. - When externalizing the socket label, first make a thread-local copy while holding the socket lock, then release the socket lock to externalize to userspace.
* Extend coverage of SOCK_LOCK(so) to include so_count, the socketrwatson2004-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | reference count: - Assert SOCK_LOCK(so) macros that directly manipulate so_count: soref(), sorele(). - Assert SOCK_LOCK(so) in macros/functions that rely on the state of so_count: sofree(), sotryfree(). - Acquire SOCK_LOCK(so) before calling these functions or macros in various contexts in the stack, both at the socket and protocol layers. - In some cases, perform soisdisconnected() before sotryfree(), as this could result in frobbing of a non-present socket if sotryfree() actually frees the socket. - Note that sofree()/sotryfree() will release the socket lock even if they don't free the socket. Submitted by: sam Sponsored by: FreeBSD Foundation Obtained from: BSD/OS
* Remove redundant call to soisdisconnected() from ddp_abort(), as itrwatson2004-05-051-1/+0
| | | | calls at_pcbdetach() which also immediately calls soisdisconnected().
* This commit does two things:luigi2004-04-252-37/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. rt_check() cleanup: rt_check() is only necessary for some address families to gain access to the corresponding arp entry, so call it only in/near the *resolve() routines where it is actually used -- at the moment this is arpresolve(), nd6_storelladdr() (the call is embedded here), and atmresolve() (the call is just before atmresolve to reduce the number of changes). This change will make it a lot easier to decouple the arp table from the routing table. There is an extra call to rt_check() in if_iso88025subr.c to determine the routing info length. I have left it alone for the time being. The interface of arpresolve() and nd6_storelladdr() now changes slightly: + the 'rtentry' parameter (really a hint from the upper level layer) is now passed unchanged from *_output(), so it becomes the route to the final destination and not to the gateway. + the routines will return 0 if resolution is possible, non-zero otherwise. + arpresolve() returns EWOULDBLOCK in case the mbuf is being held waiting for an arp reply -- in this case the error code is masked in the caller so the upper layer protocol will not see a failure. 2. arpcom untangling Where possible, use 'struct ifnet' instead of 'struct arpcom' variables, and use the IFP2AC macro to access arpcom fields. This mostly affects the netatalk code. === Detailed changes: === net/if_arcsubr.c rt_check() cleanup, remove a useless variable net/if_atmsubr.c rt_check() cleanup net/if_ethersubr.c rt_check() cleanup, arpcom untangling net/if_fddisubr.c rt_check() cleanup, arpcom untangling net/if_iso88025subr.c rt_check() cleanup netatalk/aarp.c arpcom untangling, remove a block of duplicated code netatalk/at_extern.h arpcom untangling netinet/if_ether.c rt_check() cleanup (change arpresolve) netinet6/nd6.c rt_check() cleanup (change nd6_storelladdr)
* Lock down the netatalk AARP code, which is responsible for appletalkrwatson2004-04-091-11/+30
| | | | | | | address discovery and caching (similar to inet ARP). Use a single global mutex, aarptab_mtx, to protect the table. Remove spl/spx. Tested by: Bob Bishop <rb@gid.co.uk>
* Rename 'ddpcb' variable to 'ddpcb_list' to better distinguish it fromrwatson2004-03-223-8/+8
| | | | 'struct ddpcb'.
* Rename 'at_ifaddr' list to 'at_ifaddr_list' so that the variable isrwatson2004-03-226-23/+23
| | | | more easily mechanically distinguished from 'struct at_ifaddr'.
* Compare pointers with NULL rather than 0, or treating them as boolans inrwatson2004-03-226-13/+14
| | | | | | | if statements. at_rmx gets a $FreeBSD$ out of the deal also (this code appears to be unused).
* Also modify ddp_input.c with the following changes previously appliedrwatson2004-03-221-90/+90
| | | | | | | | | | | | | | to other files in netatalk: Log: Since I have my hands all over netatalk adding locking and restructuring it, cinch the file's style closer to style(9) with regard to parenthesis: s/( /(/g s/ )/)/g s/return(/return (/g s/return 0/return (0)/ s/return 1/return (1)/
* Since I have my hands all over netatalk adding locking and restructuringrwatson2004-03-225-582/+582
| | | | | | | | | | it, cinch the file's style closer to style(9) with regard to parenthesis: s/( /(/g s/ )/)/g s/return(/return (/g s/return 0/return (0)/ s/return 1/return (1)/
* Spell "(struct foo *)0" as "NULL".rwatson2004-03-214-25/+23
|
* Isolate PCB-specific ethertalk DDP functions in ddp_pcb.c, removing themrwatson2004-03-193-604/+45
| | | | | | | | | | | | | | | from ddp_usrreq.c. Functions moved are: at_pcballoc() at_pcbconnect() at_pcbdetach() at_pcbdisconnect() at_pcbsetaddr() at_sockaddr() Also moved are ddp_ports and ddpcb, global variables associated with DDP pcbs. This makes PCB implementation more parallel to inet, inet6, and ipx.
* Make ddp_ports static, as it's not used outside of ddp_usrreq.c.rwatson2004-03-173-3/+2
| | | | | Inspired by: Day spent hiking to hot springs in Taiwan Powered by: Asia BSDCon 2004
* Const-poison atmulticastaddr, which should be read but not modified.rwatson2004-03-131-9/+9
| | | | | | While there, remove (caddr_t) casting of ethernet addresses, which among other things discards the qualifier. This makes it clear that atmulticastaddr does not require synchronization.
* Rename dup_sockaddr() to sodupsockaddr() for consistency with otherrwatson2004-03-012-2/+2
| | | | | | | | | | | | functions in kern_socket.c. Rename the "canwait" field to "mflags" and pass M_WAITOK and M_NOWAIT in from the caller context rather than "1" or "0". Correct mflags pass into mac_init_socket() from previous commit to not include M_ZERO. Submitted by: sam
* Eliminate a duplicate free when deleting an interface address. Thissam2003-11-281-11/+1
| | | | | | | | caused crashes, typically during shutdown, because the second free referenced a mutex that had been destroyed. Tested by: several Approved by: re (scottl)
* Introduce a MAC label reference in 'struct inpcb', which cachesrwatson2003-11-182-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
* o add a flags parameter to netisr_register that is used to specifysam2003-11-084-6/+11
| | | | | | | | | | | | | | | | whether or not the isr needs to hold Giant when running; Giant-less operation is also controlled by the setting of debug_mpsafenet o mark all netisr's except NETISR_IP as needing Giant o add a GIANT_REQUIRED assertion to the top of netisr's that need Giant o pickup Giant (when debug_mpsafenet is 1) inside ip_input before calling up with a packet o change netisr handling so swi_net runs w/o Giant; instead we grab Giant before invoking handlers based on whether the handler needs Giant o change netisr handling so that netisr's that are marked MPSAFE may have multiple instances active at a time o add netisr statistics for packets dropped because the isr is inactive Supported by: FreeBSD Foundation
* must use RTFREE instead of rtfree for proper lockingsam2003-11-082-2/+2
|
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-4/+4
| | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname)
* Remove unnecessary casts to (caddr_t) for if_broadcastaddr.imp2003-10-231-3/+3
|
* More checking of M_PREPEND() return values: pass through link-layerrwatson2003-08-292-0/+8
| | | | | Appletalk code. These changes are untested since I don't have an Appletalk environment.
* - Use if_broadcastaddr from struct ifnet rather than relying onmdodd2003-03-211-4/+4
| | | | | | | extern 'etherbroadcastaddr'. - Make 'etherbroadcastaddr' static. Reviewed by: imp
* Update netisr handling; Each SWI now registers its queue, and all queuejlemon2003-03-046-83/+58
| | | | | | | | | | drain routines are done by swi_net, which allows for better queue control at some future point. Packets may also be directly dispatched to a netisr instead of queued, this may be of interest at some installations, but currently defaults to off. Reviewed by: hsu, silby, jayanth, sam Sponsored by: DARPA, NAI Labs
* Back out M_* changes, per decision of the TRB.imp2003-02-195-10/+10
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-215-10/+10
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Lock up ifaddr reference counts.hsu2002-12-181-11/+2
|
* Add more ethernet types and move AppleTalk types into proper location.sobomax2002-09-061-8/+2
| | | | Obtained from: NetBSD (syssrc/sys/net/ethertypes.h, rev.1.13)
* Introduce experimental support for MAC in the AppleTalk/EtherTalk stack.rwatson2002-08-153-0/+28
| | | | | | | | | Label link layer mbufs as they are created for transmission, check mbufs before delivering them to sockets, label mbufs as they are created from sockets, and preserve mbuf labels if mbufs are copied. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.tanimura2002-05-313-20/+2
| | | | Requested by: hsu
* Fix warning; Extra tokens after #endifpeter2002-05-241-1/+1
|
* Lock down a socket, milestone 1.tanimura2002-05-203-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Revert the change of #includes in sys/filedesc.h and sys/socketvar.h.tanimura2002-04-301-3/+6
| | | | | | | | | | 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.
* Change callers of mtx_init() to pass in an appropriate lock type name. Injhb2002-04-042-4/+4
| | | | | | | most cases NULL is passed, but in some cases such as network driver locks (which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used. Tested on: i386, alpha, sparc64
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-013-3/+3
| | | | | | | | | | | | 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@
* Remove __P.alfred2002-03-201-15/+15
|
OpenPOWER on IntegriCloud