summaryrefslogtreecommitdiff
path: root/sys/netinet6/icmp6.c
AgeCommit message (Collapse)Author
2017-05-08Fix a possible NULL pointer deference on icmp6 echo reply caught byRafael Zalamena
clang. with tweak from and ok bluhm@
2017-05-08Remove icmp6_reflect() micro optimization to simplify code and avoid aRafael Zalamena
M_LOOP flag dance in ip6_output(). ok bluhm@, mpi@
2017-05-04If m is not a continuous mbuf cluster, m_pullup() in pr_input mayAlexander Bluhm
change the pointer. Then *mp keeps the invalid pointer and it might be used. Fix the potential use after free and also reset *mp in other places to have less dangling pointers to freed mbufs. OK mpi@ mikeb@
2017-04-19icmp6_rip6_input() was mostly duplicated code from rip6_input().Alexander Bluhm
Merge these functions together and remove icmp6_rip6_input(). OK mpi@
2017-04-19Use the rt_rmx defines that hide the struct rt_kmetrics indirection.Alexander Bluhm
No binary change. OK mpi@
2017-04-14Pass down the address family through the pr_input calls. ThisAlexander Bluhm
allows to simplify code used for both IPv4 and IPv6. OK mikeb@ deraadt@
2017-04-05When building counter memory in preparation to copy to userland, alwaysTheo de Raadt
zero the buffers first. All the current objects appear to be safe, however future changes might introduce structure pads. Discussed with guenther, ok bluhm
2017-03-03Replace a panic with a compile time assert in icmp6_reflect().Alexander Bluhm
OK mpi@
2017-03-02Use the routing table rather than the global list of IPv6 address.Martin Pieuchot
ok bluhm@
2017-02-09Dedup calls to icmp6stat_inc in icmp6_errcount, should save a few bytesJeremie Courreges-Anglas
ok bluhm@
2017-02-09percpu counters for raw ipv6 and icmp6 statsJeremie Courreges-Anglas
ok mpi@
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@
2017-02-01In sogetopt, preallocate an mbuf to avoid using sleeping mallocs withDavid Hill
the netlock held. This also changes the prototypes of the *ctloutput functions to take an mbuf instead of an mbuf pointer. help, guidance from bluhm@ and mpi@ ok bluhm@
2017-01-19RFC 8021 "IPv6 Atomic Fragments Considered Harmful" deprecatesAlexander Bluhm
generating atomic fragments. So remove the code that sends them. CVE-2016-10142 has been assigned to that issue. OK visa@ mpi@
2017-01-18Use LIST_FOREACH to traverse icmp6_mtudisc_callbacks. Fix whitespaces.Alexander Bluhm
No functional change.
2016-12-19Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsMartin Pieuchot
of the network stack that are not yet ready to be executed in parallel or where new sleeping points are not possible. This first pass replace all the entry points leading to ip_output(). This is done to not introduce new sleeping points when trying to acquire ART's write lock, needed when a new L2 entry is created via the RT_RESOLVE. Inputs from and ok bluhm@, ok dlg@
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-11-16Bring icmp6_mtudisc_clone() in line with icmp_mtudisc_clone(). TheAlexander Bluhm
IPv4 dynamic route inherits the priority. Only clone from a valid IPv6 route. Do not use splsoftnet() in IPv6. Some stylistic changes to make the functions similar. OK mpi@
2016-11-16Inherit route label when creating dynamic routes for path MTU.Alexander Bluhm
From Rivo Nurges; OK claudio@ mpi@ phessler@
2016-11-09Do not call splsoftnet() recursively, this won't work with a lock.Martin Pieuchot
Timers configured via rt_timer_add(9) always run at IPL_SOFTNET, so assert that rather than calling splsoftnet(). ok bluhm@
2016-08-24Use rtalloc(9) directly instead of in6_selectsr() in icmp6_reflect().Martin Pieuchot
This is another little step towards deprecating 'struct route{,_in6}'. ok bluhm@
2016-08-04Commit in6_selectsrc() split again, with missing assignment fixed.Vincent Gross
2016-07-22Revert in_selectsrc() refactoring, it breaks IPv6.Martin Pieuchot
Reported by Heiko on bugs@. ok stsp@, claudio@
2016-07-20Split in6_selectsrc() into a low-level part and a pcb-level part, andVincent Gross
convert in_selectsrc() prototype to match. Ok bluhm@ mpi@.
2016-07-05Expand IN6_IFF_NOTREADY, ok bluhm@Martin Pieuchot
2016-03-29remove dead stores and unused variablesCharles Longeau
ok bluhm@ jca@
2016-01-21add a missing if_put() in a carp specific pathJonathan Gray
ok mpi@
2015-12-09Always pass a valid interface pointer to rtdeletemsg().Martin Pieuchot
This will allows for stricter checks inside rtdeletemsg() and it should be up to the caller to decide if the route needs to be deleted or not. ok vgross@
2015-12-03ip_send()/ip6_send() allow PF to send response packet in ipsoftnet task.Alexandr Nedvedicky
this avoids current recursion to pf_test() function. the change also switches icmp_error()/icmp6_error() to use ip_send()/ip6_send() so they are safe for PF. The idea comes from Markus Friedl. bluhm, mikeb and mpi helped me a lot to get it into shape. OK bluhm@, mpi@
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-12-02Kill the RT_REPORT flag to rtalloc() and stop sending RTM_MISS messagesClaudio Jeker
for failed route lookups. This is something that was maybe useful in the 90is but in this modern times it is just annoying and nothing expect it anyway. OK mpi@, sthen@
2015-12-01Kill redundant or unused arguments in rtredirect().Martin Pieuchot
ok bluhm@
2015-11-21Use if_get() rather than dereferencing rt_ifp directly.Martin Pieuchot
ok sthen@, visa@, sashan@, florian@
2015-11-03Remove dead assignments.Charles Longeau
Found by LLVM/Clang Static Analyzer. ok bluhm@ mpi@
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-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-10-19Stop checking for RTF_UP directly, call rtisvalid(9) instead.Martin Pieuchot
While here add two missing ``rtableid'' checks in in6_selectsrc(). ok bluhm@
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-11Bad whatever, that if_put() should not be there. Found the hard way by deraadt@Claudio Jeker
OK mpi@
2015-09-11if_put after if_get when IP6_EXTHDR_GET fails in icmp6_input.David Gwynne
claudio missed this one cos he was drunk while he was supposed to be fixing this file. ok claudio@ mpi@
2015-09-11When pf modifies a TCP packet, it sets the M_TCP_CSUM_OUT flag inAlexander Bluhm
the mbuf packet header. If the packet and is later dropped in ip6_forward(), the TCP mbuf is copied and passed to icmp6_error(). IPv6 uses m_copym() and M_PREPEND() which preserve the packet header. The inherited M_TCP_CSUM_OUT flag generates ICMP6 packets with an incorrect checksum. So reset the csum_flags when packets are generated by icmp6_reflect() or icmp6_redirect_output(). IPv4 does m_copydata() into a fresh mbuf. There m_inithdr() clears the packet header, so the problem does not occur. But setting the csum_flags explicitly also makes sense for icmp_send(). Do not or M_ICMP_CSUM_OUT to a value that is 0 because of some function calls before. OK mpi@ lteo@
2015-09-11if_put for icmp6. Again we cheat a bit with the hop limit to simplify the code.Claudio Jeker
OK mpi@
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-11in6_embedscope() needs to lose some weight. Remove the last argument.Claudio Jeker
In all but two calls NULL is passed and in the other 2 cases the ifp is only used to maybe feed it to in6_selecthlim() to select the hoplimit for the link. Since in6_embedscope() only works on link-local addresses it does not matter what hop limit we select since the destination is directly reachable. OK florian@ mpi@
2015-09-10It is time to put inet6 on a diet. Use the flensing knife and cut outClaudio Jeker
the 3rd argument of in6_recoverscope() and make it return void. OK dlg@ mikeb@
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-07-28Implement pf divert-reply for raw sockets. Note that an emptyAlexander Bluhm
divert->addr means that the rule has a divert-reply option. With divert-to the divert->addr is always set. The divert-reply rules should compare the original packet with the socket addresses. So skip the step that compares the inp->inp_laddr with the empty divert->addr. OK mikeb@
2015-07-15m_freem() can handle NULL, do not check for this condition beforehands.Theo de Raadt
ok stsp mpi
2015-07-08Pass an interface index instead of a pointer to in6_addr2scopeid().Martin Pieuchot
ok millert@