summaryrefslogtreecommitdiffstats
path: root/sys/net/route.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Do not call splsoftnet() recursively, this won't work with a lock.mpi2016-11-091-1/+3
| | | | | | | Timers configured via rt_timer_add(9) always run at IPL_SOFTNET, so assert that rather than calling splsoftnet(). ok bluhm@
* Use rtalloc(9) instead of ifa_ifwithnet().mpi2016-11-081-3/+8
| | | | | | | | | | | 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@
* Remove redundant comments that say a function must be called atbluhm2016-10-061-3/+1
| | | | | splsoftnet() if the function does a splsoftassert(IPL_SOFTNET) anyway.
* rt_timer_timer() needs a process context because it messes with thempi2016-10-051-2/+2
| | | | | | routing table. Found the hardway by Chris Jackman.
* Correct the flag checks inside rt_ifa_addlocal(9) and rt_ifa_dellocal(9).mpi2016-10-041-4/+4
| | | | | | | | | | | | | 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@
* *** empty log message ***phessler2016-09-171-2/+2
|
* all pools have their ipl set via pool_setipl, so fold it into pool_init.dlg2016-09-151-7/+5
| | | | | | | | | | | | | | | | | | | | | | 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);
* Stop creating a BFD descriptor when the route is created.mpi2016-09-131-6/+1
| | | | | | | | 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@
* Call bfd_rtfree() when the route entry has been removed from the table,mpi2016-09-081-6/+6
| | | | | | not before. ok claudio@
* Only free the old cached next hop route if the new one is valid.mpi2016-09-071-5/+6
| | | | | | | Leaving a NULL pointer on a RTF_GATEWAY is no longer supported, and a KASSERT() triggers. Found the hardway by and ok sthen@
* Do not assume that an interface index of a route is still valid inbluhm2016-09-041-4/+5
| | | | | | 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@
* Purge routes attached to an address when this address is removed.mpi2016-09-041-130/+49
| | | | | | | This is done to stop using stale ifa attached to routes, which is the easiest way to make rtisvalid(9) MP-safe. sthen@ and henning@ like it, ok claudio@
* Make it possible to toggle RTF_BFD via RTM_CHANGE and fix some minor thingsclaudio2016-09-041-11/+11
| | | | | in bfd.c. Make bfd_rtfree() a void function. OK phessler@
* Add in the (disabled) kernel glue for BFDphessler2016-09-031-1/+18
| | | | OK claudio@, henning@
* Disable the RTF_UP kassert check in rtisvalid() for now as it canbluhm2016-09-011-4/+3
| | | | | | be triggered from userland. A gateway route is simply not valid if its gwroute is not up. OK phessler@
* Move the RTF_LOCAL check that only makes sense for userland tompi2016-09-011-12/+1
| | | | | | route_output(). ok claudio@
* Do not flush RTF_CLONED children when adding a new route.mpi2016-08-311-10/+6
| | | | | | | | | | | | | New RTF_CLONING routes don't have children, but the kernel might end up removing routes from a compatible route. This bug has been introduced with the support for multiple RTF_CLONING routes. Also make sure to release possible RTF_CACHED route *before* flushing RTF_CLONED children when deleting a route. KASSERT() reported by akfaew, sthen@ and martijn@ ok benno@
* pool_setipldlg2016-08-301-1/+3
| | | | ok claudio@ mpi@
* Use rtalloc(9) instead of ifa_ifwithnet() to find an interfacempi2016-08-221-12/+8
| | | | | | | | | | | when adding a route to gateway to ensure a most specific match. This makes "# route add" coherent to "# route get" even with p2p interfaces. Fix a problem reported by Mart Tõnso. This also fix rttest20 after the introduction of RTF_CACHED. ok vgross@
* Make the ``rt_gwroute'' pointer of RTF_GATEWAY entries immutable.mpi2016-08-221-82/+134
| | | | | | | | | | | This means that no protection is needed to guarantee that the next hop route wont be modified by CPU1 while CPU0 is dereferencing it in a L2 resolution functions. While here also fix an ``ifa'' leak resulting in RTF_GATEWAY being always invalid. dlg@ likes it, inputs and ok bluhm@
* Do not seroize a struct needed for RTM_RESOLVE in the hot path.mpi2016-08-191-5/+7
| | | | ok phessler@, bluhm@, tedu@, natano@
* Mask the ``prio'' prior to comparing it to RTP_LOCAL.mpi2016-08-161-2/+2
| | | | | | | | | This allows rt_if_remove() to remove RTF_BROACAST routes from down interfaces. Issue reported by Dimitris Papastamos on bugs@ ok dlg@, claudio@, phessler@
* Check for errors when deleting routes inside rtable_walk() and abortmpi2016-07-221-9/+16
| | | | | | | | the walk if a route cannot be deleted. Prevent an infinite recursion reported by Dimitris Papastamos. ok claudio@
* Return EAGAIN for every deleted route when detaching an interface.mpi2016-07-191-11/+3
| | | | | | | Previously the code was "too clever" and returned EAGAIN only for cloning route assuming that other deletion did not modify the tree. Analysed by and ok dlg@
* Path MTU discovery was slightly broken. I took two ICMP packetsbluhm2016-07-111-14/+23
| | | | | | | | | to create and change the dynamic route. This behavior was introduced in net/route.c rev 1.269 when the gateway route allocation was moved from rt_setgateway() to _rtalloc(). So rtrequest(RTM_ADD) could return a route without a valid gateway route. To fix this, call rt_setgwroute() from _rtalloc() and rt_setgateway(). OK mpi@
* Revert the introduction of ``rt_addr''.mpi2016-07-111-27/+4
| | | | | | 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.
* Pass the configured ``ifa'' to rt_sendaddrmsg() instead of getting it viampi2016-06-141-3/+3
| | | | ``rt->rt_ifa'' later.
* Store the source address associated with a route in its own chunk ofmpi2016-06-141-12/+31
| | | | | | | | | 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@
* Revert previous, it breaks regression tests.mpi2016-06-081-8/+12
|
* Use rtalloc(9) instead of ifa_ifwithnet() to find an interfacempi2016-06-071-12/+8
| | | | | | | | | when adding a route to gateway to ensure a most specific match. This makes "# route add" coherent to "# route get" even with p2p interfaces. Fix a problem reported by Mart Tõnso. ok vgross@
* Remove superfluous parenthesis to shut up clang, from David Hill.mpi2016-06-031-2/+2
|
* set rt_expire times against time_uptime, not time_second.dlg2016-06-031-3/+3
| | | | | | | | | | | time_second is unix time so it can be affected by clock changes. time_uptime is monotonic so it isnt affected by clock changes. that in turn means route expiries wont jump with clock changes if set against time_uptime. the expiry is translated into unix time for export to userland though. ok mpi@
* s/stall/stale/ in a comment about old interfaces.dlg2016-06-011-2/+2
| | | | ok mpi@
* Flush dynamic route entries attached to an interface when its link statempi2016-05-311-5/+5
| | | | | | | | | | | becomes DOWN. This follows the same reasonning as for L2 (cloned) entries. Hopefully enough to fix tedu@'s stale RTF_DYNAMIC routes when switching WiFi network during suspend/resume. ok sthen@
* Plug a route entry leak triggered under memory pressure.mpi2016-05-311-11/+10
| | | | Help to track the leak from Hrvoje Popovski, ok bluhm@
* Simplify life for routing table implementations by requiring that rtable_walkjmatthew2016-05-021-10/+10
| | | | | | | | | | | callbacks return EAGAIN if they modify the routing table. While we're here, simplify life for rtable_walk callers by moving the loop that restarts the walk on EAGAIN into rtable_walk itself. Flushing cloned routes on interface state changes becomes a bit more inefficient, but this can be improved later. ok mpi@ dlg@
* Remove unused arguments from rt_checkgate().mpi2016-04-271-3/+2
| | | | | Since the rtalloc(9) rewrite no route lookup is done in this function so there's no need for a destination or a rtable ID.
* Always include the route priority in routing messages.mpi2016-03-261-7/+13
| | | | From Florian Riehm, ok bluhm@
* Do not populate RTAX_NETMASK when sending a routing message for RTF_HOSTmpi2016-03-261-2/+3
| | | | | | | | | | | | | | entries. This is a noop with the radix routing table because rt_mask() is always NULL for RTF_HOST entries, but it preserves the old behavior with ART. With the ART routing table host entry always have a prefix length equals to the length of the address. Fix a regression reported by semarie@. ok semarie@, bluhm@
* Sync no-argument function declaration and definition by adding (void).naddy2016-03-071-2/+2
| | | | ok mpi@ millert@
* L2 entries are always in the first table of a routing domain, this fixesderaadt2016-02-261-2/+3
| | | | | | a regression introduced during 5.7 and 5.8 as reported by Jean-Daniel Dupas on misc@ diff provided by mpi, ok claudio
* Fix ECMP routing by passing the correct destination address to thempi2016-02-241-3/+2
| | | | | | | | hash routine. Bug reported and fix analysed by Jean-Daniel Dupas <jddupas AT xooloo DOT net> ok deraadt@
* Pass the destination and mask to rtable_mpath_reprio() in order to notmpi2015-12-211-3/+7
| | | | use ``rt_node'' with ART.
* Do not pass a NULL ifp pointer to rtdeletemsg().mpi2015-12-111-3/+11
| | | | ok visa@
* Do not trigger a KASSERT() if the route we're trying to remove does notmpi2015-12-091-1/+8
| | | | | | | | | | | | | | | exist and we get another matching one instead. This bug has been here since the KAME area and recently exposed by a refactoring at n2k15. The problem is that rtrequest(9) does not check on which interface the route entry is attached when issuing a RTM_DELETE. So the kernel would end up deleting the route attached on a different ifp when in_ifinit() fails. This fix is currently a workaround, a better fix is in the pipeline. Reported by Laurence Tratt <laurie AT tratt DOT net>, thanks!
* Do not trigger a KASSERT() when destroying/detaching an interface withmpi2015-12-091-4/+19
| | | | | | | | | | | | RTF_CLONED routes attached. In thise case if_get(9) can return NULL inside rtflushclone1() because ifdetach() starts by clearing the interface pointer in the index map. So it is perfectly correct to bail and we're not going to leak any route entry because we're garbage collecting all of them. Reported by daniel@ and Aaron Miller <aaron DOT miller04 AT gmail DOT com>
* remove old lint annotationstedu2015-12-051-2/+1
|
* Move the KERNEL_LOCK from rt_match() to rtable_match().mpi2015-12-041-4/+3
| | | | ok claudio@
* Get rid of rt_mask() and stop allocating a "struct sockaddr" for everympi2015-12-031-8/+60
| | | | | | | | | | | | | 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@
* Remove broadcast matching from ifa_ifwithaddr(), use in_broadcast() wherevgross2015-12-031-2/+4
| | | | | | required. ok bluhm@ mpi@.