summaryrefslogtreecommitdiffstats
path: root/sys/net
Commit message (Collapse)AuthorAgeFilesLines
* Move MAC label storage for mbufs into m_tags from the m_pkthdr structure,rwatson2003-04-141-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning some additional room in the first mbuf in a chain, and avoiding feature-specific contents in the mbuf header. To do this: - Modify mbuf_to_label() to extract the tag, returning NULL if not found. - Introduce mac_init_mbuf_tag() which does most of the work mac_init_mbuf() used to do, except on an m_tag rather than an mbuf. - Scale back mac_init_mbuf() to perform m_tag allocation and invoke mac_init_mbuf_tag(). - Replace mac_destroy_mbuf() with mac_destroy_mbuf_tag(), since m_tag's are now GC'd deep in the m_tag/mbuf code rather than at a higher level when mbufs are directly free()'d. - Add mac_copy_mbuf_tag() to support m_copy_pkthdr() and related notions. - Generally change all references to mbuf labels so that they use mbuf_to_label() rather than &mbuf->m_pkthdr.label. This required no changes in the MAC policies (yay!). - Tweak mbuf release routines to not call mac_destroy_mbuf(), tag destruction takes care of it for us now. - Remove MAC magic from m_copy_pkthdr() and m_move_pkthdr() -- the existing m_tag support does all this for us. Note that we can no longer just zero the m_tag list on the target mbuf, rather, we have to delete the chain because m_tag's will already be hung off freshly allocated mbuf's. - Tweak m_tag copying routines so that if we're copying a MAC m_tag, we don't do a binary copy, rather, we initialize the new storage and do a deep copy of the label. - Remove use of MAC_FLAG_INITIALIZED in a few bizarre places having to do with mbuf header copies previously. - When an mbuf is copied in ip_input(), we no longer need to explicitly copy the label because it will get handled by the m_tag code now. - No longer any weird handling of MAC labels in if_loop.c during header copies. - Add MPC_LOADTIME_FLAG_LABELMBUFS flag to Biba, MLS, mac_test. In mac_test, handle the label==NULL case, since it can be dynamically loaded. In order to improve performance with this change, introduce the notion of "lazy MAC label allocation" -- only allocate m_tag storage for MAC labels if we're running with a policy that uses MAC labels on mbufs. Policies declare this intent by setting the MPC_LOADTIME_FLAG_LABELMBUFS flag in their load-time flags field during declaration. Note: this opens up the possibility of post-boot policy modules getting back NULL slot entries even though they have policy invariants of non-NULL slot entries, as the policy might have been loaded after the mbuf was allocated, leaving the mbuf without label storage. Policies that cannot handle this case must be declared as NOTLATE, or must be modified. - mac_labelmbufs holds the current cumulative status as to whether any policies require mbuf labeling or not. This is updated whenever the active policy set changes by the function mac_policy_updateflags(). The function iterates the list and checks whether any have the flag set. Write access to this variable is protected by the policy list; read access is currently not protected for performance reasons. This might change if it causes problems. - Add MAC_POLICY_LIST_ASSERT_EXCLUSIVE() to permit the flags update function to assert appropriate locks. - This makes allocation in mac_init_mbuf() conditional on the flag. Reviewed by: sam Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* No need to unlock if error detected before locking.hsu2003-04-131-2/+4
| | | | Submitted by: harti
* Introduce an M_ASSERTPKTHDR() macro which performs the very common taskdes2003-04-083-7/+5
| | | | | | | of asserting that an mbuf has a packet header. Use it instead of hand- rolled versions wherever applicable. Submitted by: Hiten Pandya <hiten@unixdaemons.com>
* Don't use ovbcopy(); use void * instead of char *.des2003-04-041-6/+3
|
* o netisr_queue() returns 1 on success and 0 on failure,maxim2003-03-271-1/+1
| | | | | | fix a typo (?) in rev. 1.90. PR: kern/50163
* - Use if_broadcastaddr from struct ifnet rather than relying onmdodd2003-03-212-3/+4
| | | | | | | extern 'etherbroadcastaddr'. - Make 'etherbroadcastaddr' static. Reviewed by: imp
* Assignment could be NULL, check.mdodd2003-03-211-1/+1
|
* Use td->td_ucred instead of td->td_proc->p_ucred.jhb2003-03-201-2/+2
|
* - Use IFP2AC().mdodd2003-03-162-5/+73
| | | | | | - Support IFF_MONITOR. - Borrow some consistency for if_input() routines from if_ethersubr.c. - Correct comments regarding fddi_input() that no longer apply.
* Fix whitespace issues.mdodd2003-03-151-20/+20
|
* Don't strip header from packets before input routine is called.mdodd2003-03-152-6/+27
|
* Use if_printf().mdodd2003-03-152-4/+3
|
* iso88025_ifattach() changes:mdodd2003-03-152-3/+22
| | | | | - Call if_attach(). - Conditionally call bpfattach() based on second function argument.
* - Style(9) changes.mdodd2003-03-151-4/+11
| | | | | | - Remove unneeded assignment. - Increment if_oerrors as per if_fddisubr.c. - Wrap ISO code with conditional.
* Stray } forgotten by manual merging.mdodd2003-03-151-1/+0
|
* - Remove stray ).mdodd2003-03-151-2/+6
| | | | | - Add missing breaks. - Add missing if_noproto++.
* Revert part of 1.37; use bcopy() like if_fddisubr.c.mdodd2003-03-151-3/+1
|
* - Increment ifp->if_noproto when appropriate.mdodd2003-03-151-11/+19
| | | | | - Use 'goto dropanyway' when appropriate. - Move dropanyway label out of switch for readability.
* Update interface statistics after MAC and IFF_UP|IFF_RUNNING checks.mdodd2003-03-151-6/+6
|
* - Adopt tests for (IFF_UP|IFF_RUNNING) and non local unicast packetsmdodd2003-03-151-5/+20
| | | | | in promiscuous mode from if_fddisubr.c. - Add comment to reduce diffs.
* Add MAC support.mdodd2003-03-151-0/+12
| | | | This is the same code that was added in 1.70 of if_fddisubr.c
* Use llc_control rather than llc_snap.control.mdodd2003-03-151-1/+1
|
* - Add comment.mdodd2003-03-151-2/+5
| | | | - Whitespace fixes.
* Reduce code differences.mdodd2003-03-153-19/+20
|
* Use ISO88025_ADDR_LEN where appropriate.mdodd2003-03-151-6/+6
|
* Don't use etherbroadcastaddr; use iso88025_broadcastaddr.mdodd2003-03-151-4/+6
|
* - Remove definition of senderr() from iso88025.h.mdodd2003-03-153-3/+3
| | | | - Use definition of senderr() from if_ethersubr.c.
* Some whitespace/style/readability changes.mdodd2003-03-151-16/+29
|
* Add iso88025_resolvemulti().mdodd2003-03-151-0/+87
| | | | Cribbed from net/if_fddisubr.c
* Fix formatting of iso88025_ifattach().mdodd2003-03-151-9/+9
|
* Re-order and prune includes.mdodd2003-03-152-17/+9
|
* Add module data and version.mdodd2003-03-152-0/+18
|
* s/llc_un.type_snap/llc_snap/gmdodd2003-03-151-9/+9
|
* Formatting and whitespace changes.mdodd2003-03-151-9/+9
|
* This corrects a longstanding endian bug in processing LLC/SNAP encodedharti2003-03-132-5/+5
| | | | | | | | | | | frames. A comment in if_atm.h suggests that both macros, that for extracting the ethertype and that for inserting it, handle their argument in host byte order. In fact, the inserting macro treated its argument as an opposite host order short and the calling code feeds it the result of htons(). This happens to work on i386, but fails on sparc. Make the macro use real host endianess. Reviewed by: kjc, atm@
* Pass the correct malloc flags to m_tag_alloc().mux2003-03-131-1/+1
|
* correct two more flag misuses; m_tag* use malloc flagssam2003-03-121-1/+1
|
* Note that MAJOR_AUTO is now the default if d_maj is not initialized. Thisphk2003-03-091-1/+0
| | | | | | | | is more robust and prevents the hijacking of /dev/console for the typical mistake. Remove unneeded MAJOR_AUTO uses, it is only needed explicitly now if the driver source has cross-branch compatibility to old releases.
* Discard the packet if the netisr queue is null instead of panicing, forjlemon2003-03-081-2/+8
| | | | the benefit of modules which are compiled differently than the kernel.
* Revert last change and insure the driver can support other address families.jlemon2003-03-081-0/+18
| | | | Pointed out by: ume, matusita
* The tun driver is INET only. Don't pretend to support other address families.jlemon2003-03-081-25/+0
| | | | Sponsored by: DARPA, NAI Labs
* Finish driving a stake through the heart of netns and the associatedpeter2003-03-059-162/+0
| | | | | | ifdefs scattered around the place - its dead Jim! The SMB stuff had stolen AF_NS, make it official.
* GC unused files.jlemon2003-03-042-149/+0
|
* Update netisr handling; Each SWI now registers its queue, and all queuejlemon2003-03-0416-327/+412
| | | | | | | | | | 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
* Make nokqfilter() return the correct return value.phk2003-03-031-1/+0
| | | | Ditch the D_KQFILTER flag which was used to prevent calling NULL pointers.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-034-53/+31
| | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl)
* Revert last commit. File tracks NetBSD.mdodd2003-03-031-13/+13
| | | | Requested by: sam
* sizeof(struct llc) -> LLC_SNAPFRAMELENmdodd2003-03-037-31/+31
| | | | | sizeof(struct ether_header) -> ETHER_HDR_LEN sizeof(struct fddi_header) -> FDDI_HDR_LEN
* Use IFP2AC() rather than casting to struct arpcom *mdodd2003-03-031-2/+2
|
* De-register.mdodd2003-03-033-19/+19
|
OpenPOWER on IntegriCloud