summaryrefslogtreecommitdiff
path: root/sys/netinet6/in6.c
AgeCommit message (Collapse)Author
2019-11-18Accept inet6 address with missing sa_len for the get ioctl(2).Alexander Bluhm
dhcpcd from ports uses SIOCGIFAFLAG_IN6 without setting sin6_len. OK deraadt@ millert@
2019-11-11Kernel is missing propper input validation when configuring IPv6Alexander Bluhm
addresses. Implement in6_sa2sin6() to validate inet6 address family and address length. The SIOCGIFDSTADDR_IN6, SIOCGIFNETMASK_IN6, SIOCGIFAFLAG_IN6, SIOCGIFALIFETIME_IN6, and SIOCDIFADDR_IN6 ioctl(2) are safe now. OK visa@
2019-11-08convert interface address change hooks to tasks and a task_list.David Gwynne
this follows what's been done for detach and link state hooks, and makes handling of hooks generally more robust. address hooks are a bit different to detach/link state hooks in that there's only a few things that register hooks (carp, pf, vxlan), but a lot of places to run the hooks (lots of ipv4 and ipv6 address configuration). an address hook cookie was in struct pfi_kif, which is part of the pf abi. rather than break pfctl -sI, this maintains the void * used for the cookie and uses it to store a task, which is then used as intended with the new api.
2019-10-22Fix white spaces and use __func__ in printf().Alexander Bluhm
2019-02-13change rt_ifa_add and rt_ifa_del so they take an rdomain argument.David Gwynne
this allows mpls interfaces (mpe, mpw) to pass the rdomain they wish the local label to be in, rather than have it implicitly forced to 0 by these functions. right now they'll pass 0, but it will soon be possible to have them rx packets in other rdomains. previously the functions used ifp->if_rdomain for the rdomain. everything other than mpls still passes ifp->if_rdomain. ok mpi@
2019-02-10remove the implict RTF_MPATH flag that rt_ifa_add() sets on new routes.David Gwynne
MPLS interfaces (ab)use rt_ifa_add for adding the local MPLS label that they listen on for incoming packets, while every other use of rt_ifa_add is for adding addresses on local interfaces. MPLS does this cos the addresses involved are in basically the same shape as ones used for setting up local addresses. It is appropriate for interfaces to want RTF_MPATH on local addresses, but in the MPLS case it means you can have multiple local things listening on the same label, which doesn't actually work. mpe in particular keeps track of in use labels to it can handle collisions, however, mpw does not. It is currently possible to have multiple mpw interfaces on the same local label, and sharing the same label as mpe or possible normal forwarding labels. Moving the RTF_MPATH flag out of rt_ifa_add means all the callers that still want it need to pass it themselves. The mpe and mpw callers are left alone without the flag, and will now get EEXIST from rt_ifa_add when a label is already in use. ok (and a huge amount of patience and help) mpi@ claudio@ is ok with the idea, but saw a much much earlier solution to the problem
2018-10-05Do not join node information multicast group (RFC 4620).Florian Obser
Benno removed code to answer ICMP queries over 4 years ago. Aham Brahmasmi (aham.brahmasmi AT gmx.com) points out that we still joined the group though. OK sthen, bluhm, kn
2018-05-12Make the code a bit easier on the eye by factoring repeated embeddedTheo Buehler
scope check and clearing of the scope id into separate functions. input & ok visa, mpi
2018-05-06Nuke unused ia6_createtime struct member.Florian Obser
OK tb
2018-05-06Continue refactoring and cleanup of in6_ioctl().Theo Buehler
Hoist privilege check to the top and split out handling of SIOCAIFADDR_IN6 and SIOCDIFADDR_IN6 into a separate function. Merge tangled switches and simplify the code paths. tested by hrvoje ok visa
2018-05-04Split handling of SIOCGIF*_IN6 into a separate function in6_ioctl_get()Theo Buehler
that only needs a read lock. Tested by hrvoje ok visa
2018-05-02Push the NET_LOCK() down in in6_control() similar to what was doneTheo Buehler
for in_control(). Protect mrt6_ioctl() and nd6_ioctl() with a read lock and in6_ioctl with the NET_LOCK() while establishing a single exit point. tested by kn ok florian, mpi, visa
2018-04-24Make the ramdisks compile again, we don't have MROUTING on them.Florian Obser
Found the hard way.
2018-04-24Push NET_LOCK down in the default ifioctl case.Paul Irofti
For the PRU_CONTROL bit the NET_LOCK surrounds in[6]_control() and on the ENOTSUPP case we guard the driver if_ioctl functions. OK mpi@
2018-04-24Run duplicate address detection again if an existing address getsFlorian Obser
updated from userland that was marked duplicated or tentative. Otherwise we would just lose the duplicated / tentative state and assume that the address is now unique and usable. OK kn
2017-11-23Replace non mp-safe carp_iamatch6() with mp-safe carp_iamatch().Martin Pieuchot
They have the same functionnality since friehm@ cleaned up balancing code. ok florian@, visa@, patrick@, bluhm@, jmatthew@
2017-11-04Stop calling ifp->if_ioctl() inside in{,6}_ioctl().Martin Pieuchot
Instead return EOPNOTSUPP and call it from ifioctl(). This will help getting per-driver ioctl routines outside of need the NET_LOCK(). While here always return ENXIO when ``ifp'' is NULL. ok visa@, florian@
2017-11-02Over 17 years is probably 'a while...'Florian Obser
Also it does not change behaviour. OK jca
2017-10-26Kill deprecated IPv6 ioctl(2)s.Martin Pieuchot
ok florian@, sthen@, jsg@
2017-10-24Remove some more tests checking for a non-NULL `ifp->if_ioctl'.Martin Pieuchot
if_attach() enforces it is properly defined.
2017-10-24Remove support for never used ioctls originating from KAME.Martin Pieuchot
ok florian@, claudio@, bluhm@
2017-10-20Do not test if if_ioctl is NULL, it isn't.Martin Pieuchot
ok florian@, claudio@, visa@, bluhm@
2017-10-16Remove kernel support for the following ioctl(2)s, deprecated since 2001:Martin Pieuchot
- SIOCSIFPHYADDR - SIOCSIFPHYADDR_IN6 - SIOCGIFPSRCADDR - SIOCGIFPSRCADDR_IN6 - SIOCGIFPDSTADDR - SIOCGIFPDSTADDR_IN6 ok bluhm@
2017-08-15After we stopped processing router advertisements in the kernelFlorian Obser
sppp_update_ip6_addr() became the last user of n6_are_prefix_equal(). Since it compares /128 prefixes it doesn't need all the bells and whistles and can be converted to a memcmp. Remove the now unused n6_are_prefix_equal(). OK bluhm, mpi
2017-08-11Validate sockaddr from userland in central functions. This resultsAlexander Bluhm
in common checks for unix, inet, inet6 instead of partial checks here and there. Some checks are already done at a higher layer, but better be paranoid with user input. OK claudio@ millert@
2017-08-08Stop running nd6_expire every second.Florian Obser
We know when pltime or vltime decrease to zero. Run nd6_expire then. Input & OK mpi, bluhm
2017-08-06in6_leavegroup can't fail; OK phesslerFlorian Obser
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-29Allow passing in IN6_IFF_AUTOCONF from userland. Needed by slaacd(8)Florian Obser
OK naddy
2017-05-16Replace remaining splsoftassert(IPL_SOFTNET) by NET_ASSERT_LOCKED().Martin Pieuchot
ok visa@
2017-05-08Added initial IPv6 multicast routing support for multiple rdomains:Rafael Zalamena
* don't share mifs (multicast interface) between rdomains * allow multiple routing sockets connected at the same time if they are in different rdomains. ok bluhm@
2017-05-04Introduce sstosa() for converting sockaddr_storage with a type safeAlexander Bluhm
inline function instead of casting it to sockaddr. While there, use inline instead of __inline for all these conversions. Some struct sockaddr casts can be avoided completely. OK dhill@ mpi@
2017-04-17We need to update the ia6_updatetime when changing the vltime/pltimeFlorian Obser
vio ioctl(2). Otherwise ifconfig shows the wrong times since vltime/pltime are calculated from this value on export. The handling of router advertisements does the right thing. OK bluhm
2017-03-16Userland expects pltime to be a time stamp not number of seconds.Florian Obser
pltime conversion was missing from rev 1.193 which did the vltime conversion only. OK mpi
2017-03-06Kill global list of IPv6 addresses.Martin Pieuchot
ok bluhm@
2017-02-16Revert "Release the NET_LOCK() before entering per-driver ioctl() routine".Martin Pieuchot
This is most likely to be the cause of the deadlock seen by port builders since it's the only changed that happened after a2k17. Instead bring back pirofti@ original hack to release the NET_LOCK() inside iwm(4) and iwn(4). This fixes some splassert reported by bluhm@ Deadlock reported by naddy@ and rpe@ and ajacoutot@ confirmed the deadlock has been introduced post a2k17. Tested by and ok tb@
2017-02-07Release the NET_LOCK() before entering per-driver ioctl() routine.Martin Pieuchot
This prevents a deadlock with the X server and some wireless drivers. The real fix is to take unix domain socket code out of the NET_LOCK(). Issue reported by pirofti@ and ajacoutot@ ok tb@, stsp@, pirofti@
2017-02-05Use percpu counters for ip6statJeremie Courreges-Anglas
Try to follow the existing examples. Some notes: - don't implement counters_dec() yet, which could be used in two similar chunks of code. Let's see if there are more users first. - stop incrementing IPv6-specific mbuf stats, IPv4 has no equivalent. Input from mpi@, ok bluhm@ mpi@
2016-12-21Remove recursive splsoftnet() from the ioctl(2) path.Martin Pieuchot
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-10-04Correct the flag checks inside rt_ifa_addlocal(9) and rt_ifa_dellocal(9).Martin Pieuchot
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@
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-04Purge routes attached to an address when this address is removed.Martin Pieuchot
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@
2016-08-22Sizes for free(9) from David Hill.Martin Pieuchot
2016-08-08Execute address hooks in the update case.Martin Pieuchot
This matches what IPv4 is doing and unbreak carp(4) when the same address is set twice, for example when running netstart(8) multiple times. Issue reported by and fix from Simon Mages.
2016-07-13Introduce RTF_MULTICAST and flag corresponding IPv6 routes as suchMartin Pieuchot
instead of abusing RTF_CLONING. Fix a leak reporeted by Aaron Riekenberg on misc@, ok sthen@
2016-07-05Expand IN6_IFF_NOTREADY, ok bluhm@Martin Pieuchot
2016-06-13Move the ioctl(2) logic of in{,6}_control() into two new functionsMartin Pieuchot
in{,6}_ioctl() that do not deal with sockets. This will allow to automagically configure interface addresses in the kernel without too many layer violations. Required by upcoming umb(4).
2016-03-03Kill IPv6 prefix and router renumbering ioctls.Jeremie Courreges-Anglas
Router renumbering was never supported, prefix ioctls were deprecated ~15 years ago. Move some items in netinet6/nd6.h where they are still used. ok mikeb@ mpi@
2016-03-03Delete all traces of SIOCSIF(ADDR|DSTADDR|NETMASK)_IN6Jeremie Courreges-Anglas
Those ioctls never made sense, IPv6 was designed right from the start with support for multiple addresses by interface. ok mikeb@ mpi@