summaryrefslogtreecommitdiffstats
path: root/sys/netatalk
Commit message (Collapse)AuthorAgeFilesLines
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-062-1/+4
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-223-3/+6
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* Since soisdisconnected() is no longer called in pru_detach(), call itrwatson2006-08-051-0/+2
| | | | near consumers of at_pcbdisconnect() (_close, _abort).
* Remove call to soisdisconnected() in at_pcbdetach(): by the time therwatson2006-08-021-2/+0
| | | | | socket is being detached, there are no consumers left worth notifying about the disconnect.
* Change semantics of socket close and detach. Add a new protocol switchrwatson2006-07-211-3/+20
| | | | | | | | | | | | | | | | | | | function, pru_close, to notify protocols that the file descriptor or other consumer of a socket is closing the socket. pru_abort is now a notification of close also, and no longer detaches. pru_detach is no longer used to notify of close, and will be called during socket tear-down by sofree() when all references to a socket evaporate after an earlier call to abort or close the socket. This means detach is now an unconditional teardown of a socket, whereas previously sockets could persist after detach of the protocol retained a reference. This faciliates sharing mutexes between layers of the network stack as the mutex is required during the checking and removal of references at the head of sofree(). With this change, pru_detach can now assume that the mutex will no longer be required by the socket layer after completion, whereas before this was not necessarily true. Reviewed by: gnn
* Update global copyright statement for netatalk, as I claim copyrightrwatson2006-06-081-0/+1
| | | | | | on changes in a number of files in netatalk. MFC after: 1 week
* White space consistency with kasserts. Minor style tweaks.rwatson2006-04-011-2/+6
| | | | MFC after: 3 months
* Chance protocol switch method pru_detach() so that it returns voidrwatson2006-04-011-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | rather than an error. Detaches do not "fail", they other occur or the protocol flags SS_PROTOREF to take ownership of the socket. soclose() no longer looks at so_pcb to see if it's NULL, relying entirely on the protocol to decide whether it's time to free the socket or not using SS_PROTOREF. so_pcb is now entirely owned and managed by the protocol code. Likewise, no longer test so_pcb in other socket functions, such as soreceive(), which have no business digging into protocol internals. Protocol detach routines no longer try to free the socket on detach, this is performed in the socket code if the protocol permits it. In rts_detach(), no longer test for rp != NULL in detach, and likewise in other protocols that don't permit a NULL so_pcb, reduce the incidence of testing for it during detach. netinet and netinet6 are not fully updated to this change, which will be in an upcoming commit. In their current state they may leak memory or panic. MFC after: 3 months
* Change protocol switch pru_abort() API so that it returns void ratherrwatson2006-04-011-3/+1
| | | | | | | | | | | | | | than an int, as an error here is not meaningful. Modify soabort() to unconditionally free the socket on the return of pru_abort(), and modify most protocols to no longer conditionally free the socket, since the caller will do this. This commit likely leaves parts of netinet and netinet6 in a situation where they may panic or leak memory, as they have not are not fully updated by this commit. This will be corrected shortly in followup commits to these components. MFC after: 3 months
* In at_setsockaddr(), assert that ddp != NULL, rather than returning anrwatson2006-03-251-3/+2
| | | | error if it's NULL, as so_pcb != NULL is now an invariant.
* Modify netatalk to ensure, and assert, that pcb's remain attached torwatson2006-03-172-26/+11
| | | | | | | | | | sockets as long as the sockets have not been aborted or detached. Do not try to free the socket in pru_detach(), since sofree() will do so, if needed, once pru_detach() returns. Annotate a bug in ddp_abort(), which fails to free the socket; this is probably OK as ddp_abort() should never be called, so should instead be deleted.
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-4/+5
| | | | | | | | | | rather than in ifindex_table[]; all (except one) accesses are through ifp anyway. IF_LLADDR() works faster, and all (except one) ifaddr_byindex() users were converted to use ifp->if_addr. - Stop storing a (pointer to) Ethernet address in "struct arpcom", and drop the IFP2ENADDR() macro; all users have been converted to use IF_LLADDR() instead.
* Catch up with IFP2ENADDR() type change (array -> pointer).ru2005-11-111-2/+1
|
* Use sparse initializers for "struct domain" and "struct protosw",ru2005-11-091-20/+14
| | | | so they are easier to follow for the human being.
* Forward declare atalkdomain with static linkage, not extern, sincerodrigc2005-09-111-1/+1
| | | | | it is defined with static linkage later in the file. Eliminates GCC 4.0 error.
* Use the correct mbuf type for MGET().andre2005-08-301-1/+1
|
* Eliminate MAC entry point mac_create_mbuf_from_mbuf(), which isrwatson2005-07-051-1/+1
| | | | | | | | | | | redundant with respect to existing mbuf copy label routines. Expose a new mac_copy_mbuf() routine at the top end of the Framework and use that; use the existing mpo_copy_mbuf_label() routine on the bottom end. Obtained from: TrustedBSD Project Sponsored by: SPARTA, SPAWAR Approved by: re (scottl)
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-5/+5
| | | | | | | | | | | | | | | | | | | | struct ifnet or the layer 2 common structure it was embedded in have been replaced with a struct ifnet pointer to be filled by a call to the new function, if_alloc(). The layer 2 common structure is also allocated via if_alloc() based on the interface type. It is hung off the new struct ifnet member, if_l2com. This change removes the size of these structures from the kernel ABI and will allow us to better manage them as interfaces come and go. Other changes of note: - Struct arpcom is no longer referenced in normal interface code. Instead the Ethernet address is accessed via the IFP2ENADDR() macro. To enforce this ac_enaddr has been renamed to _ac_enaddr. - The second argument to ether_ifattach is now always the mac address from driver private storage rather than sometimes being ac_enaddr. Reviewed by: sobomax, sam
* When generating a phase II ARP lookup from aarpwhohas(), use arwatson2005-02-221-1/+1
| | | | | | non-sleeping mbuf allocation. MFC after: 1 week
* In the ddp_output() path, which can be called in a variety of threadingrwatson2005-02-221-2/+2
| | | | | | and locking contexts, use a non-sleeping allocation for mbufs. MFC after: 1 week
* Convert the aa_ifaddr timeout to a callout, and run the aarprobe calloutrwatson2005-02-224-14/+24
| | | | | | | MPSAFE. Acquire the aarptab_mtx to make sure that the callout and msleep in the ioctl thread don't race. MFC after: 1 week
* 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
OpenPOWER on IntegriCloud