summaryrefslogtreecommitdiff
path: root/sys/net/if_trunk.c
AgeCommit message (Collapse)Author
2015-09-10pass a cookie argument to interface input handlers that can be usedMike Belopuhov
to pass additional context or transient data with the similar life time. ok mpi, suggestions, hand holding and ok from dlg
2015-09-10move the if input handler list to an SRP list.David Gwynne
instead of having every driver that manipulates the ifih list understand SRPLs, this moves that processing into if_ih_insert and if_ih_remove functions. we rely on the kernel lock to serialise the modifications to the list. tested by mpi@ ok mpi@ claudio@ mikeb@
2015-07-17Drop promiscuously received packets if the trunk(4) interface is notMartin Pieuchot
in promiscuous mode. The long story is that claudio@ had his ssh session reset multiple times in the hackroom because czarkoff@'s machine was sending reset. We figured out that the packet was reaching pf because of this missing check. pf would then not find any state and sent a reset. Analyzed with and ok phessler@, claudio@
2015-07-02Unify the check for up & running between all pseudo-drivers.Martin Pieuchot
2015-07-02By design if_input_process() needs to hold a reference on the receivingMartin Pieuchot
ifp in order to access its ifih handlers. So get rid of if_get() in the various ifih handlers we know the ifp is live at this point. ok dlg@
2015-06-30Rename if_output() into if_enqueue() to avoid confusion with commentsMartin Pieuchot
talking about (*ifp->if_output)(). ok claudio@, dlg@
2015-06-29count if_ibytes in if_input like we do for if_ipackets.David Gwynne
tweaks and ok mpi@
2015-06-24Increment if_ipackets in if_input().Martin Pieuchot
Note that pseudo-drivers not using if_input() are not affected by this conversion. ok mikeb@, kettenis@, claudio@, dlg@
2015-06-16Store a unique ID, an interface index, rather than a pointer to theMartin Pieuchot
receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
2015-06-15Fix a double free in the destroy path triggered when a second process,Martin Pieuchot
in my case dhclient(8), races with ifconfig(8) to free the descriptors of the joined multicast groups. While here reduce the difference with carp(4). ok dms@
2015-06-09Convert trunk(4) to if_input().Martin Pieuchot
ok dlg@
2015-05-26Now that the Ethernet header is always passed as part of the mbuf, killMartin Pieuchot
the second (unused) argument of the input packet handlers. ok dlg@
2015-05-15Introduce if_output(), a function do to the last steps before enqueuingMartin Pieuchot
a packet on the sending queue of an interface. Tested by many, thanks a lot! ok dlg@, claudio@
2015-05-14Allocate the input packet handler as part of the trunk_port structureMartin Pieuchot
since they have the same lifetime. Requested by and ok dlg@
2015-05-13Get rid of the last "#if NTRUNK" by overwriting trunk ports' outputMartin Pieuchot
function. ok claudio@, reyk@
2015-05-11Take trunk(4) out of ether_input().Martin Pieuchot
Each physical interface of a trunk now gets a specific ifih (interface input handler) that runs before ether_input(). Tested by sthen@, dlg@, Theo Buehler and <mxb AT alumni.chalmers DOT se> ok sthen@, dlg@
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2014-12-19unifdef INET in net code as a precursor to removing the pretend option.Ted Unangst
long live the one true internet. ok henning mikeb
2014-12-04use siphash for trunk loadbalancing. ok deraadtTed Unangst
2014-12-01Make every interface with a watchdog register it's own slow timeoutMike Belopuhov
This removes the system wide if_slowtimo timeout and lets every interface with a valid if_watchdog method register it's own in order to get rid of the ifnet loop in the softclock context and avoid further complications with concurrent access to the ifnet list. ok deraadt, input and ok mpi, looked at by claudio
2014-11-18move arc4random prototype to systm.h. more appropriate for most codeTed Unangst
to include that than rdnvar.h. ok deraadt dlg
2014-07-22Fewer <netinet/in_systm.h> !Martin Pieuchot
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-09bpf code surgery / shuffling / simplification.Henning Brauer
the various bpf_mtap_* are very similiar, they differ in what (and to some extent how) they prepend something, and what copy function they pass to bpf_catchpacket. use an internal _bpf_mtap as "backend" for bpf_mtap and friends. extend bpf_mtap_hdr so that it covers all common cases: if dlen is 0, nothing gets prepended. copy function can be given, if NULL the default bpf_mcopy is used. adjust the existing bpf_mtap_hdr users to pass a NULL ptr for the copy fn. re-implement bpf_mtap_af as simple wrapper for bpf_mtap_hdr. re-implement bpf_mtap_ether using bpf_map_hdr re-implement bpf_mtap_pflog as trivial bpf_mtap_hdr wrapper ok bluhm benno
2014-03-10if_lladdr -> if_sadl, no functional change.Martin Pieuchot
ok mikeb@
2013-11-21Remove unneeded include.Martin Pieuchot
ok deraadt@
2013-11-18Convert trunk(4) to use a detachhook, discussed at b2k13 with many.Martin Pieuchot
While here add a comment explaining detach hooks' order of execution when destroying/detaching an interface.
2013-06-20Revert previous and unbreak asr, the new include should be protected.Martin Pieuchot
Reported by naddy@
2013-06-20Allocate the various hook head descriptors as part of the ifnetMartin Pieuchot
structure rather than doing various M_WAITOK allocations during the *attach() functions, we always rely on them anyway. ok mikeb@, uebayasi@
2013-05-11Set trunk(4)'s MTU to that of the first trunkport. Allows trunk to work withStuart Henderson
jumbo/baby-jumbo frames. To avoid problems with mismatches between trunkports, any additional ports must have the same MTU as already set on the trunk(4). Based on changes made in FreeBSD. Tested by myself and jj@, ok reyk@
2013-04-02Instead of storing the link-level address of every interface in a globalMartin Pieuchot
array indexed by interface numbers, add a new field to the interface descriptor pointing to it. claudio@ and todd@ like it, ok mikeb@
2013-03-28no need for a lot of code to include proc.hTed Unangst
2013-02-25trunk_bcast_start sent packets on all its member interfaces by copyingDavid Gwynne
the mbuf it just sent on the previous interface. this is bad because the previous interface could have modified the mbuf chain, which can make the subsequent m_copym()s panic. this copies the dance that rtsock.c does for broadcasting mbufs which copies the mbuf before transmit, except for the last interface which it handles outside the loop. tested by halex@ who verified it fixes his panic. ok claudio@ deraadt@
2011-10-28Take more care to ensure all callbacks are initialized. In particularKenneth R Westerback
tr_linkstate() was not initialized in trunk_rr_attach(), and tr_init() and tr_stop() were missing in trunk_lb_attach(). Fixes crash triggered by changing trunkproto, reported by Anders Berggren on bugs@. ok mpf henning
2011-01-28Fix another memory leak by replacing m_free() with m_freem() in trunk'sReyk Floeter
broadcast mode. ok blambert@ mikeb@
2010-11-12avoid pointer arithmetic on void *David Hill
no change in .o ok claudio
2010-05-08Upon changing the MAC address of an if_trunk interface, all ports are switchedStefan Sperling
to the new MAC. But subsequently added ports were still being assigned the old MAC address because it was copied from the wrong place. Give newly added trunk ports the current MAC of the master port, rather than the saved MAC of the master port. The saved MAC should only be used to restore the original MAC address of the interface when it is removed from the trunk. ok claudio@
2010-04-23Use proper Queen's English in a comment. Drive-by fix, no functional change.Stefan Sperling
2010-04-20remove proc.h include from uvm_map.h. This has far reaching effects, asTed Unangst
sysctl.h was reliant on this particular include, and many drivers included sysctl.h unnecessarily. remove sysctl.h or add proc.h as needed. ok deraadt
2010-04-17use ifnewlladdr() for trunk lladdr changes, tooTheo de Raadt
ok stsp
2010-01-12set the length of the send queue to 1.David Gwynne
this prevents the ultimate length of the queue of the underlying interface from being artificially inflated while hte vlan/trunk queue is filled and then dumped wholesale on the underlying interface, which will dump its massive queue wholesale on the chip. tx mitigation is only triggered on real interfaces now (which is where the cost is) ok beck@ original diff ok kjc@ henning@
2009-11-18do not do setup that ether_ifattach() takes care of; ok jsgTheo de Raadt
2009-09-17Add an splassert check trunk_enqueue() calling this function at anythingClaudio Jeker
below splnet() is a good recipe for doom. OK henning, reyk, mpf
2009-09-09remove inline functions and move some code from the trunk_lacp_input()Reyk Floeter
API function directly to lacp_input() to simplify the code path. ok mpf@
2009-07-16Backout rev1.79 of if_vlan.c and rev1.66 of if_trunk.c;Thordur I. Bjornsson
Changes in those revision limited the send queue to one slot. This breaks NFS over vlan(4) has discovered by sthen@. "just plain back it out." deraadt@
2009-07-13make the send queue one slot long. this forces packets off the virtualDavid Gwynne
interfaces down to the queue on the physical interface immediately. this avoids having the tx mitigation code wasting cpu time dicking around with simply shuffling packets off virtual interface queues and lets it do its job of ammortising the cost of calling a real interfaces start routine. it also prevents an artificial inflation of the physical interfaces queue length where packets could hide on the virtual interfaces queues during softnet before being dumped en masse onto the hardware. this will smooth out the rate at which packets are submitted to the hardware. kjc@ says this has no impact on altq. ya henning@
2009-01-27handle HW VLAN tags being passed down; from BradChristian Weisgerber
2009-01-27make the hardware/no hardware tag stripping cases consistent and don'tChristian Weisgerber
hash the VLAN priority; ok henning@
2008-12-14Allow trunk_hashmbuf() to take HW VLAN tagging into consideration.Brad Smith
ok mpf@ naddy@
2008-12-14Since trunk_hashmbuf() and thus trunk_lb_gethdr() are no longer specificBrad Smith
to the loadbalance code rename trunk_lb_gethdr() to just trunk_gethr(). ok mpf@