summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6_rtr.c
AgeCommit message (Collapse)Author
2024-07-14Unlock IPv6 sysctl net.inet6.ip6.forwarding from net lock.Alexander Bluhm
Use atomic operations to read ip6_forwarding while processing packets in the network stack. To make clear where actually the router property is needed, use the i_am_router variable based on ip6_forwarding. It already existed in nd6_nbr. Move i_am_router setting up the call stack until all users are independent. The forwarding decisions in pf_test, pf_refragment6, ip6_input do also not interfere. Use a new array ipv6ctl_vars_unlocked to make transition of all the integer sysctls easier. Adapt IPv4 to the new style. OK mvs@
2023-03-31Fix white space.Alexander Bluhm
2022-12-10Merge nd6_option_init() into nd6_options()Klemens Nanni
All call-sites call nd6_options() directly after nd6_option_init(). Fold them to simplify the logic and do less pointing around. Feedback OK bluhm florian
2022-12-09Switch nd_opts from a union to just a struct.Claudio Jeker
The ND6 option handling in the kernel got a lot simpler since only the tgt and src lladdr option are inspected by the kernel. The magic of assigning options via one side of the union and accessing them via the other is total overkill and actually quite error prone. OK florian@
2019-06-21Prevent recursions by not deleting entries inside rtable_walk(9).Martin Pieuchot
rtable_walk(9) now passes a routing entry back to the caller when a non zero value is returned and if it asked for it. This allows us to call rtdeletemsg()/rtrequest_delete() from the caller without creating a recursion because of rtflushclone(). Multicast code hasn't been adapted and is still possibly creating recursions. However multicast route entries aren't cloned so if a recursion exists it isn't because of rtflushclone(). Fix stack exhaustion triggered by the use of "-msave-args". Issue reported by Dániel Lévai on bugs@ confirmed by and ok bluhm@.
2018-01-23The IPv6 gateway address passed to rt6_flush() comes either from aAlexander Bluhm
packet through ip6_input() or from the routing table. In both cases the KAME hack has added the embeded scope to the address, so it is not necessary to fill the scope id again in rt6_flush(). Assert that it is already there. OK mpi@
2017-11-03We are processing Router Solicitation / Advertisement messages onlyFlorian Obser
for the Source Link-layer Address Options. Merge nd6_rs_input() and nd6_ra_input() into one generic function that does just that. input & OK mpi
2017-08-09We are no longer processing router advertisements in theFlorian Obser
kernel. OK mpi
2017-07-11Purging is at last at hand. Day of Doom is here. All that is evilFlorian Obser
shall all be cleansed. Remove sending of router solicitations and processing of router advertisements from the kernel. It's handled by slaacd(8) these days. Input & OK bluhm@, mpi@
2017-07-08Enable slaacd on the installer and temporarily neuter routerFlorian Obser
advertisement processing and solicitation sending like we already did for the non-install kernels. Next step will be to tedu all that code from the kernel. OK rpe@ for the installer bits move forward deraadt@
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-30Enable slaacd(8) by default and disable router solicitation andFlorian Obser
advertisement processing in the kernel. Go for it!!! deraadt@ additional encouragement to push forward from at least mpi and henning special thanks to naddy for being an early adopter and finding bugs.
2017-05-16Replace remaining splsoftassert(IPL_SOFTNET) by NET_ASSERT_LOCKED().Martin Pieuchot
ok visa@
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-03Iterate over the global list of interfaces instead of using the globalMartin Pieuchot
list of IPv6 addresses. ok bluhm@
2017-02-09percpu counters for raw ipv6 and icmp6 statsJeremie Courreges-Anglas
ok mpi@
2016-12-22Remove all splsoftnet() from ND6 converting the non-recrusive ones toMartin Pieuchot
NET_LOCK(). ok bluhm@
2016-11-28Explicitly initialize rti_ifa when automagically adding a route.Martin Pieuchot
This will allow to strengthen checks when userland adds a route. ok phessler@, bluhm@
2016-11-28Remove multiple recursive splsoftnet().Martin Pieuchot
ok bluhm@
2016-11-21Assert that defrtrlist_update() is always called at IPL_SOFTNET.Martin Pieuchot
2016-11-21Assert that prelist_update() is always called at IPL_SOFTNET.Martin Pieuchot
While here use __func__ in debug strings to reduce noise when grepping.
2016-11-21Assert that in6_ifadd() is always called at IPL_SOFTNET.Martin Pieuchot
While here us __func__ in debug strings to reduce noise when grepping.
2016-10-03Convert some of the remaining usages of time_second to time_uptime.Martin Pieuchot
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. Should fix mismatch between route timers that were already converted and ND default routers that were still using time_second. Tested by matthieu@ and sthen@ ok sthen@, dlg@
2016-09-30Revert sending router solicitations when a prefix expires and go backFlorian Obser
to previous behaviour of starting quick, exponentially backing off and settling on every 60 seconds. sthen@ noticed that this broke the backing off when we don't receive an advertisment and so we would hammer the network every second which is particularly bad on wifi networks. OK sthen@
2016-09-26typo in commentStuart Henderson
2016-09-08If the same address is offered via NA, update the existing ``ifa''Martin Pieuchot
instead of creating a new one. Having two addresses mean that the old, deprecated one, would be selected instead of the new one. The issue could be triggered by reducing the pltime/vltime values sent by a router advertisement daemon. Problem reported and fix tested by Jens Sauer on bugs@
2016-09-02Consider when a prefix expires when sending solicitations instead ofFlorian Obser
blindly always sending one every 60 seconds. repeated prodding & input naddy input & OK vgross
2016-09-02Go through the set function like normal people; no functional change.Florian Obser
OK benno@
2016-08-25Remove a check to expire received prefix.Martin Pieuchot
This check does not make sense since November 2000 when IPv6 autoconf address deletion has been made independent from prefix lifetimes. Fix a case when a route was added to the table but the corresponding address was not, leaving v6 unusable. Found the hardway by and ok sthen@
2016-08-22Sizes for free(9) from David Hill.Martin Pieuchot
2016-07-05Expand IN6_IFF_NOTREADY, ok bluhm@Martin Pieuchot
2016-05-02Simplify life for routing table implementations by requiring that rtable_walkJonathan Matthew
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@
2016-01-12Prevent a possible NULL-derefenced introduced by the move of RA sleepingMartin Pieuchot
code in a task. Such dereferenced can be triggered by receiving a RA with the 'on-link' bit set to 0 apparently generated by dnsmasq and reported by matthieu@. ok matthieu@, sthen@, bluhm@
2015-12-18Convert arc4random() to arc4random_uniorm(). Diff by Matthew Martin.tb
Ensure that arc4random_uniform() doesn't loop by redefining ND6_MAX_DESYNC_FACTOR to be 512, the largest power of two smaller than the RFC-specified 600 seconds. Suggested by florian@ and deraadt@ ok florian@, sthen@ in this form, arc4random change ok djm@, tedu@
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-01Use rt_ifa_add(9) instead or rtrequest(9) when adding ND prefixes.Martin Pieuchot
While here pick the corresponding ``ifa'' to attach the route instead of the one corresponding to the link-local address on the same interface. ok bluhm@
2015-11-24No need for <net/if_types.h>Martin Pieuchot
As a bonus this removes a "#if NCARP > 0", say yeah!
2015-11-02typo in commentStuart Henderson
2015-11-02Prefer an existing refcounted ``ifp'' to rt_ifp when possible or use theMartin Pieuchot
interface index directly. ok bluhm@
2015-10-30Rename rtrequest1() to rtrequest().Alexander Bluhm
OK mpi@
2015-10-28Remove linkmtu and maxmtu from struct nd_ifinfo. IN6_LINKMTU can nowFlorian Obser
die and ifp->if_mtu is the one true mtu. Suggested by and OK mpi@
2015-10-25Put some comments in how nd6_rs_attach() works.Florian Obser
Requested by stsp
2015-10-25Introduce if_rtrequest() the successor of ifa_rtrequest().Martin Pieuchot
L2 resolution depends on the protocol (encoded in the route entry) and an ``ifp''. Not having to care about an ``ifa'' makes our life easier in our MP effort. Fewer dependencies between data structures implies fewer headaches. Discussed with bluhm@, ok claudio@
2015-10-24Ignore Router Advertisment's current hop limit.Martin Pieuchot
Appart from the usual inet6 axe murdering exercise to keep you fit, this allows us to get rid of a lot of layer violation due to the use of per- ifp variables to store the current hop limit. Imputs from bluhm@, ok phessler@, florian@, bluhm@
2015-10-22Inspired by satosin(), use inline functions to convert sockaddr dl.Alexander Bluhm
Instead of casts they check wether the incoming object has the expected type. So introduce satosdl() and sdltosa() in the kernel. OK mpi@
2015-09-18Do not manually decrement rt's refcounter in nd6_lookup() and let theMartin Pieuchot
callers rtfree(9) it. Inputs and ok bluhm@
2015-09-12Now that rtrequest1(9) properly sets RTF_UP for newly added route,Martin Pieuchot
stop passing it in every rt_ifa_add(9) calls. ok claudio@
2015-09-11Kill yet another argument to functions in IPv6. This time ip6_output'sClaudio Jeker
ifpp - XXX: just for statistics ifpp is always NULL in all callers so that statistic confirms ifpp is dying OK mpi@
2015-09-10if_put dance, shuffle some code and switch a printf to print the ifindexClaudio Jeker
instead of the name so we don't have to if_get/if_put it for just that. OK dlg@