summaryrefslogtreecommitdiff
path: root/sys/net/route.h
AgeCommit message (Collapse)Author
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-03Use SRPL_HEAD() and SRPL_ENTRY() to be consistent with and allow toMartin Pieuchot
fallback to a SLIST. ok dlg@, jasper@
2015-12-03Remove unused ``rt_tableid'' field from "struct rtentry".Martin Pieuchot
This reduces the size of the structure by 8 bytes on amd64 now that we are using an index instead of a pointer for reaching interfaces.
2015-12-03Store an interface index instead of a pointer in the "struct rtentry".Martin Pieuchot
These indexes are unique and should be used with if_get() to get a pointer to the corresponding ``ifp''. Such pointer is guaranteed to be valid in a MP environment until if_put() is called. ok claudio@, sthen@
2015-12-02When destroying an interface, we have to wait until all referencesAlexander Bluhm
are not used anymore. This has to be done before any interface fields become invalid. As the route delete request cannot call if_get() anymore, pass down the interface. Split rtrequest_delete() into a separate function that may take an existing inteface. OK mpi@
2015-12-02Kill the RT_REPORT flag to rtalloc() and stop sending RTM_MISS messagesClaudio Jeker
for failed route lookups. This is something that was maybe useful in the 90is but in this modern times it is just annoying and nothing expect it anyway. OK mpi@, sthen@
2015-12-02Move multipath Hash-Threshold selection mechanism inside rtable_match().Martin Pieuchot
This will helps for unlocking the routing table and will prevent further mistake by keeping the multipath logic inside the rtable_* API. ok dlg@, claudio@
2015-12-01Kill redundant or unused arguments in rtredirect().Martin Pieuchot
ok bluhm@
2015-11-29Convert the simple list of multipath route entries used by ART kernelsMartin Pieuchot
to a SRP list. This turns the rtable_* layer mpsafe. We now only need to protect the ART implementation itself. Note that route(8) regress tests will now fail due to a supplementary reference taken by the SRPL_INIT(9) API. ok dlg@
2015-11-09Rewrite rtalloc(9) to consider RTF_GATEWAY entries without valid next-Martin Pieuchot
hop route as invalid. Previously when such entrie was returned by rtalloc(9) a second route lookup was done in rt_checkgate() very late in the journey of a packet. In other words a single rtalloc(9) call can now result in multiple route lookups if a RTF_GATEWAY entry is returned. This is a step towards always calling L2 output functions with valid destination information. Tested by various including jmc@, naddy@, Hrvoje Popovski
2015-11-06Rename rt_mpath_next() into rtable_mpath_next() and provide anMartin Pieuchot
implementation for ART based on the singly-linked list of route entries.
2015-11-06Use a SLIST instead of a LIST for MPATH route entries with ART.Martin Pieuchot
2015-10-30Rename rtrequest1() to rtrequest().Alexander Bluhm
OK mpi@
2015-10-25Instead of doing the the if_get() dance for rt_missmsg(), change theAlexander Bluhm
function to take an interface index. discussed with mpi@; OK claudio@
2015-10-24Define ``rt_ifidx'' as rt_ifp->if_index to ease the transtion towardsMartin Pieuchot
getting rid of interface pointers in route entries. ok bluhm@
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-10-03Enable eigrpd(8) and eigrpctl(8) in the buildsRenato Westphal
ok deraadt@
2015-09-11Now that the port tree is clean, RTF_XRESOLVE disapear.Martin Pieuchot
ok sthen@, claudio@
2015-09-11Introduce rtref(9) use it in rtable_lookup() before returning a routeMartin Pieuchot
entry. ok bluhm@, claudio@
2015-09-01Introduce rtisvalid(9) a function to check if a (cached) route entryMartin Pieuchot
can be used or should be released by rtfree(9). It currently checks if the route is UP and is not attached to a stall ifa. ok bluhm@, claudio@
2015-08-20Import an alternative routing table backend based on Yoichi Hariguchi'sMartin Pieuchot
ART implementation. ART (Allotment Routing Table) is a multibit-trie algorithm invented by D. Knuth while reviewing Yoichi's SMART [0] (Smart Multi-Array Routing Table) paper. This implementation, unlike the one from the KAME project, supports variable stride lengths which makes it easier to adapt the consumed memory/speed trade-off. It also let you use a bigger first-level table, what other algorithms such as POPTRIE [1] need to implement separately. Adaptation to the OpenBSD kernel has been done with two different data structures. ART nodes and route entries are managed separately which makes the algorithm implementation free of any MULTIPATH logic. This implementation does not include Path Compression. [0] http://www.hariguchi.org/art/smart.pdf [1] http://conferences.sigcomm.org/sigcomm/2015/pdf/papers/p57.pdf ok dlg@, reyk@
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-08Use a new RTF_CONNECTED flag for interface (connected) routes.Martin Pieuchot
Recent changes to support multiple interface routes broke the assumption made by all our userland routing daemons concerning interface routes. Historically such routes had a "gateway" sockaddr of type AF_LINK. But to be able to support multiple interface routes as any other multipath routes, they now have a unique "gateway" sockaddr containing their corresponding IP address. This self-describing flag should avoid ambiguity when dealing with interface routes. Issue reported by <mxb AT alumni DOT chalmers DOT se> and benno@ ok claudio@, benno@
2015-07-08RTF_LOCAL and RTF_BROADCAST must not be settable by userland.Martin Pieuchot
Note that current code is safe because an explicit check exists in route_output(). Pointed out by claudio@ while reviewing another diff.
2015-05-05Flag user specified routes with an AF_LINK gateway as RTF_LLINFO.Martin Pieuchot
This makes ND6 and ARP layers happy since they both check for this flag, but is was redundant to provide route(8)'s "-llinfo" option when adding a l2 route. RTF_LLINFO is clearly redundant for userland tools, so only allow the kernel to set it. ok benno@, claudio@
2015-02-11Do not store the key and the gateway of a route entry in the same chunkMartin Pieuchot
of memory. The key (destination) is only set once, when the route is inserted in the routing table, and does not need to change afterward. The gateway might change and rt_setgate() will do all the checks for you. ok claudio@
2015-01-13Restore sending RTM_ADD and RTM_DELETE messages to userland for everyMartin Pieuchot
route created/deleted with rt_ifa_add(9)/rt_ifa_del(9), not only for RTF_LOCAL routes. Regression introduced in r1.172 when restoring the original behavior of RTM_NEWADDR/RTM_RTM_DELADDR reported by Florian Riehm. Joint work with Florian Riehm, with input from and ok bluhm@.
2015-01-08Include the Routing Table ID in "struct rtentry" and reorder the fieldsMartin Pieuchot
such that there's no size change on, at least, amd64. This will allow us to simplify some APIs and deprecate the remaining flavors of "struct route". ok claudio@, phessler@
2015-01-08Factorize various duplicated chunks of (old and horrible) code, checkingMartin Pieuchot
for the validity of a given outgoing route entry into a single function. This change is inspired from FreeBSD r111767. The function introduced here, rt_checkgate(), should hopefully die in a near future. Why should it die? Well, it is way too late to do such validity checks: if your kernel can ends up in ether_output() with an invalid route, please do not let it try to find a new one that might do the job. Go read this function if you're wondering why you're getting messages like: "arpresolve: X.X.X.X: route without link local address" Since this horrible logic has survived 20 years of copy & past and small modifications for workarounds without a single clear commit message, let's assume it is full of dragons and try to play safe. This factorization is not intended to change any behavior. With much inputs from bluhm@, tested by weerd@ and florian@ on setups with p2p IPv6 interfaces. ok bluhm@, benno@, florian@
2014-11-24Rename rt_ifa_addloop() into rt_ifa_addlocal() and make it return anMartin Pieuchot
error code on failure (unchecked for the moment). ok mikeb@, jmc@
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-10-08Use rtalloc1() instead of rtalloc_noclone().Martin Pieuchot
ok henning@, phessler@
2014-09-27Kill rtalloc() and update rtalloc1() and rtalloc_mpath() to no longerMartin Pieuchot
rely on "struct route" that should die. ok claudio@
2014-08-12route_cb is internal to rtsock.cMartin Pieuchot
2014-07-29Revert the checks about RTF_LOCAL routes.Martin Pieuchot
Even if in the end we would like to be more strict about what userland can do with kernel-managed route entries, most of the tools out there are not yet ready for this. Since RTF_LOCAL routes are for the moment just like RTF_LLINFO routes without expire timer, allow userland tools to remove/modify them. In case they are missing, the good old cloning mechanism will recreate what you need. bluhm@ and deraadt@ agree.
2014-05-09We should use the highest possible priority for routes to local addresses.Martin Pieuchot
Requested by claudio@
2014-05-08Introduce two new route flags: RTF_LOCAL and RTF_BROADCAST.Martin Pieuchot
Nothing use them for the moment, but here is the plan: Since a route lookup is always necessary to output a packet it makes sense to store all the information regarding how the packet should be sent in the routing entry. This will save us some expensive lookups on address lists. But once we have all the information about our addresses in the routing table, we can even use it in the input path with the hope that the number of lookups in the forwarding case can be reduce to one. ok henning@, chris@
2014-04-25Remove rti_ifp from rt_addrinfo, one less ifp pointer, say yay!Martin Pieuchot
This pointer was only needed by rt_getifa() to find an address, so turn it into a local variable. ok henning@, bluhm@
2014-04-10Retire rtinit() an use rt_ifa_add(9) and rt_ifa_del(9) to manageMartin Pieuchot
connected routes to prefixes/hosts. Since the introduction of rt_ifa_addloop(9) and rt_ifa_delloop(9), rtinit() was just a wrapper, so use the underlying functions directly and document them. Inputs from and ok mikeb@, manpage tweaks from jmc@
2014-04-03Introduce rt_ifa_{add,del}loop() to replace in6_{add,rem}loop().Martin Pieuchot
Move these functions to a more generic place and make them reuse existing code, they'll be soon used in IPv4 too. Tested by André Lucas, Vigdis and sthen@, thanks! ok sthen@
2014-03-21rt_timer* spring cleanup.Martin Pieuchot
Rename and document rt_timer_count() into rt_timer_queue_count() to be consistent with the other functions. Remove unused argument from rt_timer_queue_destroy(), clean the definitions and finally use the same order in NAME and DESCRIPTION as requested by jmc@. ok henning@
2014-03-18Rename rt_gettable() into rtable_get(), swap its arguments to beMartin Pieuchot
coherent with the existing rtable_* functions and document it. While here fix some other manpage glitches pointed out by jmc@.
2014-01-23Merge two chunks of code to inform listeners of a route change into aMartin Pieuchot
new function, rt_sendmsg(). While here, in the v6 cases, pass the same rtableid that was used for the request instead of dereferencing a pointer after checking for it to be NULL. ok krw@ on a previous version, ok bluhm@
2014-01-22Remove genmask support from the kernel. rtmsgs with RTA_GENMASK set willClaudio Jeker
now cause a EINVAL. The RTA_GENMASK and RTAX_GENMASK defines are kept for compatibility reasons. OK benno@ and agreed by dlg@
2014-01-20Remove an unneeded #ifndef bot radix.h and radix_mpath.h protect themselfClaudio Jeker
from multiple inclusion. OK mpi@
2014-01-20Get rid of the old routing message version 4 transition code beforeAlexander Bluhm
5.5 release. OK claudio@
2013-10-31Convert the route expire timestamp in kernel and routing messageAlexander Bluhm
to 64 bit. Increase the routing message version from 4 to 5. Add a small compatibility layer that allows to set routes with old user land and new kernel. Old kernel with new user land does not work. The compatibility layer ist not perfect, but it allows to configure addresses with old ifconfig and new kernel. Route get also works in this setup. dhclient hangs as messages for interface address changes with old version are not generated. OK claudio@
2013-10-24Move more stuff under _KERNELTheo de Raadt
ok claudio
2013-10-24Move obvious kernel prototypes (and structure's with kernel pointers,Theo de Raadt
obviously only used in the kernel) behind #ifdef _KERNEL