summaryrefslogtreecommitdiff
path: root/sys/netmpls
AgeCommit message (Collapse)Author
2018-01-12Check that mpls has been enabled on the input interface, lost in rev 1.66Jeremie Courreges-Anglas
While here fix under MPLS_DEBUG. ok dlg@
2018-01-10fix some poop that snuck into the last commit.David Gwynne
noticed by bijanebrahimi at riseup dot net and confirmed by anton@
2018-01-09make mpls_input take a struct ifnet *ifp argument.David Gwynne
this makes it like all our other protocol family input functions. mpls_input always looks up the interface the mbuf was received on, but it's always called by code that already has a reference to that interface anyway. the result of this is a few less if_get/if_put calls. ok mpi@ bluhm@ visa@ claudio@
2017-12-08Pullup the mbuf before accessing the version field in the IP header.Alexander Bluhm
Fix the pullup length of the shim header in mpls_do_error(). issue reported by Maxime Villard; OK deraadt@ claudio@
2017-12-08Use m_freem() in error case. Found by Maxime VillardClaudio Jeker
OK bluhm@
2017-12-08The adjttl functions use m_pullup(). In some cases m_pullup() can returnClaudio Jeker
a new mbuf chain and this chain needs to be returned to the caller else a use after free may happen. Issue reported by Maxime Villard OK bluhm@ deraadt@
2017-12-08mpls_shim_pop() can return NULL. Check it else we end up dereferencing NULL.Claudio Jeker
Issue reported by Maxime Villard OK bluhm@ deraadt@
2017-12-08The per-interface mpls flag should also also be tested on input beforeTheo de Raadt
proceeding, as described in ifconfig documentation. Discussion with claudio. Related to a report from maxime. ok claudio bluhm
2017-05-30Introduce ipv{4,6}_input(), two wrappers around IP queues.Martin Pieuchot
This will help transitionning to an un-KERNEL_LOCK()ed IP forwarding path. Disucssed with bluhm@, ok claudio@
2017-03-02Convert domain declarations to C99 initializers.Martin Pieuchot
ok dhill@, florian@, bluhm@
2017-03-02Allow MPLS switching and VPLS across rdomains.Renato Westphal
OK claudio@ mpi@
2017-02-28Remove mpls_raw_usrreq() prototype, that function is gone.Claudio Jeker
2017-02-27Retire the AF_MPLS protosw struct. Nothing is using it and the code was superClaudio Jeker
basic anyway. Simplifies the code a lot also by calling the mpls sysctl no longer via the protosw but instead directly. OK mpi@ on a previous diff. Also tested by renato@ who actually found a bug which is now fixed.
2016-11-15Return EOPNOTSUPP instead of calling a function to do only that.Martin Pieuchot
ok phessler@
2016-08-22Do not dereference ``rt->rt_ifa'' after calling rtfree(9).Martin Pieuchot
This could result in a use after free if the route entry was holding the last reference of the address descriptor. ok jca@, bluhm@, claudio@
2016-07-11Revert the introduction of ``rt_addr''.Martin Pieuchot
Being able to add route entries without configured addresses is a nice feature but this is not my fight. So I'd rather no add another pointer to ``struct rtentry'' if I'm not removing another one.
2016-06-14Store the source address associated with a route in its own chunk ofMartin Pieuchot
memory. This will allow to unlink 'sruct rtentry' and 'struct ifaddr' to be able to add route entries without needing an address. ok sthen@, visa@, florian@
2015-12-04There is no need to grab the KERNEL_LOCK here anymore. After discussion withClaudio Jeker
dlg@ and mpi@
2015-12-03Get rid of rt_mask() and stop allocating a "struct sockaddr" for everyMartin Pieuchot
route entry in ART. rt_plen() now represents the prefix length of a route entry and should be used instead. For now use a "struct sockaddr_in6" to represent the mask when needed, this should be then replaced by the prefix length and RTA_NETMASK only used for compatibility with userland. ok claudio@
2015-12-02Oups, forgot in the tedu of RT_REPORT commitClaudio Jeker
2015-12-02Rework the MPLS handling. Remove the lookup loops since nothing is usingClaudio Jeker
them and they make everything so much harder with no gain. Remove the ifp argument from mpls_input since it is not needed. On the input side the lookup side is modified a bit when it comes to BOS handling. Tested in a L3VPN setup with ldpd and bgpd. Commiting now so we can move on with cleaning up rt_ifp usage. If this breaks L2VPN I will fix it once reported. OK mpi@
2015-11-24No need for <net/if_types.h>Martin Pieuchot
As a bonus this removes a "#if NCARP > 0", say yeah!
2015-10-23rtfree(9) and rtalloc(9) no longer need to be called under KERNEL_LOCK.Martin Pieuchot
2015-10-07Initialize the routing table before domains.Martin Pieuchot
The routing table is not an optional component of the network stack and initializing it inside the "routing domain" requires some ugly introspection in the domain interface. This put the rtable* layer at the same level of the if* level. These two subsystem are organized around the two global data structure used in the network stack: - the global &ifnet list, to be used in process context only, and - the routing table which can be read in interrupt context. This change makes the rtable_* layer domain-aware and extends the "struct domain" such that INET, INET6 and MPLS can specify the length of the binary key used in lookups. This allows us to keep, or move towards, AF-free route and rtable layers. While here stop the madness and pass the size of the maximum key length in *byte* to rn_inithead0(). ok claudio@, mikeb@
2015-09-23Always increment rt_use inside rtalloc(9) instead of doing it in someMartin Pieuchot
specific places. ok claudio@, benno@
2015-09-13There's no point in abstracting ifp->if_output() as long as pf_test()Martin Pieuchot
needs to see lo0 in the output path. ok claudio@
2015-09-12Stop overwriting the rt_ifp pointer of RTF_LOCAL routes with lo0ifp.Martin Pieuchot
Use instead the RTF_LOCAL flag to loop local traffic back to the corresponding protocol queue. With this change rt_ifp is now always the same as rt_ifa->ifa_ifp. ok claudio@
2015-09-12Use rtfree() instead of playing with the refcount directly. Some care isClaudio Jeker
needed since rt0 as passed from the upper layer is freed by that layer. Also if_output does not free the rt so handle that as well. With and OK mpi@
2015-09-04Make every subsystem using a radix tree call rn_init() and pass theMartin Pieuchot
length of the key as argument. This way every consumer of the radix tree has a chance to explicitly initialize the shared data structures and no longer rely on another subsystem to do the initialization. As a bonus ``dom_maxrtkey'' is no longer used an die. ART kernels should now be fully usable because pf(4) and IPSEC properly initialized the radix tree. ok chris@, reyk@
2015-08-30Use a global table for domains instead of building a list at run time.Martin Pieuchot
As a side effect there's no need to run if_attachdomain() after the list of domains has been built. ok claudio@, reyk@
2015-07-29Don't use mpls_input() as input handler anymore and instead call itRafael Zalamena
directly. Also protect non mp-safe functions while at it. ok mpi@.
2015-07-20Implemented MPLS pseudowire (mpw(4)) to be used with VPLS and VPWS.Rafael Zalamena
ok mpi@, claudio@.
2015-07-20Kill NETISR_MPLS, from now on we will use interface input handlers to dealRafael Zalamena
with MPLS packets. ok mpi@, claudio@
2015-07-18Abstract the routing table internals behind an rtable_* API.Martin Pieuchot
Code abusing the radix internals for the routing table should now includes <net/rtable.h> and only deal with "struct rtentry". Code using a radix tree for another purpose can still include <net/radix.h>. Inputs from and ok claudio@, mikeb@
2015-07-15m_freem() can handle NULL, do not check for this condition beforehands.Theo de Raadt
ok stsp mpi
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-04-10replace the use of ifqueues for most input queues serviced by netisrDavid Gwynne
with niqueues. this change is so big because there's a lot of code that takes pointers to different input queues (eg, ether_input picks between ipv4, ipv6, pppoe, arp, and mpls input queues) and falls through to code to enqueue packets against the pointer. if i changed only one of the input queues id have to add sepearate code paths, one for ifqueues and one for niqueues in each of these places by flipping all these input queues at once i can keep the currently common code common. testing by mpi@ sthen@ and rafael zalamena ok mpi@ sthen@ claudio@ henning@
2015-03-26Use rt_ifa_add(9) and rt_ifa_del(9) to configure MPLS labels.Martin Pieuchot
Since the removal of the link-layer ifa from "struct ifnet" it was impossible to configure MPLS routes on mpe(4). Because just like enc(4), mpe(4) was abusing the link-layer ifa to attach its route entries. So explicitly pass a "glue" ifa to the routing layer. From Rafael Zalamena who discovered this the hardway, thanks! ok claudio@
2015-01-15Do not include 5 header files, including <sys/param.h>Theo de Raadt
ok millert
2014-12-23unifdef some more INET. v4 4life.Ted Unangst
2014-12-05Explicitly include <net/if_var.h> instead of pulling it in <net/if.h>.Martin Pieuchot
ok mikeb@, krw@, bluhm@, tedu@
2014-11-01Rename rtalloc1() into rtalloc(9) and convert its flags to only enableMartin Pieuchot
functionnality instead of a mix of enable/disable. ok bluhm@, jca@
2014-10-14Use rtfree() instead of RTFREE(), NULLify some free'd route pointers andMartin Pieuchot
kill the macro. ok mikeb@, henning@
2014-09-08remove uneeded route.h includesJonathan Gray
ok miod@ mpi@
2014-07-22Fewer <netinet/in_systm.h> !Martin Pieuchot
2013-10-24Remove the number of in6_var.h inclusions by moving some functions andMartin Pieuchot
global variables to in6.h. ok deraadt@
2013-10-17The header file netinet/in_var.h included netinet6/in6_var.h. ThisAlexander Bluhm
created a bunch of useless dependencies. Remove this implicit inclusion and do an explicit #include <netinet6/in6_var.h> when it is needed. OK mpi@ henning@
2013-07-10Keep this copy of the ICMP checksum code in sync with recent changes.Martin Pieuchot
ok lteo@, claudio@, bluhm@, henning@
2013-04-24Move various extern declarations into their corresponding header file.Martin Pieuchot
2013-03-27a little header cleanup. ok deraadtTed Unangst