summaryrefslogtreecommitdiffstats
path: root/sys/net/if_fddisubr.c
Commit message (Collapse)AuthorAgeFilesLines
* Break at_ifawithnet() into two variants:rwatson2009-06-241-0/+1
| | | | | | | | | | | | | | | - at_ifawithnet(), which acquires an locks it needs and returns an at_ifaddr reference. - at_ifawithnet_locked(), which relies on the caller locking at_ifaddr_list, and returns a pointer rather than a reference. Update various consumers to prefer one or the other, including ether and fddi output, to properly release at_ifaddr references. Rework at_control() to manage locking and references in a manner identical to in_control(). MFC after: 6 weeks
* Switch cmd argument to u_long. This matches what if_ethersubr.c does andrdivacky2009-06-211-1/+1
| | | | | | | allows the code to compile cleanly on amd64 with clang. Reviewed by: rwatson Approved by: ed (mentor)
* The llentry *lle is only used in cases of INET or INET6.bz2009-06-101-3/+6
| | | | | | | Put the variable declaration under proper #ifdefs. In case variables are only needed for one of the two AFs more them into proper scope.
* Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERICrwatson2009-06-051-1/+0
| | | | | | | | and used in a large number of files, but also because an increasing number of incorrect uses of MAC calls were sneaking in due to copy-and-paste of MAC-aware code without the associated opt_mac.h include. Discussed with: pjd
* Change if_output to take a struct route as its fourth argument in orderkmacy2009-04-161-3/+6
| | | | | | to allow passing a cached struct llentry * down to L2 Reviewed by: rwatson
* Remove the rt argument from nd6_storelladdr() becauseqingli2008-12-171-1/+1
| | | | rt is no longer accessed.
* This main goals of this project are:qingli2008-12-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. separating L2 tables (ARP, NDP) from the L3 routing tables 2. removing as much locking dependencies among these layers as possible to allow for some parallelism in the search operations 3. simplify the logic in the routing code, The most notable end result is the obsolescent of the route cloning (RTF_CLONING) concept, which translated into code reduction in both IPv4 ARP and IPv6 NDP related modules, and size reduction in struct rtentry{}. The change in design obsoletes the semantics of RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland applications such as "arp" and "ndp" have been modified to reflect those changes. The output from "netstat -r" shows only the routing entries. Quite a few developers have contributed to this project in the past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and Andre Oppermann. And most recently: - Kip Macy revised the locking code completely, thus completing the last piece of the puzzle, Kip has also been conducting active functional testing - Sam Leffler has helped me improving/refactoring the code, and provided valuable reviews - Julian Elischer setup the perforce tree for me and has helped me maintaining that branch before the svn conversion
* convert calls to IFQ_HANDOFF to if_transmitkmacy2008-11-221-1/+1
|
* Hide an unused variable in case we compile without INET.bz2008-11-061-0/+3
| | | | | | | Include ethernet.h directly so that the constants are always defined. Makes fddi compile without INET. MFC after: 2 months
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).des2008-10-231-2/+2
| | | | MFC after: 3 months
* Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.ru2008-03-251-3/+1
| | | | | | | | | | Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true since the advent of MBUMA. Reviewed by: arch There are ongoing disputes as to whether we want to switch to directly using UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
* Merge first in a series of TrustedBSD MAC Framework KPI changesrwatson2007-10-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | 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
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-221-1/+2
| | | | | | | | | | | | | 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
* Return mbuf pointer or NULL from ip_fastforward() as the mbuf pointerandre2006-01-181-1/+1
| | | | | | | | | | | may have changed by m_pullup() during fastforward processing. While this is a bug it is actually never triggered in real world situations and it is not remotely exploitable. Found by: Coverity Prevent(tm) Coverity ID: CID780 Sponsored by: TCP/IP Optimization Fundraise 2005
* - Store pointer to the link-level address right in "struct ifnet"ru2005-11-111-11/+7
| | | | | | | | | | 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.
* - Make IFP2ENADDR() a pointer to IF_LLADDR() rather than anotherru2005-11-111-2/+4
| | | | | | | | copy of Ethernet address. - Change iso88025_ifattach() and fddi_ifattach() to accept MAC address as an argument, similar to ether_ifattach(), to make this work.
* Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE andrwatson2005-08-091-2/+4
| | | | | | | | | | | | | | IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to ifnet.if_drv_flags. Device drivers are now responsible for synchronizing access to these flags, as they are in if_drv_flags. This helps prevent races between the network stack and device driver in maintaining the interface flags field. Many __FreeBSD__ and __FreeBSD_version checks maintained and continued; some less so. Reviewed by: pjd, bz MFC after: 7 days
* When allocating link layer ifnet address list entries inrwatson2005-08-021-2/+6
| | | | | | | | | ifp->if_resolvemulti(), do so with M_NOWAIT rather than M_WAITOK, so that a mutex can be held over the call. In the FDDI code, add a missing M_ZERO. Consumers are already aware that if_resolvemulti() can fail. MFC after: 1 week
* Stop embedding struct ifnet at the top of driver softcs. Instead thebrooks2005-06-101-9/+7
| | | | | | | | | | | | | | | | | | | | 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
* - Break after nested switch.mdodd2005-03-241-0/+2
| | | | - Default returns an error.
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Replace IF_HANDOFF with new IFQ_HANDOFF to enqueue with ALTQ once enabled onmlaier2004-06-151-2/+4
| | | | the respective drivers.
* This commit does two things:luigi2004-04-251-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* arpcom untangling:luigi2004-04-241-3/+2
| | | | | | | | | - use ifp instead if &ac->ac_if in a couple of nd6* calls; this removes a useless dependency. - use IFP2AC(ifp) instead of an extra variable to point to the struct arpcom; this does not remove the nesting dependency between arpcom and ifnet but makes it more evident.
* replace Bcmp() with the same bcmp() used in the rest of the file.luigi2004-04-181-2/+2
|
* + rename and document an unused field in struct arpcom (field is stillluigi2004-04-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | there so there are no ABI changes); + replace 5 redefinitions of the IPF2AC macro with one in if_arp.h Eventually (but before freezing the ABI) we need to get rid of struct arpcom (initially with the help of some smart #defines to avoid having to touch each and every driver, see below). Apart from the struct ifnet, struct arpcom now only stores a copy of the MAC address (ac_enaddr, but we already have another copy in the struct ifnet -- if_addrhead), and a netgraph-specific field which is _always_ accessed through the ifp, so it might well go into the struct ifnet too (where, besides, there is already an entry for AF_NETGRAPH data...) Too bad ac_enaddr is widely referenced by all drivers. But this can be fixed as follows: #define ac_enaddr ac_if.the_original_ac_enaddr_in_struct_ifnet (note that the right hand side would likely be a pointer rather than the base address of an array.)
* whoops, forgot to fix these places where arpresolve() was usedluigi2004-04-041-1/+1
| | | | Detected by: tinderbox
* Handle AF_ARP in *_output()mdodd2004-03-141-0/+27
| | | | Obtained from: NetBSD
* Const-poison ethernet and FDDI broadcast address constants, as theyrwatson2004-03-091-1/+1
| | | | are accessed read-only.
* Introduce ip_fastforward and remove ip_flow.andre2003-11-141-1/+1
| | | | | | | | | | | | | | | Short description of ip_fastforward: o adds full direct process-to-completion IPv4 forwarding code o handles ip fragmentation incl. hw support (ip_flow did not) o sends icmp needfrag to source if DF is set (ip_flow did not) o supports ipfw and ipfilter (ip_flow did not) o supports divert, ipfw fwd and ipfilter nat (ip_flow did not) o returns anything it can't handle back to normal ip_input Enable with sysctl -w net.inet.ip.fastforwarding=1 Reviewed by: sam (mentor)
* Remove unnecessary (caddr_t) casts of if_broadcastaddr.imp2003-10-231-2/+2
|
* - Use IFP2AC().mdodd2003-03-161-3/+39
| | | | | | - Support IFF_MONITOR. - Borrow some consistency for if_input() routines from if_ethersubr.c. - Correct comments regarding fddi_input() that no longer apply.
* Use if_printf().mdodd2003-03-151-2/+1
|
* Update interface statistics after MAC and IFF_UP|IFF_RUNNING checks.mdodd2003-03-151-6/+6
|
* Reduce code differences.mdodd2003-03-151-9/+9
|
* - Remove definition of senderr() from iso88025.h.mdodd2003-03-151-1/+1
| | | | - Use definition of senderr() from if_ethersubr.c.
* Re-order and prune includes.mdodd2003-03-151-1/+2
|
* Formatting and whitespace changes.mdodd2003-03-151-9/+9
|
* Finish driving a stake through the heart of netns and the associatedpeter2003-03-051-17/+0
| | | | | | ifdefs scattered around the place - its dead Jim! The SMB stuff had stolen AF_NS, make it official.
* Update netisr handling; Each SWI now registers its queue, and all queuejlemon2003-03-041-31/+21
| | | | | | | | | | 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
* sizeof(struct llc) -> LLC_SNAPFRAMELENmdodd2003-03-031-2/+2
| | | | | sizeof(struct ether_header) -> ETHER_HDR_LEN sizeof(struct fddi_header) -> FDDI_HDR_LEN
* Reduce code duplication. This adds the function rt_check() to route.c.mdodd2003-03-021-22/+5
| | | | Approved by: sam (in principle)
* Back out M_* changes, per decision of the TRB.imp2003-02-191-5/+5
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-5/+5
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* network interface and link layer changes:sam2002-11-151-9/+16
| | | | | | | | | | | | o on input don't strip the Ethernet header from packets o input packet handling is now done with if_input o track changes to ether_ifattach/ether_ifdetach API o track changes to bpf tapping o call ether_ioctl for default handling of ioctl's o use constants from net/ethernet.h where possible Reviewed by: many Approved by: re
* Use if_printf(ifp, "blah") instead ofbrooks2002-10-211-2/+1
| | | | printf("%s%d: blah", ifp->if_name, ifp->if_xname).
* When a packet is sent via a FDDI interface, perform appropriate MACrwatson2002-10-201-0/+12
| | | | | | | | | transmission checks; when it is received, label the packet appropriately. Although we don't have a local FDDI setup to test this with, the labeling and checks are identical to other interface classes. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Fix some harmless mis-indents.phk2002-10-011-1/+1
| | | | Spotted by: FlexeLint
* - Merge the pdq driver (if_fpa and if_fea) from NetBSD.mdodd2002-03-291-3/+10
| | | | | Among other things this gets us ifmedia support. - Update fddi_ifattach() to take an additional argument.
* - Define fddibroadcastaddr in if_fddisubr.c.mdodd2002-03-291-0/+99
| | | | - Add fddi_ifdetach() and fddi_ioctl().
OpenPOWER on IntegriCloud