summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6_rtr.c
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-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@
2015-09-09Kill icmp6_ifstat_inc() and associated per-ifp storage.Martin Pieuchot
The SIOCGIFSTAT_ICMP6 is no longer supported. ok dlg@, mikeb@, claudio@
2015-08-24nd6_prefix_add() is no longer used and die.Martin Pieuchot
2015-08-24Start moving away from the global prefix list by limiting its usage toMartin Pieuchot
AUTOCONF'd addresses. This prevent the kernel from removing connected (/64) routes as soon as it configures an AUTOCONF'd address based on a RA. Tested by sebastia@, ok sthen@
2015-08-24Always increment the reference counter of the returned route entry inMartin Pieuchot
rtrequest1(9). This simplifies rtfree(9) dances and will prevent another CPU to free the entry before we're done with it as soon as routing functions can be executed in parallel. ok bluhm@, mikeb@
2015-08-24Rework the code to decide when to perform DAD to no longer rely on theMartin Pieuchot
IN6_IFF_NODAD pseudo-flag not being set. This was just a flag for spaghetti code that should not exist in the first place. Tested by sebastia@, ok sthen@
2015-08-19Convert all calls to rtrequest1() and the following error checkAlexander Bluhm
into a common pattern. In the man page clarify the usage of the returned route. OK mpi@ mikeb@ jmc@
2015-08-18Call rtfree(9) when we no longer need the route entry rather thanMartin Pieuchot
decrementing rt_refcnt just after rtrequest1(9). While here reduce the differences with rt_ifa_add(9). There's still an ambiguity about rtrequest1(9)'s return value, but bluhm@ will address that in a different diff. Discussed with and ok bluhm@
2015-08-17Remove anoying comment about in6_update_ifa().Martin Pieuchot
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-18Merge two identical chunks to add new prefixes to the global dataMartin Pieuchot
structures into a function. ok florian@
2015-07-17Remove #if 0'ed code and update comment.Florian Obser
There is no need to handle managed/other flags for router advertisments in the kernel according to the rfcs. Remove stale todo comment; we do handle the on-link bit. OK mpi
2015-07-16Expand ancient NTOHL/NTOHS/HTONS/HTONL macros.Martin Pieuchot
ok guenther@, henning@
2015-07-16Properly layer Router Solicitation code.Martin Pieuchot
Tweak and ok florian@
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-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-06-08More damned eye searing whitespace. No change to .o files.Kenneth R Westerback
2015-06-04Remove unused sa_dl.Martin Pieuchot
2015-05-26Store the IP address of the corresponding ifa in the rt_gateway fieldMartin Pieuchot
of RTF_CLONING and RTF_BROASCAST routes to not create MPATH conflicts when IP address aliases are used. This change makes it possible to have multiple RTF_CLONING routes with the same priority. Note that any of the existing RTF_CLONING route might be used by the kernel to create a RTF_CLONED route which should not be a problem with aliases since they are attached to the same ifp. This unbreak address aliases since the kernel supports multiple connected routes for a subnet. Found the hardway by djm@, ok claudio@
2015-05-15Allow multiple connected/interface routes to exist at the same time.Claudio Jeker
Use the existing multipath code. Switch away from using the ifa address when making the cloning route and instead put a dummy sockaddr_dl route in. With this it is possible to use the same network on multiple interfaces at the same time. So if wireless and ethernet share the same network the system will use the wired connection as long as there is link. Still missing is builtin proxy-arp for the other interface IPs to allow hitless failover. OK mpi@
2015-04-27Do not call nd6_purge() before purging the IPv6 addresses of a detachedMartin Pieuchot
interface. Fix a use after free introduced in r1.98 of netinet6/in6.c and recently exposed by a crazy pool/malloc damage finder being currently refined by dlg@ and deraadt@. ok mikeb@, henning@
2015-03-25With a per interface IPv6 stateless adress auto configuration flag itFlorian Obser
is possible to allow IPv6 forwarding and SLAAC at the same time. This is needed for RFC 7084. Thanks to henning@ for marking places that needed looking at in Ljubljana. OK phessler@, benno@
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2015-03-09Avoid doing IPv6 SLAAC for prefixes with preferred lifetime of zeroMike Belopuhov
RFC 4941 says in 3.3.5: "In particular, an implementation MUST NOT create a temporary address with a zero Preferred Lifetime." OK sthen, henning, benno
2015-02-19Move the splsoftnet() hiding in the declarations closer to the code.Alexander Bluhm
No binary change; OK mikeb@
2015-01-27remove the second void * argument on tasks.David Gwynne
when workqs were introduced, we provided a second argument so you could pass a thing and some context to work on it in. there were very few things that took advantage of the second argument, so when i introduced pools i suggested removing it. since tasks were meant to replace workqs, it was requested that we keep the second argument to make porting from workqs to tasks easier. now that workqs are gone, i had a look at the use of the second argument again and found only one good use of it (vdsp(4) on sparc64 if you're interested) and a tiny handful of questionable uses. the vast majority of tasks only used a single argument. i have since modified all tasks that used two args to only use one, so now we can remove the second argument. so this is a mechanical change. all tasks only passed NULL as their second argument, so we can just remove it. ok krw@
2014-12-22Operations on the global prefix or address lists should be done underMartin Pieuchot
splsoftnet().
2014-12-22Make sure rtrequest1(9) is called under splsoftnet().Martin Pieuchot
2014-12-17Remove the "multicast_" prefix from the fields a multicast-only struct.Martin Pieuchot
Prodded by claudio@ and mikeb@
2014-12-17Use an interface index instead of a pointer for multicast options.Martin Pieuchot
Output interface (port) selection for multicast traffic is not done via route lookups. Instead the output ifp is registred when setsockopt(2) is called with the IP{V6,}_MULTICAST_IF option. But since there is no mechanism to invalidate such pointer stored in a pcb when an interface is destroyed/removed, it might lead your kernel to fault. Prevent a fault upon resume reported by frantisek holop, thanks! ok mikeb@, claudio@
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-20What have no need for a variable that holds the maximum MTU size ofMartin Pieuchot
interfaces with an IPv6 address. ok henning@, mikeb@, deraadt@
2014-11-18move arc4random prototype to systm.h. more appropriate for most codeTed Unangst
to include that than rdnvar.h. ok deraadt dlg
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-07Do not protect the SIOCSIFADDR call by splnet(). Drivers alreadyMartin Pieuchot
raise it inside their ioctl handler (except for carp(4), what else?). In general, global structures manipulated in the softnet codepath only require a splsoftnet() protection when they are modified in process (ioctl) context. Also put some IPL_SOFNET asserts in functions accessing global structures. Previous version diff ok mikeb@, with inputs from and ok bluhm@
2014-09-09workqs were replaced with tasks in here, so dont need workq.h anymore.David Gwynne