summaryrefslogtreecommitdiff
path: root/sys/net/if_ethersubr.c
AgeCommit message (Collapse)Author
2014-10-07remove preliminary AOE (ata over ethernet) support. not finished afterTed Unangst
many years and wide spread demand for support never materialized. time to pack it in.
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-08pull the rx ring accounting out of the mbuf layer now that its all doneDavid Gwynne
via if_rxring things. this effectively deprecates the third argument for MCLGETI and m_clget and makes the mbuf layer no longer care about interfaces and simplifies the allocation paths. the timeout used to measure livelock has been moved to net/if.c. ok mpi@
2014-04-22NULL is cooler than 0 when pointers are concernedHenning Brauer
ok gcc & md5 (aka no binary change)
2014-04-22we used to handle the vlan tag etc insertion very very very late,Henning Brauer
on al already ass embed ethernet frame, which meant: -copy (most of) the existing ethernet header into a ether_vlan_header on the stack -fill the extra fields in ether_vlan_header -set the ether type -m_adj() to make room for the extra space ether_vlan_header needs -m_copyback the ether_vlan_header into the mbuf that involves moving data around, which isn't all that cheap. cleaner & easier to have ether_output prepend the ether_vlan_header instead of the regular ethernet header, which makes the vlan tagging essentially free in most cases. help & ok reyk, naddy; waste of time bikeshedding tech@
2014-04-21g/c hdrcmplt var, we can just set the esrc ptr earlier and re-set it inHenning Brauer
the pseudo_AF_HDRCMPLT case, ok claudio reyk
2014-04-21__inline -> inlineHenning Brauer
2014-04-20factor our ether_addheader for readability; there's more to come thereHenning Brauer
ok claudio reyk
2014-04-20ether_output: instead of assembling the ethernet header and then callingHenning Brauer
carp_rewrite_lladdr to overwrite the src lladdr, get the intended src lladdr before assembling the ethernet header. carp_rewrite_lladdr -> carp_get_srclladdr ok reyk claudio
2014-04-20ether_output: instead of using an esrc buffer in which we copy the intendedHenning Brauer
src lladdr just to copy it from the esrc buffer into the ethernet header a few lines later, use an esrc pointer to figure out where to copy the src lladdr from. ok claudio reyk
2014-04-14"struct pkthdr" holds a routing table ID, not a routing domain one.Martin Pieuchot
Avoid the confusion by using an appropriate name for the variable. Note that since routing domain IDs are a subset of the set of routing table IDs, the following idiom is correct: rtableid = rdomain But to get the routing domain ID corresponding to a given routing table ID, you must call rtable_l2(9). claudio@ likes it, ok mikeb@
2014-03-26bcmp -> memcmpMartin Pieuchot
2014-03-26No need to check here if the destination address is ours, because inMartin Pieuchot
such case loouput() is called not ether_output(). ok claudio@, mikeb@
2014-02-17Convert bcopy()s to memcpy()s.Martin Pieuchot
ok pelikan@, tedu@
2014-01-22Pass the receiving interface pointer to carp_input() instead of re-Martin Pieuchot
reading it from the packet header. While here makes carp_input() take the same arguments as ether_input(). ok bluhm@, mikeb@
2014-01-16Replaces a lookup to find the link-layer address by accessing the if_sadlMartin Pieuchot
member directly. ok mikeb@
2013-11-18use arc4random() for ether_fakeaddr, because it is safeTheo de Raadt
ok tedu
2013-10-23Remove the number of in_var.h inclusions by moving some functions andMartin Pieuchot
global variables to in.h. ok mikeb@, deraadt@
2013-06-05ansi function declarations.David Gwynne
ok sha256
2013-06-03Replace "hot" bcopy() calls in ether_output() with memcpy(). This tells theMark Kettenis
compiler that source and destination are not overlapping, allowing for more aggressive optimization, leading to a significant performance improvement on busy firewalls. Reworking of a diff by dlg@, who did the hard work of benchmarking this. ok deraadt@, mikeb@, henning@, mcbride@, tedu@, matthew@
2013-03-28do not include machine/cpu.h from a .c file; it is the responsibility ofTheo de Raadt
.h files to pull it in, if needed ok tedu
2013-03-15change LIST_END to literal NULL for clarity.Ted Unangst
ok claudio mpi
2013-01-18Relax the restriction on sending frames to trunk(4) members to allow BPF writes.Stuart Henderson
Method (checking for PACKET_TAG_DLT) suggested by claudio, ok mpf
2012-10-05Point an interface directly to its bridgeport configuration, insteadCamiel Dobbelaar
of to the bridge itself. This is ok, since an interface can only be part of one bridge, and the parent bridge is easy to find from the bridgeport. This way we can get rid of a lot of list walks, improving performance and shortening the code. ok henning stsp sthen reyk
2011-07-09begone, fucking rotten appletalk shit. ok roomHenning Brauer
2011-07-08Include PIPEX in kernel by default. And add new sysctl variableYASUOKA Masahiko
`net.pipex.enable' to enable PIPEX. By default, pipex is disabled and it will not process packets from wire. Update man pages and update HOWTO_PIPEX_NPPPD.txt for testers. discussed with dlg@, ok deraadt@ mcbride@ claudio@
2011-07-04Say no to hand-rolled m_adj(). It also kills three XXX.Claudio Jeker
OK dlg@ henning@
2011-01-28Change an m_free() to m_freem() to free the whole mbuf chain and to preventReyk Floeter
a possible memory leak with bpf's BIOCSFILDROP option which is currently used by dhcpd and dhclient. Found by gollo@
2010-10-11Remove some commented code we will never have.Claudio Jeker
2010-08-24legibility fixes:Bret Lambert
1) one statement per line 2) label gets its own line, and doesn't share it with a statement no functional change "Let the turd shine." claudio@
2010-07-02Some functions change the ifp in during ether_input(). This confuses theClaudio Jeker
IFF_PROMISC check that ensures that only local packets make it into the network stack. Check both the original ifp and the new ifp for IFF_PROMISC. Problem identified by Patrick Coleman. OK mcbride@, henning@
2010-06-03Add support for 802.1ad-style QinQ nested VLANs.Christian Weisgerber
QinQ-compliant svlan (service VLAN) interfaces are implemented as a new cloner type, use Ethernet type 0x88a8, and have a dedicated VLAN tag hash to avoid ID conflicts. vlan(4) interfaces can be stacked on top of svlan(4). Originally from reyk@, input from claudio@ and deraadt@ ok claudio@
2010-05-28Rework the way we handle MPLS in the kernel. Instead of fumbling MPLS intoClaudio Jeker
ether_output() and later on other L2 output functions use a trick and over- load the ifp->if_output() function pointer on MPLS enabled interfaces to go through mpls_output() which will then call the link level output function. By setting IFXF_MPLS on an interface the output pointers are switched. This now allows to cleanup the MPLS input and output pathes and fix mpe(4) so that the MPLS code now actually works for both P and PE systems. Tested by myself and michele (A custom kernel with MPLS and mpe enabled is still needed).
2010-05-07Start cleaning up the mess called rtalloc*. Kill rtalloc2, make rtalloc1Claudio Jeker
accept flags for report and nocloning. Move the rtableid into struct route (with a minor twist for now) and make a few more codepathes rdomain aware. Appart from the pf.c and route.c bits the diff is mostly mechanical. More to come... OK michele, henning
2010-05-01incomming -> incomingMichael Knudsen
The ones found in gnu/ left out by intention. ok jmc
2010-04-03document the first byte of the random MAC addressTheo de Raadt
2010-01-12After calling pipex_pppoe_input(), we must goto done to restore the spl.YASUOKA Masahiko
ok mcbride@
2010-01-12Unify the various fake ethernet generators as ether_fakeaddr() whichTheo de Raadt
is safe for both hardware devices and virtual devices ok mpf, kettenis, moaning and groaning and slow acceptance from mcbride XXX should loop checking for uniqueness after new henning diff goes in
2010-01-11Initial import PIPEX. PIPEX(Pppac IP EXtension) is a IP forwardingYASUOKA Masahiko
acceleration for PPP access concentrator. ok mcbride@ dlg@ deraadt@ reyk@.
2009-11-03rtables are stacked on rdomains (it is possible to have multiple routingClaudio Jeker
tables on top of a rdomain) but until now our code was a crazy mix so that it was impossible to correctly use rtables in that case. Additionally pf(4) only knows about rtables and not about rdomains. This is especially bad when tracking (possibly conflicting) states in various domains. This diff fixes all or most of these issues. It adds a lookup function to get the rdomain id based on a rtable id. Makes pf understand rdomains and allows pf to move packets between rdomains (it is similar to NAT). Because pf states now track the rdomain id as well it is necessary to modify the pfsync wire format. So old and new systems will not sync up. A lot of help by dlg@, tested by sthen@, jsg@ and probably more OK dlg@, mpf@, deraadt@
2009-08-12revert my change to m_cluncount which tries to prevent the systemDavid Gwynne
running out of mbufs for rx rings. if the system low watermark is lower than a rx rings low watermark, we'll never send a packet up the stack, we'll always recycle it. found by thib@ on a bge sadface
2009-08-12if we get dangerously low on clusters during interrupts, we needDavid Gwynne
to free some for use on the rx rings on network cards. this modifies m_cluncount to advise callers when we're in such a situation, and makes them responsible for freeing up the cluster for allocation by MCLGETI later. fixes an awesome lockup with sis(4) henning has been experiencing. this is not the best fix, but it is better than the current situation. yep deraadt@ tested by henning@
2009-06-05Initial support for routing domains. This allows to bind interfaces toClaudio Jeker
alternate routing table and separate them from other interfaces in distinct routing tables. The same network can now be used in any doamin at the same time without causing conflicts. This diff is mostly mechanical and adds the necessary rdomain checks accross net and netinet. L2 and IPv4 are mostly covered still missing pf and IPv6. input and tested by jsg@, phessler@ and reyk@. "put it in" deraadt@
2009-03-05Fix a panic in ether_output() when attempting to send multicast traffic onMichele Marchetto
MPLS enabled kernels. ok claudio@
2009-01-28Get rid of the ugly rtentry hack.Michele Marchetto
We can now act as edge node and allow ipv4 packets to enter a Label Switched Path and not just forwarding MPLS packets. OK claudio@
2008-11-25m_cluncount() needs to walk the mbuf chain to correctly uncount all clustersClaudio Jeker
but don't do that in m_free() as that will cause a double loop behaviour when called via m_freem(). OK dlg@, deraadt@
2008-11-24add several backend pools to allocate mbufs clusters of various sizes outDavid Gwynne
of. currently limited to MCLBYTES (2048 bytes) and 4096 bytes until pools can allocate objects of sizes greater than PAGESIZE. this allows drivers to ask for "jumbo" packets to fill rx rings with. the second half of this change is per interface mbuf cluster allocator statistics. drivers can use the new interface (MCLGETI), which will use these stats to selectively fail allocations based on demand for mbufs. if the driver isnt rapidly consuming rx mbufs, we dont allow it to allocate many to put on its rx ring. drivers require modifications to take advantage of both the new allocation semantic and large clusters. this was written and developed with deraadt@ over the last two days ok deraadt@ claudio@
2008-11-23softraid support for ata over ethernet (aoe). this includes a client andTed Unangst
part of a server. there's no configuration yet, and several other drawbacks, but it can be hammered into shape. i haven't moved the code forward in a year, and marco wants it in the tree to hack on.
2008-10-16* Allow ether_input() and vlan_input() to handle incoming packetsChristian Weisgerber
where the tag is stored in the mbuf header. * Make bridge(4) handle interfaces with and without hardware tag support and forward packets inbetween. Help and ok claudio@
2008-10-09Add fallback ioctl handlers for MTU and multicast to ether_ioctl().Brad Smith