summaryrefslogtreecommitdiff
path: root/sys/netinet6/in6_ifattach.c
AgeCommit message (Collapse)Author
2018-08-26Do not add ::1 on non-default lo(4) as intended.Martin Pieuchot
Reported by and ok sthen@
2018-07-10When an interface doesn't have a layer 2 address in6_get_soii_ifid()Florian Obser
failes and then later on a in in6_get_ifid() a layer 2 address is "borrowed" from from another interface. Do the "borrowing" in in6_get_soii_ifid(), too so that semantically opaque interface identifiers work for these kind of interfaces, too. OK phessler, benno
2018-07-10When an interface doesn't have a layer 2 address in6_get_ifid()Florian Obser
tries to "borrow" one from another interface. But then it checks if the U bit is set int the generated EUI64 address and rejects it. On the other hand for interfaces that do have a layer 2 address this check is skipped, so relax it for the "borrowing" case, too. With this one gets stable link local addresses on e.g. gre(4) interfaces on certain virtualisation environments depending which mac addresses get picked for the vio(4) interfaces while previously we would end up with a random IP on every reboot. Reported by Aaron A. Glenn via phessler. OK phessler, benno
2018-03-27Use memcpy instead of bcopy when the memory does not overlap.David Hill
OK deraadt@ florian@
2018-03-13Calculate RFC7217 link-local style addresses the same way asFlorian Obser
slaacd(8). RFC 7217 states (section 5, page 9): | The Interface Identifier is finally obtained by taking as many | bits from the RID value (computed in the previous step) as | necessary, starting from the least significant bit. Problem in slaacd pointed out by semarie@. OK sthen, phessler
2018-02-10Implement RFC 7217: "A Method for Generating Semantically OpaqueFlorian Obser
Interface Identifiers with IPv6 Stateless Address Autoconfiguration." "An IPv6 address configured using this method is stable within each subnet, but the corresponding Interface Identifier changes when the host moves from one network to another. This method is meant to be an alternative to generating Interface Identifiers based on hardware addresses." OK naddy, sthen
2017-09-01Use in6_get_rand_ifid() instead of get_last_resort_ifid() and delete theFlorian Obser
get_last_resort_ifid() function because eww. Also if your system is so constraint that you end up in in6_get_rand_ifid() you don't deserve a random ifid that stays stable over reboots. Simplify code a bit since get_ifid() can no longer fail. It couldn't fail before either because that code path was #if 0'ed. While here sprinkle in some in6_ prefixes, pointed out by stsp. OK stsp
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-05-16Replace remaining splsoftassert(IPL_SOFTNET) by NET_ASSERT_LOCKED().Martin Pieuchot
ok visa@
2016-12-29Get rid of recursive splsoftnet() in in6_ifattach_linklocal().Martin Pieuchot
ok visa@
2016-06-30Restore the automagically added /64 route on p2p interfaces in order toMartin Pieuchot
send traffic to link-local addresses without default route. Fix a regression reported by Michael Lechtermann, ok stsp@, sthen@
2015-12-02When destroying an interface, we have to wait until all referencesAlexander Bluhm
are not used anymore. This has to be done before any interface fields become invalid. As the route delete request cannot call if_get() anymore, pass down the interface. Split rtrequest_delete() into a separate function that may take an existing inteface. OK mpi@
2015-10-24Convert to rt_ifidx.Martin Pieuchot
ok 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-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-03Change the order of operations for loopback interfaces to haveMartin Pieuchot
::1 configured before fe80::1. (lo0:0) in pf should resolve to 127.0.0.1 ::1. reported by and ok mikeb@
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-17Remove anoying comment about in6_update_ifa().Martin Pieuchot
2015-07-18Merge two identical chunks to add new prefixes to the global dataMartin Pieuchot
structures into a function. ok florian@
2015-07-16Properly layer Router Solicitation code.Martin Pieuchot
Tweak and ok florian@
2015-06-08More damned eye searing whitespace. No change to .o files.Kenneth R Westerback
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-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-05Convert various rtrequest1(RTM_DELETE,...) calls to rtdeletemsg(9).Martin Pieuchot
This unify some code and notify userland for free. blambert@ agrees, ok bluhm@
2015-01-28Revert rtdeletemsg conversion. It was not ok'd, I misunderstood bluhm@'sMartin Pieuchot
email.
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-26Call rtdeletemsg(9) instead of rerolling its code. As a bonus you'llMartin Pieuchot
get userland notification for free. ok blambert@, bluhm@
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-08Clear autoconf6 flag after autoconf6 cleanup happened, not before.Florian Obser
Otherwise clean up code will never run. OK mpi@, benno@, henning@
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-04replace md5 with sha512. ok deraadtTed Unangst
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-18Nuke yet more obvious #include duplications.Kenneth R Westerback
ok miod@
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-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-01When a carp interface is created with IFXF_NOINET6 flag, no link-localSebastian Benoit
address will be created when the vhid (and MAC) is set. Depending on the order of the configuration the interface can end up with a ipv6 address, but no v6 link-local and no working neigbor discovery. Removing this case statement will result in the link-local address being configured by "ifconfig up" if the inet6 address was configured before. If you are using inet6 on carp, put an "up" at the end of your hostname.if. I will work on a better solution at g2k14. ok henning, mpi
2014-06-26Calling in{6,}_purgeaddr() is not enough to remove an address fromMartin Pieuchot
an interface. Two other operations are performed when issuing a SIOCDIFADDR{_IN6,} ioctl: call the address hook and the per-driver ioctl function. Since carp(4) relies on an address hook to recalculate its hash, make sure to call this hook when IFXF_NOINET6 is set or when the rdomain is changed. ok henning@, mikeb@
2014-06-03Do not include <sys/malloc.h> where it is not needed.Martin Pieuchot
2014-05-20Fix eui64 address generation, broken since the removal of the link-layerMartin Pieuchot
address from the per-ifp list. Found the hard way by weerd@, florian@ and stsp@, ok florian@
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-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
2014-01-06Make in6_ifdetach() remove the ff01::1 route for the detaching interface, too.Stefan Sperling
The route used to linger after an interface detached from IPv6. ok mikeb
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@
2013-11-19Remove some FDDI/ATM leftovers.Martin Pieuchot
ok mikeb@, henning@, deraadt@, brad@, miod@
2013-10-17The header file netinet/in_var.h included netinet6/in6_var.h. ThisAlexander Bluhm
created a bunch of useless dependencies. Remove this implicit inclusion and do an explicit #include <netinet6/in6_var.h> when it is needed. OK mpi@ henning@
2013-05-31Remove a bunch of sockaddr_in6 pointer casts and replace othersAlexander Bluhm
with sin6tosa() or satosin6() inline functions. This allows the compiler to check the types more strictly. OK mpi@