summaryrefslogtreecommitdiffstats
path: root/sys/netatalk
Commit message (Collapse)AuthorAgeFilesLines
* Annotate two possible bugs in a comment: (1) we allocate and explicitlyrwatson2007-11-201-0/+8
| | | | | | | | prepend a data mbuf in front of a header mbuf without moving the header to the new mbuf, and (2) a possible alignment problem on architectures with strict alignment as reported in kern/4184. PR: kern/4184 (1)
* Add additional robustness to at_aarpinput() by testing for broadcastrwatson2007-11-201-0/+7
| | | | | | | | | | | addresses as the source of an AARP request. While this PR was submitted in the context of work in OpenBSD to port netatalk (in 1997), I've synchronized the code more to our ARP input routine, which had similar requirements. Submitted by: Denton Gentry PR: kern/4184 MFC after: 1 week
* Move towards more explicit support for various network protocol stacksrwatson2007-10-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the TrustedBSD MAC Framework: - Add mac_atalk.c and add explicit entry point mac_netatalk_aarp_send() for AARP packet labeling, rather than using a generic link layer entry point. - Add mac_inet6.c and add explicit entry point mac_netinet6_nd6_send() for ND6 packet labeling, rather than using a generic link layer entry point. - Add expliict entry point mac_netinet_arp_send() for ARP packet labeling, and mac_netinet_igmp_send() for IGMP packet labeling, rather than using a generic link layer entry point. - Remove previous genering link layer entry point, mac_mbuf_create_linklayer() as it is no longer used. - Add implementations of new entry points to various policies, largely by replicating the existing link layer entry point for them; remove old link layer entry point implementation. - Make MAC_IFNET_LOCK(), MAC_IFNET_UNLOCK(), and mac_ifnet_mtx global to the MAC Framework rather than static to mac_net.c as it is now needed outside of mac_net.c. Obtained from: TrustedBSD Project
* Rename 'mac_mbuf_create_from_firewall' to 'mac_netinet_firewall_send' asrwatson2007-10-261-2/+2
| | | | | | | | | | we move towards netinet as a pseudo-object for the MAC Framework. Rename 'mac_create_mbuf_linklayer' to 'mac_mbuf_create_linklayer' to reflect general object-first ordering preference. Sponsored by: SPARTA (original patches against Mac OS X) Obtained from: TrustedBSD Project, Apple Computer
* Merge first in a series of TrustedBSD MAC Framework KPI changesrwatson2007-10-242-3/+3
| | | | | | | | | | | | | | | | | | | | | | | from Mac OS X Leopard--rationalize naming for entry points to the following general forms: mac_<object>_<method/action> mac_<object>_check_<method/action> The previous naming scheme was inconsistent and mostly reversed from the new scheme. Also, make object types more consistent and remove spaces from object types that contain multiple parts ("posix_sem" -> "posixsem") to make mechanical parsing easier. Introduce a new "netinet" object type for certain IPv4/IPv6-related methods. Also simplify, slightly, some entry point names. All MAC policy modules will need to be recompiled, and modules not updates as part of this commit will need to be modified to conform to the new KPI. Sponsored by: SPARTA (original patches against Mac OS X) Obtained from: TrustedBSD Project, Apple Computer
* Mark wire data structures in netatalk as __packed so that they arerwatson2007-06-282-7/+9
| | | | | | | | | properly (un)padded on the arm platform. With this change, FreeBSD/arm boxes are able to route AppleTalk properly. Submitted/tested by: Nathan Whitehorn <nathanw at uchicago dot edu> Tested on: arm, i386, amd64 Approved by: re (kensmith)
* Reduce network stack oddness: implement .pru_sockaddr and .pru_peeraddrrwatson2007-05-111-5/+5
| | | | | | | | protocol entry points using functions named proto_getsockaddr and proto_getpeeraddr rather than proto_setsockaddr and proto_setpeeraddr. While it's true that sockaddrs are allocated and set, the net effect is to retrieve (get) the socket address or peer address from a socket, not set it, so align names to that intent.
* Use privilege PRIV_NET_ADDIFADDR rather than suser() to authorizerwatson2007-02-191-1/+2
| | | | adding a netatalk address to an interface.
* Clean up DDP layer netatalk code:rwatson2007-01-127-875/+795
| | | | | | | | | - General style(9) cleanup -- white space, braces, line wraps, etc. - Annotate a lack of synchronization the global route cache if the input routine is invoked with parallelism. - Remove unused debugging code.
* Cleanup of netatalk atalk layer includes, protocol definitions, andrwatson2007-01-125-127/+115
| | | | | | | | | | | | | | | | | | | routing: - style(9) cleanup -- white space, braces, etc. - Make include guards consistent with our more general naming convention. - Rearrange and complete forward structure declarations in at_extern.h, remove testing of guards of various other include files to protect function declarations. This leaves an ifdef _KERNEL in at_var.h, but from inspection it seems likely that this file is not actually safe for inclusion in user space still. However, since it's not included from within src/ so this does not appear to be an issue (ifconfig, etc, have migrated to the generic cross-protocol ioctls for address operations).
* Re-style aarp with style(9): normal plethora of white space, brace,rwatson2007-01-123-531/+516
| | | | | | | | | | etc, changes. Remove a small amount of #if !defined(__FreeBSD__) code. Add missing include guard for _NETATALK_AARP_H_. Remove unneeded (and conflicting) extern prototype for aarptfree().
* Break out my copyrights with our 2-clause BSD license from the UMichrwatson2007-01-086-5/+95
| | | | | | copyright, which while similar, is different. MFC after: 3 days
* 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().
OpenPOWER on IntegriCloud