summaryrefslogtreecommitdiff
path: root/sys/netinet6
AgeCommit message (Collapse)Author
2018-08-22frag6_slowtimo: push NET_LOCK into frag6_freef around icmp6_error.cheloha
icmp6_error() still probably needs the NET_LOCK, as the call chain icmp6_error -> icmp6_reflect -> rt_match -> rt_clone -> rtrequest is possible. The fragment discard loop in frag6_slowtimo and the other cleanup bits in frag6_freef do not require it however. So push the lock down into frag6_freef around icmp6_error. Prompted by mpi. Discussed with bluhm and kn. Regress test help by bluhm. Additional testing by kn. ok kn@ visa@ mpi@
2018-08-03Account when the next nd6_timer_to is scheduled in nd6_timer()Florian Obser
otherwise nd6_llinfo_settimer() might wrongly assume that a timeout is already scheduled earlier and not schedule one itself. This in turn lead to the neighbor cache no longer updating because neighbor solicitations were not send. Observed by many. OK kn
2018-07-12Introduce RTM_CHGADDRATTR to inform userland on the route socket whenFlorian Obser
an attribute of an address is changed. For now it's used when IPv6 duplicate address detection finishes. With this slaacd(8) can find out if a configured address is not duplicated without the need to poll. OK phessler, benno, claudio
2018-07-12Introduce ipsec_output_cb() to merge duplicate code and account forMartin Pieuchot
dropped packets in the output path. While here fix a memory leak when compression is not needed w/ IPcomp. ok markus@
2018-07-11Disambiguate the source of panics in sys/net* by adding __func__Nayden Markatchev
magic constant to panic() calls. ok benno@ henning@ tb@
2018-07-11rtm_send() the cloned routes because of ICMP mtu changes. Until nowClaudio Jeker
these changes to the routing table have not been visible whereas the RTM_DELETE of those routes have been. Remove this inconsistency. Input and OK mpi@ OK henning@
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-07-05It was possible to leak the control mbuf in raw ip user requestAlexander Bluhm
with sendmsg(2) and MSG_OOB. Sync the code in udp, rip, and rip6_usrreq. Add an inp NULL check in rip6_usrreq for consistency. OK benno@ mpi@
2018-07-04Prevent a mbuf double free by not freeing it along the error-path inanton
rip{6,}_usrreq() since soreceive() will free it. ok bluhm@
2018-06-14Assert that the INP_IPV6 in in6_pcbconnect() is correct. Just callAlexander Bluhm
in_pcbconnect() to avoid the address family maze in syn_cache_get(). input claudio@; OK mpi@
2018-06-11Push the KERNEL_LOCK() inside route_input().Martin Pieuchot
ok visa@, tb@
2018-06-07The global zero addresses must not change, mark them constant.Alexander Bluhm
OK tb@ visa@
2018-06-03Use variable names for rtable and rdomain consistently in the in_pcbAlexander Bluhm
functions. discussed with and OK mpi@ visa@
2018-06-03Consistently call the inpcb table parameter "table" in in6_pcbnotify().Alexander Bluhm
OK visa@ mpi@
2018-06-02Move the declarations of the raw ip and ip6 pcb tables into theAlexander Bluhm
in_pcb.h header file. OK mpi@ visa@
2018-05-21All places that call carp_lsdrop() use the interface pointer already.Alexander Bluhm
It does not make sense to call if_get() again, just pass ifp as parameter. Move the IFT_CARP check into the function instead of doing it everywhere. Replace the inverted match variable logic with simple returns. OK mpi@ friehm@
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
2018-03-27Use memcpy instead of bcopy when the memory does not overlap.David Hill
OK deraadt@ florian@
2018-03-21In ip6_output() check that the interface of a route is valid. ForAlexander Bluhm
IPv4 we do the same and there are races that triggers it. Increment the statistics counter for both. from markus@; OK mpi@
2018-03-16Consistently spell "IPsec" in comments and debug outputs.Martin Pieuchot
From Raf Czlonka, ok sthen@
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-19Remove almost unused `flags' argument of suser().Martin Pieuchot
The account flag `ASU' will no longer be set but that makes suser() mpsafe since it no longer mess with a per-process field. No objection from millert@, ok tedu@, bluhm@
2018-02-12Use IP6_SOIIKEY_LEN instead of hardcoded value.Martin Pieuchot
from semarie@, ok benno@
2018-02-11add an ipv6 "don't fragment" flag to mbufs for ip6_output to use.David Gwynne
if you need to send an ipv6 packet with ip6_send(), there's no DF bit in an ipv6 packet and no way to pass the ip6 options to ip6_output to tell it to not allow fragmentation. this adds an M_IPV6_DF_OUT "checksum" flag so something creating ipv6 packets a long way from ip6_output can easily tell it to not allow fragmentation. grumbling and ok claudio@
2018-02-10rework gif to be more consistent.David Gwynne
while here, give us support for mpls in gif on ipv6. this moves all the gif handling into if_gif, eg, the mpls handling is no longer in ip_etherip.c. ok claudio@
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
2018-02-07update the gre driver.David Gwynne
the main new feature is gre keys, supported by the vnetid ioctls. this also adds support for gre over ipv6, the use of hfsc, and allows tx mitigation in the future. this diff removes keepalive support, but i promised claudio@ and patrick@ i would put it back after this goes in. ok claudio@
2018-02-01The function ip6_get_prevhdr() did return a pointer into a mbuf.Alexander Bluhm
It was not guaranteed that the mbuf data was not somewhere else in the chain. So return an offset and do a proper mbuf pulldown. found by Maxime Villard; from NetBSD; with markus@; OK deraadt@
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@
2018-01-15There was an issue that dynamic path MTU discovery together withAlexander Bluhm
ARP or ND timeout could delete local routes. Put an assert into arptfree() and nd6_free() so this cannot happen again. OK mpi@
2017-12-14The pf code marks ICMP packets belonging to an TCP or UDP divertAlexander Bluhm
state as diverted. This is necessary for IP input to accept the packet as ours. But it must not be used to match the ICMP packet to a raw socket. Clear the PF_TAG_DIVERTED mbuf pf flag for the special ICMP and ICMP6 packets in icmp_input_if() and icmp6_input(). The m_tag_delete_chain() caused an inconsistent PF_TAG_DIVERTED mbuf pf flag and PACKET_TAG_PF_DIVERT mbuf tag which triggered an assert in rip_input(). Deleting all mbuf tags can have undesired side effects and is not necessary anymore since icmp_reflect() calls m_resethdr(). Do not touch the mbuf tags and adjust the mbuf pf flags for the correct behavior of rip_input() and rip6_input(). reported by Chris Eidem, James Turner, vicviq, Scott Vanderbilt OK mpi@
2017-12-04Make divert lookup similar for all socket types. If PF_TAG_DIVERTEDAlexander Bluhm
is set, pf_find_divert() cannot fail so put an assert there. Explicitly check all possible divert types, panic in the default case. For raw sockets call pf_find_divert() before of the socket loop. Divert reply should not match on TCP or UDP listen sockets. OK sashan@ visa@
2017-11-28The divert structure was using the port number to indicate thatAlexander Bluhm
divert-to or divert-reply was active. If the address was also set, it meant divert-to. Divert packet used a separate structure. This is confusing and makes it hard to add new features. It is better to have a divert type that explicitly says what is configured. Adapt the pf rule struct in kernel and pfctl, no functional change. Note that kernel and pfctl have to be updated together. OK sashan@
2017-11-28Fix mbuf leak when an interface is destroyed while forwarding IPv6Martin Pieuchot
packets. Found by Hrvoje Popovski. ok visa@, bluhm@
2017-11-27Use a single timer for all ND6 entries.Martin Pieuchot
This prevents a use-after-free reported by Hrvoje Popovski where the timeout function was already sleeping on the NET_LOCK() when ifconfig(8) removed the enry from the table. By iterating on a global list in the timeout routine we ensure that the items are still valid when we process them. This also reduce differences with ARP. ok bluhm@, visa@
2017-11-23Constify protocol tables and remove an assert now that ip_deliver() isMartin Pieuchot
mp-safe. ok bluhm@, visa@
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-21Do not assume if_get(9) returns a non NULL ifp when using a routeMartin Pieuchot
interface index. This assumption is true for the moment iff the route lookup *and* the if_get() are done under KERNEL_LOCK(). This is not the case here. Found the hardway by Hrvoje Popovski. ok florian@, visa@, bluhm@
2017-11-20Sprinkle some NET_ASSERT_LOCKED(), const and co to prepare runningMartin Pieuchot
pr_input handlers without KERNEL_LOCK(). ok visa@
2017-11-17Drop all Ethernet-in-IP support from gif(4)Jeremie Courreges-Anglas
As a result, ip_ether.c now only deals with MPLS-in-IP. The next commits will move & rename stuff to make this clear. ok visa@ mpi@
2017-11-15Remove inet6 etherip sysctl entriesJeremie Courreges-Anglas
The INET6 entries are not needed, not documented (use net.inet.etherip) and do not appear in sysctl(8) output. ok mpi@
2017-11-14Put the net lock around frag6_freef() as it sends ICMP6 errorAlexander Bluhm
messages. Splassert was triggered by regress/sys/netinet6/frag6. OK mpi@ sashan@ visa@