summaryrefslogtreecommitdiff
path: root/sys/net/if_vlan.c
AgeCommit message (Collapse)Author
2017-06-22Fix the remaining ';;'s in sys/Tom Cosgrove
2017-05-31make vlan use their parents lladdr all the time, not just when theyre up.David Gwynne
krw@ has been having issues with dhclient on vlan interfaces because i made them only configure the lladdr when they were brought up. dhclient likes to read the mac address and then bring them up. this makes vlan copy the parents lladdr onto the vlan interface when the parent is configured. this probably helps with v6 addresses on vlan interfaces too. the new code still supports configuring a custom lladdr on a vlan interface. this can be done both before and after a parent is configured, and if a parent is removed. while here, if the parent is reconfigured while the vlan is up, dont error if the new parent is the same as the current one. this should make running netstart again less noisy. ok krw@
2017-05-29Pass SIOCGIFMEDIA to vlan's parent interface.Martin Pieuchot
ok krw@, dlg@
2017-01-24A space here, a space there. Soon we're talking real whitespaceKenneth R Westerback
rectification.
2017-01-24add support for multiple transmit ifqueues per network interface.David Gwynne
an ifq to transmit a packet is picked by the current traffic conditioner (ie, priq or hfsc) by providing an index into an array of ifqs. by default interfaces get a single ifq but can ask for more using if_attach_queues(). the vast majority of our drivers still think there's a 1:1 mapping between interfaces and transmit queues, so their if_start routines take an ifnet pointer instead of a pointer to the ifqueue struct. instead of changing all the drivers in the tree, drivers can opt into using an if_qstart routine and setting the IFXF_MPSAFE flag. the stack provides a compatability wrapper from the new if_qstart handler to the previous if_start handlers if IFXF_MPSAFE isnt set. enabling hfsc on an interface configures it to transmit everything through the first ifq. any other ifqs are left configured as priq, but unused, when hfsc is enabled. getting this in now so everyone can kick the tyres. ok mpi@ visa@ (who provided some tweaks for cnmac).
2017-01-23Flag pseudo-interfaces as such in order to call add_net_randomness()Martin Pieuchot
only once per packet. Fix a regression introduced when if_input() started to be called by every pseudo-driver. ok claudio@, dlg@
2017-01-22move counting if_opackets next to counting if_obytes in if_enqueue.David Gwynne
this means packets are consistently counted in one place, unlike the many and various ways that drivers thought they should do it. ok mpi@ deraadt@
2016-10-10ensure prepended ethernet headers are placed on ETHER_ALIGN boundaries,David Gwynne
even if m_prepend allocates a new mbuf in front of the current one. this is done by asking M_PREPEND for ETHER_HDR_LEN + ETHER_ALIGN bytes, and then calling m_adj(ETHER_ALIGN) after. in the case M_PREPEND does not allocate a new mbuf and ends up with the same layout as before. in the allocation case, the requested length is provided on a long boundary. an ETHER_HDR_LEN request would therefore be 6 bytes allocated on a long boundary, when we want it to be at ETHER_ALIGN. by asking for ETHER_HDR_LEN plus ETHER_ALIGN, we can m_adj ETHER_ALIGN off to get us to the ETHER_ALIGN offset. ok yasuoka@ mikeb@
2016-09-03Add support for a multipoint-to-multipoint mode in vxlan(4). In thisReyk Floeter
mode, vxlan(4) must be configured to accept any virtual network identifier with "vnetid any" and added to a bridge(4) or switch(4). This way the driver will dynamically learn the tunnel endpoints and their vnetids for the responses and can be used to dynamically bridge between VXLANs. It is also being used in combination with switch(4) and the OpenFlow tunnel classifiers. With input from yasuoka@ goda@ OK deraadt@ dlg@
2016-05-18rework the srp api so it takes an srp_ref struct that the caller provides.David Gwynne
the srp_ref struct is used to track the location of the callers hazard pointer so later calls to srp_follow and srp_enter already know what to clear. this in turn means most of the caveats around using srps go away. specifically, you can now: - switch cpus while holding an srp ref - ie, you can sleep while holding an srp ref - you can take and release srp refs in any order the original intent was to simplify use of the api when dealing with complicated data structures. the caller now no longer has to track the location of the srp a value was fetched from, the srp_ref effectively does that for you. srp lists have been refactored to use srp_refs instead of srpl_iter structs. this is in preparation of using srps inside the ART code. ART is a complicated data structure, and lookups require overlapping holds of srp references. ok mpi@ jmatthew@
2016-04-19tabs, not spacesDavid Gwynne
no functional change
2016-04-19make setting a vlan interfaces lladdr more likely to workDavid Gwynne
the recent vlan code sets the vlan interfaces mac address to the parent interfaces mac address when it is brought up, and resets it when the vlan interface is brought down. now, if you set a mac address manually (eg, ifconfig vlanX lladdr f0:0b:a7:ba:2b:00), vlan(4) ignores the parents mac address and never resets its own. to make this work, setting a custom lladdr on a vlan interface makes the parent interface promisc so the packets wont be filtered by the hardware interface. setting the mac address to 00:00:00:00:00:00 resets this behavior and makes the interface inherit the parents mac again. issue reported by and fix tested by paul de weerd
2016-04-15rename ifv_p to ifv_ifp0David Gwynne
this makes it more clear to the casual reader that it refers to the parent interface, which is consistently referred to as ifp0 in the rest of the vlan (and carp) code. this is a good idea from mpi@
2016-04-15rework vlan config to make it mpsafe and done by standard ioctlsDavid Gwynne
configuration of the vlan parent interface and the vlan id should come via the IFPARENT and VNETID ioctls now. the vlan specific ioctls are still available via a compat layer, but that will go away a bit further into this release cycle. the parent interface may only be configured while the vlan is down. the vnetid may be changed at runtime, but will generate link state changes across that event. the vlan is implicitily brought up when an address is assigned, which brings it in line with all our other network drivers. the legacy vlan ioctl still imply bringing the interface up because that's what it used to do. the code that brings vlans up and down is now simplified because it no longer supports changing the parent at run time. most of that code now adds state to the parent when bringing the vlan up, and bringing the interface down just removes it in reverse. these simplifications in turn make it possible for us to transmit packets on vlan interfaces without holding the big lock, so its now marked as MPSAFE. ok jmatthew@ sthen@ mpi@
2016-04-13We're always ready! So send IFQ_SET_READY() to the bitbucket.Martin Pieuchot
2016-04-04turns out EVL_ENCAPLEN is 4, not 18 or sizeof(*evl).David Gwynne
2016-03-29the stack checks the mac address of rxed packets, so vlan(4) doesnt have toDavid Gwynne
ok mpi@ claudio@
2016-03-29use sizeof(*evl) instead of EVL_ENCAPLEN in vlan_inputDavid Gwynne
2016-03-28turn ifv_p into an interface index instead of a real pointer to the parentDavid Gwynne
ok mpi@ jmatthew@
2016-03-18refactor the vlan multicast list handling.David Gwynne
the previous code had vlan_ether_purgemulti and vlan_ether_resetmulti, both of which did too many things. purgemulti would try and remove the multicast entries from the parent, and then free the local copies of the addresses. resetmulti would try to remove the address from the parent, and then optionally try to add them to a new parent. resetmulti in particular makes the overall vlan config steps fairly twisty. the refactor offers vlan_multi_apply, and vlan_multi_free. multi_apply simply adds or removes the multicast addresses from a parent interface. it is now up to the config steps to call them appropriately when configuring a parent or a new parent. vlan_multi_free only deletes the memory associated with the vlans multicast addresses. vlan_multi_apply is called when a parent is configured (ie, ifconfig vlan0 up), or unconfigured (ifconfig vlan0 down or a detach of the parent). vlan_multi_free is called when a vlan interface is destroyed (ifconfig vlan0 destroy). ok mpi@
2016-03-13i forgot to rename p to ifp0 in vlan_configDavid Gwynne
still no binary change.
2016-03-13consistencly name ifnet pointers like we did in carpDavid Gwynne
the vlan interface is ifp, the vlans parent interface is ifp0, the new interface parent is newifp0. requested by mpi@ no binary change
2016-03-03factor out the injection of a vlan shim into an ethernet frameDavid Gwynne
vlan_inject() will be reused by mpw(4) in the future. ok mpi@
2016-01-13dont propagate any of the parent interfaces offload features on svlanDavid Gwynne
this avoids confusion about checksum offload if you configure ips on svlan interfaces on top of interfaces that do offload, like bge or em. the problem was reported by and this fix was tested by denis fondras analyzed by naddy@ thanks guys
2015-12-08vlan doenst have to handle SIOCGIFADDR cos the stack does it.David Gwynne
ok mpi@
2015-12-05remove old lint annotationsTed Unangst
2015-12-03Use SRPL_HEAD() and SRPL_ENTRY() to be consistent with and allow toMartin Pieuchot
fallback to a SLIST. ok dlg@, jasper@
2015-11-10dont use IF_DROP when there was some arbitary problem sending a packet.David Gwynne
IF_DROP increments the drop counter on the send queue, it exists to indicate a drop on the send queue. if there was an error sending a packet be content incrementing if_oerrors. ok mpi@ uebayasi@
2015-10-25arp_ifinit() is no longer required.Martin Pieuchot
2015-10-05Revert if_oqdrops accounting changes done in kernel, per request from mpi@.Masao Uebayashi
(Especially adding IF_DROP() after IFQ_ENQUEUE() was completely wrong because IFQ_ENQUEUE() already does it. Oops.) After this revert, the situation becomes: - if_snd.ifq_drops is incremented in either IFQ_ENQUEUE() or IF_DROP(), but it is not shown to userland, and - if_data.ifi_oqdrops is shown to userland, but it is not incremented by anyone.
2015-10-05Don't count IF_DROP()'ed packets as if_oerrors too.Masao Uebayashi
mpi@ plans to clean-up IF_DROP()'s, but fix consistent use of it for now. OK dlg@
2015-09-29add sizes to some of the simpler free callsTheo de Raadt
ok mpi
2015-09-13replace hand rolled reference counting with refcnts.David Gwynne
2015-09-13reintroduce mpsafe vlan_input.David Gwynne
the last commit was missing SRPL_INITs of the vlan_tagh buckets, which was in a different tree to the one i committed from. apologise to naddy@ again
2015-09-13back out mpsafe vlans while i chase down a panic when operationsDavid Gwynne
are done in a certain order. panic found by naddy@
2015-09-12make vlan_input mpsafe by using srp lists in the vlan tag hash buckets.David Gwynne
ok mpi@ claudio@
2015-09-10if_put after if_getDavid Gwynne
ok claudio@
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-20Implemented MPLS pseudowire (mpw(4)) to be used with VPLS and VPWS.Rafael Zalamena
ok mpi@, claudio@.
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-23Adapt bridge(4) to the new if_input() framework.Martin Pieuchot
Move bridge_input() outside of ether_input() in order to duplicate packets flowing through a bridge port before applying any transformation on mbufs. This saves a various m_adj(9)/M_PREPEND(9) dances and remove the bridge(4) hack from vlan(4). Tested by mxb <mxb AT alumni DOT chalmers DOT se> and kettenis@ ok bluhm@
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-08Merge multiple copies of the code doing VLAN tag insertion back intoMartin Pieuchot
vlan_start(). ok sthen@, phessler@
2015-05-27check if the packet is for us or if we're promisc before we cut theDavid Gwynne
vlan header out of the packet. fixes rx on top of trunks on top of nics that dont do hw vlan tagging. ok mpi@
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-26make vlans inherit their parents hardmtu as well as mtu.David Gwynne
from brad@ and tested locally.