summaryrefslogtreecommitdiff
path: root/sys/net/if_mpw.c
AgeCommit message (Collapse)Author
2021-03-26Only install route with label, fix route leak on destroykn
ifconfig mp* mplslabel N" validates the label both in ifconfig(8) and each driver's ioctl handler, but there is one case where all drivers install a route without looking at the label at all. SIOCSLIFPHYRTABLE in all three drivers just validates the rdomain and sets the label to itself (0) such that the route is (re)installed accordingly. None of the driver's helper functions dealing with labels and routes validate labels themselves but instead expect the callees, e.g. the ioctl handler to do so. That means we can install routes for the explicit NULL label in non-default routing tables but are never able to clean them up without reboot. Fix this by adding the inverse of mp*_clone_destroy()'s label check to the routines installing the MPLS route to avoid bogus ones in the first place. OK claudio
2021-03-17Make "ifconfig mpw0 -mplslabel" workkn
Code is there, noone ever used it, I guess. This makes ifconfig(8) documentation actually hold true. OK claudio
2021-03-17Use correct rdomain when adding/deleting routeskn
mpip(4) always adds and deletes routes in rdomain 0 regardless of the `tunneldomain', i.e. the `sc_rdomain' value. mpw(4) adds routes with the specified rdomain but always deletes them in rdomain 0. mpe(4) consistently uses the softc's rdomain which is tracked consistently across the various ioctls -- no fix needed. Found while reading the code and testing ifconfig(8)'s "tunneldomain" in order to document MPLS ioctls. OK claudio
2020-08-21Leave default ifq_maxlen handling to ifq_init()kn
Most clonable interface drivers (except bridge, enc, loop, pppx, switch, trunk and vlan) initialise the send queue's length to IFQ_MAXLEN during *_clone_create() even though ifq_init(), which is eventually called through if_attach(), does the same. Remove all early "ifq_set_maxlen(&ifq->if_snd, IFQ_MAXLEN);" lines to leave it to ifq_init() and have clonable drivers a tad more in sync. OK mvs
2020-07-10Change users of IFQ_SET_MAXLEN() and IFQ_IS_EMPTY() to use the "new" API.Patrick Wildt
ok dlg@ tobhe@
2020-07-10Change users of IFQ_PURGE() to use the "new" API.Patrick Wildt
ok dlg@ tobhe@
2020-06-17make ph_flowid in mbufs 16bits by storing whether it's set in csum_flags.David Gwynne
i've been wanting to do this for a while, and now that we've got stoeplitz and it gives us 16 bits, it seems like the right time.
2019-06-26The MPLS edge devices get the packets from the MPLS stack which neverClaudio Jeker
passed though pf_test(). So there is no need to try to call pf_pkt_addr_changed() instead just check that the PF statekey is NULL. Initial problem of not including pf.h found by jsg@ OK jsg@ sashan@
2019-04-23a first cut at converting some virtual ethernet interfaces to if_vinputDavid Gwynne
this let's input processing bypass ifiqs. there's a performance benefit from this, and it will let me tweak the backpressure detection mechanism that ifiqs use without impacting on a stack of virtual interfaces. ive tested all of these except mpw, which i will end up testing soon anyway.
2019-04-19use the factored out txhprio and rxhprio checksDavid Gwynne
reduces code duplication and chance for error.
2019-04-19implement rxprioDavid Gwynne
2019-04-17don't lose the TTL on FAT labelsDavid Gwynne
2019-04-17use txprio to control the use of exp as a priority fieldDavid Gwynne
by default txprio is set to 0, so the exp field will be 0. howerver, txprio on mpe/mpw/mpip can be configured with other values or settings like our other tunnel or encapsulation interfaces. intermediate LSPs can use the exp field to manage their prioritisation of encapsulated traffic.
2019-04-02clear the BCAST and MCAST mbuf flags for "outgoing" packets.David Gwynne
if these remain set then output on the underlying interface may mistakenly be done with the wrong protocol type (eg, MPLS_MCAST instead of MPLS), and to the wrong link layer address. reported by Lee Nelson the specific problem was identified by Mitchell Krome
2019-04-02some mbuf ph_rtableid fixesDavid Gwynne
consistently set the rtabled for "outgoing" packets to the encap rdomain. use this for rtallocs in mpip too instead of assuming 0.
2019-03-18make SIOCGETLABEL fail with EADDRNOTAVAIL if the label is not set.David Gwynne
this makes ifconfig print "(unset)" to show the label isn't set yet.
2019-02-26don't check the pseudowire type in tx and rx paths.David Gwynne
whether the mpw interface is advertising "ethernet" or "ethernet- tagged" is something the ends of the wire agree on (ie, ldpd is configured a certain way), it is not something that affects ethernet encap or decap. the MPW ioctls can still configure it and read it, but it has no bearing on how the driver operates on packets.
2019-02-26add support for the new pwe3 ioctls.David Gwynne
the existing mpw ioctl is still available for ldpd to use for a (short) while. discussed with claudio@ at a2k19 ok mpi@
2019-02-20add support for rfc 6391: flow-aware transport of pseudowires.David Gwynne
this basically adds a dummy mpls tag to the stack for pseudowires and uses a flow as the label on that dummy tag. this allows intermediate systems that hash packets onto multiple links to use the extra tag as input to the hash, providing more entropy and therefore better load balancing. it's a pity there's no way to turn it on yet...
2019-02-20don't store the BOS flag as part of the remote label, add it at tx time.David Gwynne
this is to prepare for flow aware transport for FAT from RFC 6391
2019-02-20replace sc_flgas with sc_cwordDavid Gwynne
the only flag used with sc_flags was the one to turn the control word on and off. this is in preparation for split ioctls for controlling pseudowire behaviour. sc_cword can be set atomically and indepentently as a separate variable.
2019-02-20sigh, more whitespace fixesDavid Gwynne
no functional change
2019-02-20oops, whitespace tweakDavid Gwynne
no functional change
2019-02-20add support for SIOCGETLABELDavid Gwynne
this is a first step in breaking up the monolithic and redundant SIOCSETMPWCFG ioctls discussed with claudio@
2019-02-15coordinate configuration of local mpls labels with destroying an interfaceDavid Gwynne
this adds an rwlock like mpe has which means only one thing can be adding or removing a local mpls label, and those things check if the interface is dying before doing their thing.
2019-02-15allow configuration of the rdomain that mpls operates inDavid Gwynne
this is based on the changes to mpe i made yesterday. unfortunately mpw has a monstor ioctl that configures all the things, which makes the kernel side complicated. hopefully i can split them up.
2019-02-14the rdomain for the mpls stuff should still be hardcoded to 0 in mpw.David Gwynne
it was using ifp->if_rdomain for the rtalloc of the mpls encapsulated tunnel in mpw_start.
2019-02-14consistently use the same flags for rt_ifa_add and _del.David Gwynne
experience with mpe shows you need RTF_LOCAL everywhere for del to work.
2019-02-13change rt_ifa_add and rt_ifa_del so they take an rdomain argument.David Gwynne
this allows mpls interfaces (mpe, mpw) to pass the rdomain they wish the local label to be in, rather than have it implicitly forced to 0 by these functions. right now they'll pass 0, but it will soon be possible to have them rx packets in other rdomains. previously the functions used ifp->if_rdomain for the rdomain. everything other than mpls still passes ifp->if_rdomain. ok mpi@
2019-02-11add M_CANFAIL to malloc, and return ENOMEM if allocating an interfaceDavid Gwynne
fails.
2019-02-10assign the m_prepend result to the right variable.David Gwynne
2019-01-30use MPLS_SHIM2LABEL and MPLS_LABEL2SHIMDavid Gwynne
2019-01-29call the "parent" interface ifp0 to be consistent with other drivers.David Gwynne
2019-01-29use a sockaddr_mpls when preparing an AF_MPLS sockaddr for mpls_outputDavid Gwynne
2019-01-27let ether_ioctl handle the mtu. set hardmtu to ETHER_MAX_HARDMTU_LEN.David Gwynne
as well as allowing for larger frames to be transported, it also gets rid of the dependancy on mpe defines.
2019-01-27split off "local" input handlingDavid Gwynne
this means the current mpls header will be passed along with the mbuf for mpw to look at. right now this doesn't do anything, but it will allow for implementation of RFC 6391 (flow aware transport) and using the exp header for cos. when mpe gets moved to adding an RTF_LOCAL route, this will be used for cos and ttl handling.
2019-01-27like ip headers, mpls tags need to be aligned to a 4 byte boundaryDavid Gwynne
copy the semantics for guaranteeing this from egre. when sending an encapsulated frame, prepend a whole new mbuf for the tags and transport headers. when rxing a packet, check the alignment of the ethernet payload and duplicate it on the right boundary if it isn't already aligned.
2019-01-23rework mpw to be an actual ethernet interface.David Gwynne
this will allow for a lot of special casing in places like vlan and bridge to go away since mpw will do all the same things as any other ethernet tunnel. another benefit is you can run stuff directly on the mpw interface to interact with the pseudowire, rather than requiring a bridge and vether interface. this is like what juniper calls Pseudowire Service Interfaces. the caveat is that the implicit vlan or svlan tagging that mpw did in ethernet-tagged mode now has to be done by hand. however, there is some indication that different vendors pick different types of tags, ie, one uses vlan tags and another uses svlan, so being able to configure the right one has value. it is also possible you would want to bridge the entire tag stack to another site, so being able to bridge mpw without it playing with the tags can be useful. because the if_type on mpw changes from IFT_MPLSTUNNEL to IFT_ETHER, the semantic used to handle incoming packets in mpls_input is changed. instead of mpls_input pushing the packets into mpw based on the if_type being IFT_MPLSTUNNEL, mpw now adds an RTF_LOCAL route to the mpls table. mpls_input falls through to "outputting" the packet to mpw_output, which then uses the RTF_LOCAL flag to decide to input to mpw_input and then ether_input. this semantic will be applied to mpe soon, which removes all the interface special casing in mpls_input. the if_type change also means mpw implements the SIOCGPWE3 ioctl so ldpd can still figure out that the interface is a pseudowire. ok claudio@
2018-02-19Remove almost unused `flags' argument of suser().Martin Pieuchot
The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
2018-01-09Creating a cloned interface could return ENOMEM due to temporaryAlexander Bluhm
memory shortage. As it is invoked from a system call, it should not fail and wait instead. OK visa@ mpi@
2017-05-15if_input() doesn't need splnet().Martin Pieuchot
ok rzalamena@
2017-05-04Introduce sstosa() for converting sockaddr_storage with a type safeAlexander Bluhm
inline function instead of casting it to sockaddr. While there, use inline instead of __inline for all these conversions. Some struct sockaddr casts can be avoided completely. OK dhill@ mpi@
2017-03-02Allow MPLS switching and VPLS across rdomains.Renato Westphal
OK claudio@ mpi@
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@
2016-12-20Kill recursive splsoftnet()/splx() dances in ioctl(2) path.Martin Pieuchot
ok rzalamena@
2016-09-21Remove recursive splsoftnet() calls, from David Hill.Martin Pieuchot
2016-04-13We're always ready! So send IFQ_SET_READY() to the bitbucket.Martin Pieuchot
2016-03-09rework how mpw(4) interacts with vlan(4)David Gwynne
previously mpw would walk around our interface hierarchy so it could reinject vlan tags for packets that were received on a stack of vlan interfaces. this got in the way of making vlan mpsafe, but is also unecessary according to how i read RFC 4448 which describes how mpls pseudowires should function. the behaviour is now: - in raw mode mpw(4) acts like a normal ethernet interface it no longer injects a tag from a vlan interface that may be on the same bridge as it, and it allows you to configure ip addresses on the local interface and use them without panicking the kernel. - in tagged mode it will only add tags from vlan interfaces on the same bridge as it, but not any parent/child tags from interfaces on top of that vlan. if the packet did not come from a vlan interface on a bridge it will inject a tag for vlan 0. this will also allow vlan to move forward. ok mpi@ rzalamena@ claudio@