summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix long lines in comment introduced in previous commit.glebius2005-02-241-5/+6
|
* When prepending an LCC SNAP header to an atalk outgoing ethernet packet,rwatson2005-02-221-1/+1
| | | | | | | allocate the additional mbuf (if needed) using a non-sleeping memory allocation. MFC after: 7 days
* Add CARP (Common Address Redundancy Protocol), which allows multipleglebius2005-02-221-0/+26
| | | | | | | | | | | | | hosts to share an IP address, providing high availability and load balancing. Original work on CARP done by Michael Shalayeff, with many additions by Marco Pfatschbacher and Ryan McBride. FreeBSD port done solely by Max Laier. Patch by: mlaier Obtained from: OpenBSD (mickey, mcbride)
* Allocate the M_VLANTAG m_pkthdr flag, and use it to indicate thatru2005-02-181-4/+4
| | | | | | | | | | | | | | | | a packet has VLAN mbuf tag attached. This is faster to check than m_tag_locate(), and allows us to use the tags in non-vlan(4) VLAN producers. The first argument to VLAN_OUTPUT_TAG() is now unused but retained for backward compatibility. While here, embellish a fix in rev. 1.174 of if_ethersubr.c -- it now checks for packets with VLAN (mbuf) tags, and it should now be possible to bridge(4) on vlan(4)'s whose parent interfaces support VLAN decapsulation in hardware. Reviewed by: sam
* Check for non-NULL ac_netgraph field in interface arpcom, instead ofglebius2005-02-141-4/+4
| | | | | | checking global presence of ng_ether(4). Reviewed by: ru
* If no vlan(4) interfaces are configured for the interface, and theru2005-02-141-3/+10
| | | | | | | | | driver did VLAN decapsulation in hardware, we were passing a frame as if it came for the parent (non-VLAN) interface. Stop this from happening. Reminded by: glebius Security: This could pose a security risk in some setups
* - Reduce number of arguments passed to dummynet_io(), we already have cookieglebius2005-01-161-2/+1
| | | | | in struct ip_fw_args itself. - Remove redundant &= 0xffff from dummynet_io().
* o Clean up interface between ip_fw_chk() and its callers:glebius2005-01-141-4/+6
| | | | | | | | | | | | | | | | - ip_fw_chk() returns action as function return value. Field retval is removed from args structure. Action is not flag any more. It is one of integer constants. - Any action-specific cookies are returned either in new "cookie" field in args structure (dummynet, future netgraph glue), or in mbuf tag attached to packet (divert, tee, some future action). o Convert parsing of return value from ip_fw_chk() in ipfw_check_{in,out}() to a switch structure, so that the functions are more readable, and a future actions can be added with less modifications. Approved by: andre MFC after: 2 months
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Fix packet flow when both ng_ether(4) and bridge(4) are in use:glebius2004-10-121-46/+2
| | | | | | | | | | | | | | | - push all bridge logic from if_ethersubr.c into bridge.c make bridge_in() return mbuf pointer (or NULL). - call only bridge_in() from ether_input(), after ng_ether_input() was optinally called. - call bridge_in() from ng_ether_rcv_upper(). Long description: http://lists.freebsd.org/mailman/htdig/freebsd-net/2004-May/003881.html Reported by: Jian-Wei Wang <jwwang at FreeBSD.csie.NCTU.edu.tw> Tested by: myself, Sergey Lyubka Reviewed by: sam Approved by: julian (mentor) MFC after: 2 months
* When harvesting entropy from an ethernet mbuf, do so before freeing therwatson2004-10-111-1/+1
| | | | | | mbuf. RELENG_5 candidate.
* Add a new network interface flag, IFF_NEEDSGIANT, which will allowrwatson2004-07-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | device drivers to declare that the ifp->if_start() method implemented by the driver requires Giant in order to operate correctly. Add a 'struct task' to 'struct ifnet' that can be used to execute a deferred ifp->if_start() in the event that if_start needs to be called in a Giant-free environment. To do this, introduce if_start(), a wrapper function for ifp->if_start(). If the interface can run MPSAFE, it directly dispatches into the interface start routine. If it can't run MPSAFE, we're running with debug.mpsafenet != 0, and Giant isn't currently held, the task is queued to execute in a swi holding Giant via if_start_deferred(). Modify if_handoff() to use if_start() instead of direct dispatch. Modify 802.11 to use if_start() instead of direct dispatch. This is intended to provide increased compatibility for non-MPSAFE network device drivers in the presence of Giant-free operation via asynchronous dispatch. However, this commit does not mark any network interfaces as IFF_NEEDSGIANT.
* Use ETHER_IS_MULTICAST() consistently in ether_resolvemulti().bms2004-07-091-1/+1
| | | | Reviewed by: jmallett
* Don't announce the ethernet address when it's 00:00:00:00:00:00. It'sbrooks2004-07-021-2/+7
| | | | | not of any interest. This primairly happens when vlan(4) interfaces are created.
* When considering an ethernet frame that is not destined for us, do notjoerg2004-06-241-3/+9
| | | | | | | | | | | | | | only allow this to be further processed when bridging is active on that interface, but also if the current packet has a VLAN tag and VLANs are active on our interface. This gives the VLAN layers a chance to also consider the packet (and perhaps drop it instead of the main dispatcher). This fixes a situation where bridging was only active on VLAN interfaces but ether_demux() called on behalf of the main interface had already thrown the packet away. MFC after: 4 weeks
* Make dependencies on the TCP/IP stack conditional on INET / INET6. Thisdes2004-06-241-0/+21
| | | | | | makes it possible to build a kernel with NIC drivers but no TCP/IP stack. Sponsored by: Teleplan AS
* Replace IF_HANDOFF with new IFQ_HANDOFF to enqueue with ALTQ once enabled onmlaier2004-06-151-1/+3
| | | | the respective drivers.
* Add helper functions to calculate the standard ethernet CRC innaddy2004-06-021-0/+73
| | | | | | | | | little/big endian fashion, so that network drivers can just reference the standard implementation and don't have to bring their own. As discussed on arch@. Obtained from: NetBSD
* Add some missing <sys/module.h> includes which are masked by thephk2004-05-301-0/+1
| | | | one on death-row in <sys/kernel.h>
* This commit does two things:luigi2004-04-251-18/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+3
| | | | | | | | | - 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.)
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* + arpresolve(): remove an unused argumentluigi2004-04-041-1/+1
| | | | | | | | | + struct ifnet: remove unused fields, move ipv6-related field close to each other, add a pointer to l3<->l2 translation tables (arp,nd6, etc.) for future use. + struct route: remove an unused field, move close to each other some fields that might likely go away in the future
* Announce ethernet MAC addresss in ether_ifattach().mdodd2004-03-141-0/+3
|
* 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.
* Two minor follow-ups on the MT_TAG removal:mlaier2004-03-021-3/+0
| | | | | | | | ifp is now passed explicitly to ether_demux; no need to look it up again. Make mtag a global var in ip_input. Noticed by: rwatson Approved by: bms(mentor)
* Re-remove MT_TAGs. The problems with dummynet have been fixed now.mlaier2004-02-251-14/+4
| | | | | Tested by: -current, bms(mentor), me Approved by: bms(mentor), sam
* Backout MT_TAG removal (i.e. bring back MT_TAGs) for now, as dummynet ismlaier2004-02-181-2/+15
| | | | | | not working properly with the patch in place. Approved by: bms(mentor)
* Return EACCES rather than ENOBUFS if ipfw blocks a packet on thedwmalone2004-02-151-1/+1
| | | | | | | | | way out at layer 2. PR: 62385 Submitted by: Oleg Bulyzhin <oleg@rinet.ru> Approved by: luigi MFC after: 1 week
* This set of changes eliminates the use of MT_TAG "pseudo mbufs", replacingmlaier2004-02-131-15/+2
| | | | | | | | | | | them mostly with packet tags (one case is handled by using an mbuf flag since the linkage between "caller" and "callee" is direct and there's no need to incur the overhead of a packet tag). This is (mostly) work from: sam Silence from: -arch Approved by: bms(mentor), sam, rwatson
* 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)
* Replace the if_name and if_unit members of struct ifnet with new membersbrooks2003-10-311-3/+2
| | | | | | | | | | | | | 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)
* Merge from p4 (noticed these changes with DES' if_ethersubr.c changes causedimp2003-10-231-3/+3
| | | | | | | | a minor conflict): o Use ETHER_ADDR_LEN in preference to '6'. o Remove two unnecessary (caddr_t) casts. One of them causes problems in my tree where etherbroadcastaddr is const, and (caddr_t) casts the const away.
* Clean up whitespace, remove "register" keyword, ANSIfy.des2003-10-231-25/+17
| | | | No functional changes.
* Comment spelling fix.rwatson2003-10-121-1/+1
|
* Introduce error checking for calls to M_PREPEND():rwatson2003-08-291-1/+3
| | | | | ether_output() when prepending netatalk AFA_PHASE2 llc headers (TRYWAIT). ether_output() when prepending ethernet header to a frame (DONTWAIT).
* use ETHER_IS_MULTICAST instead of explicit checksam2003-08-191-1/+1
|
* Move the MAC entry point to label ethernet-sourced mbufs with a MAC labelrwatson2003-07-131-4/+8
| | | | | | | | | | from the network interface earlier in ether_input(). At some point (no fingers pointed), things were restructured and the labeling operation moved later. This wasn't a problem as BPF_MTAP() relies on the ifnet label not the mbuf label, but there might have been other problems. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Back out rev 1.146 -- it broke the LINT build.obrien2003-05-051-1/+1
| | | | We are about to enter the 5.1 code freeze and things must be buildable.
* Fix some easy, global, lint warnings. In most cases, this meansmarkm2003-04-301-1/+1
| | | | | making some local variables static. In a couple of cases, this means removing an unused variable.
* Tweak to previous commit: increment ifp->if_iqdrops if the m_copy() fails.archie2003-04-231-1/+2
| | | | Suggested by: Neelkanth Natu <neelnatu@yahoo.com>
* Fix a case where the return value from m_copy() was not being checkedarchie2003-04-231-6/+6
| | | | | | | for NULL before proceeding, causing a crash if mbufs were exhausted. MFC after: 3 days Reported by: Mark Gooderum <mark@verniernetworks.com>
* - Use if_broadcastaddr from struct ifnet rather than relying onmdodd2003-03-211-1/+4
| | | | | | | extern 'etherbroadcastaddr'. - Make 'etherbroadcastaddr' static. Reviewed by: imp
* Reduce code differences.mdodd2003-03-151-3/+5
|
* Add module data and version.mdodd2003-03-151-0/+9
|
* Finish driving a stake through the heart of netns and the associatedpeter2003-03-051-90/+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-57/+33
| | | | | | | | | | 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
OpenPOWER on IntegriCloud