summaryrefslogtreecommitdiff
path: root/sys/net/route.c
AgeCommit message (Collapse)Author
2018-04-24Remove unused rtentry parameter.Florian Obser
Input bluhm OK benno, kn, claudio
2018-02-22Always reallocate a new memory chunk when changing the gateway of aMartin Pieuchot
route entry. This makes sure we pass the correct size to free(9). Reproted by and ok dlg@
2018-02-20Removing an RTF_CLONING route entry should not invalidate an RTF_CACHEDMartin Pieuchot
entry that has been cloned from a different RTF_CLONING route. Bug report & ok friehm@
2018-02-10If the kernel fails to clone an entry, report rtrequest(9) error.Martin Pieuchot
ok claudio@, jmatthew@
2018-02-08When multiple RTF_CLONING routes for the same subnet are present, useMartin Pieuchot
the correct one to clone the gateway. Fix wired vs wireless on the same subnet issue as well as a more complicated setup reported by dlg@. ok jmatthew@, claudio@, dlg@
2018-01-02Move the cloning bits in their own function.Martin Pieuchot
This will be needed to select the proper cloning route in a multipath scenario. While here remove a NET_ASSERT_LOCKED(), the routing table doesn't need the lock. ok dlg@
2017-11-29Revert 1.353, this breaks mpe(4). Also it seems not complete since rt_ifa_delClaudio Jeker
still had this hack in. This needs to be revisted and better understood. It may be needed to add a mplsrdomain to mpe(4) but MPLS only in the rtable 0 is hardcoded in more places and we should fix them all. OK mpi@
2017-09-05Restart the iteration when a multipath list is re-ordered to make sureMartin Pieuchot
no entry are missed. While here do not re-ordered or send messages for route entries that are already in the expected state. Make rttest30 pass. ok gerhard@
2017-08-11Remove NET_LOCK()'s argument.Martin Pieuchot
Tested by Hrvoje Popovski, ok bluhm@
2017-08-02Move a sanity check that only makes sense for userland where it belongs.Martin Pieuchot
ok bluhm@, florian@
2017-07-30Enable mpath support in the Allotment Routing Table (ART) on the ramdisk.Florian Obser
OK mpi
2017-07-30Switch installer to Allotment Routing Table (ART).Florian Obser
Prompted by a bugreport by naddy that IPv6 autoconfiguration is broken in the installer. OK mpi, "go for it" deraadt
2017-07-28Add an error argument to rtm_send() instead of rerolling it insideMartin Pieuchot
rtdeletemsg(). ok bluhm@
2017-07-27Export RTAX_IFP, RTAX_IFA and RTAX_LABEL to userland in rtdeletemsg().Martin Pieuchot
Reduce differences with rtm_miss(). ok claudio@, bluhm@
2017-07-24rt_getifa() is only needed for routing commands submited by userland.Martin Pieuchot
So rename it to rtm_getifa(), move it where it belongs and stop calling it from rtrequest(9). Route entries created by the kernel must always specify the corresponding `ifa'. ok claudio@
2017-06-09Replace rtrequest(RTM_DELETE...) rtrequest_delete() and do not evenMartin Pieuchot
try to remove a route from the table if it is and invalid cache. This is a step towards decoupling code dealing with userland and kernel inserted routes. ok bluhm@
2017-06-07Grab the KERNEL_LOCK() around rtm*() functions. Routing sockets globalsMartin Pieuchot
aren't protected by the NET_LOCK(). While here change lock assertions in rt_{set,put}gwroute(), the NET_LOCK() is enough. Tested by Hrvoje Popovski. ok jmatthew@, claudio@
2017-05-27In ifa_ifwithroute() the rtalloc() needs to be done against the rdomainClaudio Jeker
so use rtable_l2() to get the right id. Fixes adding routes to rtables. OK mpi@ phessler@
2017-05-16Replace remaining splsoftassert(IPL_SOFTNET) by NET_ASSERT_LOCKED().Martin Pieuchot
ok visa@
2017-04-19Use the rt_rmx defines that hide the struct rt_kmetrics indirection.Alexander Bluhm
No binary change. OK mpi@
2017-03-06Prefix functions dealing with routing messages with 'rtm_' and keepMartin Pieuchot
them all in net/rtsock.c. This allows to easily spot which functions are doing a copyout(9) when dealing with the routing midlayer. ok phessler@, bluhm@, dhill@, krw@, claudio@
2017-03-02Allow MPLS switching and VPLS across rdomains.Renato Westphal
OK claudio@ mpi@
2017-02-28Use rtable_match() rather than rtalloc(9) when adding a new route.Martin Pieuchot
rtalloc(9) should be reserved for the hot path otherwise it's hard to interpret the value of the 'use' counter. ok claudio@
2017-02-15Replace manual loops with FOREACH macro.Alexander Bluhm
OK mikeb@
2017-02-05Always allocate counters memory using type M_COUNTERS.Jeremie Courreges-Anglas
This makes the API simpler, and is probably more useful than spreading counters memory other several types, making it harder to track. Prodded by mpi, ok mpi@ stsp@
2017-01-24A space here, a space there. Soon we're talking real whitespaceKenneth R Westerback
rectification.
2017-01-24when we lose link, do not delete entries that have the RTF_BFD flag setPeter Hessler
OK mpi@
2017-01-20use per-cpu counters for rtstat.David Gwynne
ok mpi@
2017-01-19remove the BFD flag on a route *before* we actually delete the routePeter Hessler
should fix a panic reported by Hrvoje Popovski
2016-12-19Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsMartin Pieuchot
of the network stack that are not yet ready to be executed in parallel or where new sleeping points are not possible. This first pass replace all the entry points leading to ip_output(). This is done to not introduce new sleeping points when trying to acquire ART's write lock, needed when a new L2 entry is created via the RT_RESOLVE. Inputs from and ok bluhm@, ok dlg@
2016-12-17Insert RTF_CLONED routes at a higher priority than their partent toMartin Pieuchot
prevent a mpath conflict for /32 RTF_CLONING routes. Found the hardway by jsing@ on Google Compute Engine. ok bluhm@, jsing@
2016-12-14Make 'route add default' show a nicer error message if the providedStefan Sperling
gateway is not reachable (e.g. not on a local subnet). ok millert@ mikeb@ mpi@ (and shrugs by jca@)
2016-12-04Since net/route.c r1.337 interface priority factors into route priorityStefan Sperling
when RTF_CONNECTED routes are added to the routing table. Specify a route priority calculated in the same way when deleting such routes. Makes route add and delete code paths consistent again. ok mpi@
2016-12-02Assert that rt_match() is always called at IPL_SOFTNET rather thanMartin Pieuchot
calling splsoftnet() recursively.
2016-11-29m_free() and m_freem() test for NULL. Simplify callers which had their ownJonathan Gray
NULL tests. ok mpi@
2016-11-21Kill rtioctl() stub, returning EOPNOTSUPP since tree import.Martin Pieuchot
ok jsg@
2016-11-15Properly initialize ``ifa''.Martin Pieuchot
Note that dereferencing ``rt_ifa'' after calling rtfree(9) is generally not safe. In this case we rely on the fact that rtredirect() is still serialized with interface ioctl(2)s. This function cries for a rewrite. Reported by and ok jsg@
2016-11-14Reflect interface priorities when inserting RTF_CONNECTED routes.Martin Pieuchot
When multiple RTF_CLONING routes exist for a given subnet, bringing one of the interfaces up/down could make impossible to insert new ARP/NDP entries. In this case the first RTF_CONNECTED route of the multipath list no longer corresponded to the wired interface because it had the same priority as the carp(4) route. This is another regression of supporting multiple RTF_CONNECTED routes. Fix a bug with a CARP setup reported by stsp@ ok stsp@
2016-11-14Automatically create a default lo(4) interface per rdomain.Martin Pieuchot
In order to stop abusing lo0 for all rdomains, a new loopback interface will be created every time a rdomain is created. The unit number will be the same as the rdomain, i.e. lo1 will be attached to rdomain 1. If this loopback interface is already in use it wont be possible to create the corresponding rdomain. In order to know which lo(4) interface is attached to a rdomain, its index is stored in the rtable/rdomain map. This is a long overdue since the introduction of rtable/rdomain. It also fixes a recent regression due to resetting the rdomain of an incoming packet reported by semarie@, Andreas Bartelt and Nils Frohberg. ok claudio@
2016-11-09Do not call splsoftnet() recursively, this won't work with a lock.Martin Pieuchot
Timers configured via rt_timer_add(9) always run at IPL_SOFTNET, so assert that rather than calling splsoftnet(). ok bluhm@
2016-11-08Use rtalloc(9) instead of ifa_ifwithnet().Martin Pieuchot
ifa_ifwithnet() checks if a given address is directly connected. This function predates the introduction of the BSD routing table. Nowdays we can check if the route for the given address is marked as RTF_GATEWAY. This works on OpenBSD because we always install RTF_CONNECTED routes for subnets a and RTF_HOST route per p2p link. ok vgross@
2016-10-06Remove redundant comments that say a function must be called atAlexander Bluhm
splsoftnet() if the function does a splsoftassert(IPL_SOFTNET) anyway.
2016-10-05rt_timer_timer() needs a process context because it messes with theMartin Pieuchot
routing table. Found the hardway by Chris Jackman.
2016-10-04Correct the flag checks inside rt_ifa_addlocal(9) and rt_ifa_dellocal(9).Martin Pieuchot
There's no need to insert an RTF_LOCAL route if it is already there, not if a route with the same destination exist. This fixes a KASSERT() triggered by adding an alias for an address already present in the ARP cache as reported by weerd@ and Peter J. Philipp. This should also fix a KASSERT() triggered by a NDP change reported by Sebastien Marie. ok bluhm@
2016-09-17*** empty log message ***Peter Hessler
2016-09-15all pools have their ipl set via pool_setipl, so fold it into pool_init.David Gwynne
the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
2016-09-13Stop creating a BFD descriptor when the route is created.Martin Pieuchot
Since our BFD implementation relies on the existence of routes, it is much easier to set the BFD parameters with RTM_CHANGE, especially if something bad happen. Discussed with and ok phessler@, claudio@
2016-09-08Call bfd_rtfree() when the route entry has been removed from the table,Martin Pieuchot
not before. ok claudio@
2016-09-07Only free the old cached next hop route if the new one is valid.Martin Pieuchot
Leaving a NULL pointer on a RTF_GATEWAY is no longer supported, and a KASSERT() triggers. Found the hardway by and ok sthen@
2016-09-04Do not assume that an interface index of a route is still valid inAlexander Bluhm
rtrequest_delete(). The inpcb has a cache of the route that still exists when the interface has been detached. kassert triggered from tcp timeout by awolk@; OK mpi@