summaryrefslogtreecommitdiff
path: root/sys/netinet6/in6.c
AgeCommit message (Collapse)Author
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-10Kill in6_ifstat_inc() and associated per-ifp storage.Martin Pieuchot
The SIOCGIFSTAT_IN6 is no longer supported. ok mikeb@, claudio@, dlg@
2015-09-10In IPv6 source address selection prefer addresses of the outgoingAlexander Bluhm
interface. OK mpi@
2015-09-10Trivial if_put addition. OK dlg@Claudio Jeker
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-09-04Tunnels also need a cloning route.Martin Pieuchot
Fix a regression reported by Brad.
2015-08-31Do not install connected routes on loopback interfaces.Martin Pieuchot
Previously loopback connected routes were managed via the global list of prefixes, which mean that systems with AUTOCONF'd addresses did not see them in the routing table. This also makes inet6 route creation coherent with inet.
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-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-24In kernel initialize struct sockaddr_in and sockaddr_in6 to zeroAlexander Bluhm
everywhere to avoid passing around pointers to uninitialized stack memory. While there, fix the call to in6_recoverscope() in fill_drlist(). OK deraadt@ mpi@
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-19Remove some verbose logs in in6_update_ifa() now that errors areMartin Pieuchot
propagated.
2015-08-18Check the error value returned by in6_ifattach().Martin Pieuchot
Prodded by and ok bluhm@
2015-08-12Remove backward compatibilify goos for IN6_IFF_DEPRECATED and insteadMartin Pieuchot
reject SIOCAIFADDR_IN6 ioctl(2) where it is set. ok jca@, bluhm@
2015-07-18Merge two identical chunks to add new prefixes to the global dataMartin Pieuchot
structures into a function. ok florian@
2015-07-08Pass an interface index instead of a pointer to in6_addr2scopeid().Martin Pieuchot
ok millert@
2015-06-08More damned eye searing whitespace. No change to .o files.Kenneth R Westerback
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-20Do not treat loopback interfaces as p2p interfaces and create onlyMartin Pieuchot
one route to "::1". Due to a clever BSD trick, the `ifa_dstaddr` field of addresses on IFF_LOOPBACK ifps is set to the same value that `ifa_addr`. That's why filtering for broadcast addresses is so complicated, because guess what, `ifa_broadaddr` is the same as `ifa_dstaddr`! Sadly our IPv6 code was "only" checking for `ifa_dstaddr` without looking if the ifa was attached to a IFF_POINTOTPOINT interface. So it always tried to create two routes to "::1" and, with the recent RTF_LOCAL work, succeed. You should now have only one local route to "::1". ::1 ::1 UHl 14 0 32768 1 lo0 -::1 ::1 UH 0 0 32768 4 lo0 ok henning@
2015-04-20Always call rt_ifa_dellocal(9) when removing an IPv6 address.Martin Pieuchot
The routing layer already check for the correct ifa when asked to delete a local route, so do not try to be clever here. This change also prevent having a NULL ifp pointer in your routing table when you delete loopback interfaces having the same address. ok henning@
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-02-19All other calls to pfxlist_onlink_check() are protected by splsoftnet.Alexander Bluhm
Put an splsoftnet() around the call to pfxlist_onlink_check() in in6_control(SIOCAIFADDR_IN6). Include the call to dohooks() in the protection like it is done elsewhere. splassert failure reported and fix tested by matthieu@; OK mikeb@
2015-01-27Always call if_ioctl() for loopback interfaces, just like IPv4 do, toMartin Pieuchot
make sure the default MTU is set for every address configured on the ifp and not just the first one. Regress test breakage reported by daniel@
2015-01-27Ensure that link-local addresses are correctly configured on loopbackMartin Pieuchot
interfaces. When the kernel automagically configures IPv6 addresses on loopback interfaces, start by assigning a link-local address and then try to assign "::1". Only the first configured loopback interface per rdomain can have the "::1" address. But even if other loopback interfaces failed to get this address, because it is already taken, give them a chance to have a link-local address. While here change in6_ifattach() to return an error value and remove duplicated code. Fix a regression introduced by the NOINET6 flag removal. ok henning@, stsp@, florian@, benno@
2015-01-24Userland (base & ports) was adapted to always include <netinet/in.h>Theo de Raadt
before <net/pfvar.h> or <net/if_pflog.h>. The kernel files can be cleaned up next. Some sockaddr_union steps make it into here as well. ok naddy
2015-01-10Correct some comments and merge in6_if_up() into in6_ifattach() toMartin Pieuchot
reflect that IPv6 link-local addresses are no longer automagically configured the first time an interface is brought up. ok henning@, stsp@
2015-01-06Remove the NOINET6 interface flag, a left-over from the times when IPv6Stefan Sperling
was enabled by default. Add AFATTACH/AFDETACH ioctls which enable/disable an address family for an interface (currently used for IPv6 only). New kernel needs new ifconfig for IPv6 configuration (address assignment still works with old ifconfig making this easy to cross over). Committing on behalf of henning@ who is currently lebensmittelvergiftet. ok stsp, benno, mpi
2014-12-08Do not take into account addresses configured in a different rdomainMartin Pieuchot
to decide whether or not to remove local routes. Prevent from having a NULL ifp pointer in the routing table when an address present in another rdomain is removed from an interface. ok bluhm@
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-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-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-22Introduce a special hack for carp during IPv6 source address selection:Stefan Sperling
If there is a tie then a carp interface is not allowed to win even if it has an address with a longer bitwise match. This allows reliable IPv6 communication between carp master and backup across a shared IPv6 subnet. Consider the carp address 2001:DB8:10::14, which is configured on firewall A (in carp master state) and firewall B (in carp backup state), each of which has another address in the same prefix on a non-carp interface (A has 2001:DB8:10::1 and B has 2001:DB8:10::11). In this setup, A would use 2001:DB8:10::14 as source address when sending neighbour solicitations to B. Since 2001:DB8:10::14 is a local address from B's point of view, B never replied to the neighbour solicitations sent by A. With this change A uses 2001:DB8:10::1 as source address instead. ok mpi@
2014-10-14Use rtfree() instead of RTFREE(), NULLify some free'd route pointers andMartin Pieuchot
kill the macro. ok mikeb@, henning@
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-08-26Do not hand-roll all routers link local address.Florian Obser
pointed out & OK bluhm@
2014-08-25Move sending of router solicitations to the kernel; receiving andFlorian Obser
processing of router advertisements was already in the kernel. With this rtsol{,d}(8) is no longer necessary. The kernel starts sending solicitations with # ifconfig $IF inet6 autoconf or inet6 autoconf in /etc/hostname.$IF. input stsp@ much help & OK mpi@ tweaks & OK bluhm@
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-05-15Do not use nd6_rtrequest() for addresses configured on loopbackMartin Pieuchot
interfaces. ok mikeb@
2014-05-05Use a custom ifa_rtrequest function for point-to-point interfacesMartin Pieuchot
instead of relying on hacks in nd6_rtrequest() to add a route to loopback for each address configured on such interfaces. While here document that abusing lo0 for local traffic is not safe for interfaces in a non-default rdomain. Tested by claudio@, jca@ and sthen@, ok sthen@
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-27Stop mixing interface address flags with routing entry ones.Martin Pieuchot
Instead of always copying ifa_flags to the routing entry flags when creating a route by calling rtinit(), explicitly pass the RTF_CLONING flag when required. This means ifa_flags are now *only* used to check if an address has an associated route that was created by the kernel auto-magically. ok benno@
2014-02-12Kill a never defined old compatibility goo from 12 years ago.Martin Pieuchot
ok mikeb@, bluhm@
2014-01-22There's no reason to pass a netmask argument when doing a RTF_HOSTMartin Pieuchot
request, so kill it along with the associated global variable. ok claudio@
2014-01-21Do not clean the multicast records of an interface when it is destroyedMartin Pieuchot
(unplugged). Even if it makes no sense to keep them around if the interface is no more, we cannot safely remove them since pcb multicast options might keep a pointer to them. Fixes a user after free introduced by the multicast address linking rewrite and reported by Alexey Suslikov, thanks! ok claudio@
2014-01-15Remove assigned but never read value.Martin Pieuchot
ok stsp@
2014-01-13Call all local valiables of type struct in6_ifaddr "ia6". This isAlexander Bluhm
consistent with struct ifaddr "ifa" and struct in_ifaddr "ia". OK mpi@
2014-01-07Some follow-up fixes for IFID collision handling in IPv6CP.Stefan Sperling
Really change the link-local address in the unlikely event of an IFID collision, instead of going into an infinite conf-nak loop with the peer. To make the netinet6 code use the IPv6CP IFID in a new link-local address, in6_ifattach_linklocal() must accept a provided IFID. Replace the unused 'altifp' parameter with a new 'ifid' parameter for this purpose. Always use the latest suggested address in IPv6CP replies, even if the task to update the interface's address hasn't run yet. Also, clear the ifindex (KAME hack) in addresses sent during IPv6CP. ok mpi
2013-11-28Change the way protocol multicast addresses are linked to an interface.Martin Pieuchot
Instead of linking multicast records to the first configured address of the corresponding protocol, making this address and its position in the global list special, add them to a new list directly linked to the interface descriptor. This new multicast address list is similar to the address list, all its elements contain a protocol agnostic part. This design allows us to be able to join a multicast group without necessarily having a configured address. That means IPv6 multicast kludges are no longer needed. Another benefit is to be able to add and remove an IP address from an interface without worrying about multicast records. That means that the global IPv4 list is no longer needed since the first configured address of an interface is no longer special. This new list might also be extended in the future to contain the link-layer addresses used to configure hardware filters. Tested by sthen@ and weerd@, ok mikeb@