summaryrefslogtreecommitdiff
path: root/sys/netinet6/icmp6.c
AgeCommit message (Collapse)Author
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-11-03We are processing Router Solicitation / Advertisement messages onlyFlorian Obser
for the Source Link-layer Address Options. Merge nd6_rs_input() and nd6_ra_input() into one generic function that does just that. input & OK mpi
2017-10-18When reusing an mbuf at the upper end of the network stack, stripAlexander Bluhm
off the mbuf properties with m_resethdr(). It is a new packet, especially M_LOOP indicating that it was running through lo(4) should be cleared. Use the ph_loopcnt to prevent looping at the upper end of the stack. Although not strictly necessary in icmp reflect, it is a good idea to increase and check the counter here, like in socket splicing. OK mpi@ sashan@
2017-10-18Setting the IPV6_MINMTU flag in the call to ip6_output() was movedAlexander Bluhm
from icmp6_reflect() to ip6_send_dispatch() when ip6_send() was introduced. Move the comment that explains this flag also to the place where it is used. from sashan@
2017-10-09Reduces the scope of the NET_LOCK() in sysctl(2) path.Martin Pieuchot
Exposes per-CPU counters to real parrallelism. ok visa@, bluhm@, jca@
2017-09-01Change sosetopt() to no longer free the mbuf it receives and changeMartin Pieuchot
all the callers to call m_freem(9). Support from deraadt@ and tedu@, ok visa@, bluhm@
2017-08-10icmp_mtudisc() might be called by TCP even on loopback after aAlexander Bluhm
retransmit timeout. Do not run path MTU discovery on local routes as we never want that on loopback. For permanent ARP or ND entries disable path MTU discovery as they use the same rt_expire field. This prevents that permanent routes and entries disappear. bug analysis friehm@; OK mpi@
2017-08-03RFC 1885 was obsoleted nearly 20 years ago by RFC 2463 which was obsoletedFlorian Obser
over 10 years ago by RFC 4443. We are probably not going back. OK deraadt, jca
2017-07-12Get rid of ICMPV6CTL_ND6_DRLIST and ICMPV6CTL_ND6_PRLIST sysctlsFlorian Obser
With this we can also get rid of in6_prefix and in6_defrouter. They are meaningless, the kernel no longer tracks this information. Pointed out by & OK mpi
2017-06-26When pinging an IPv6 link-local address, the reflected packet hadAlexander Bluhm
::1 as source address. It should be the link-local address of the attached interface. The rtalloc() in icmp6_reflect() did not find the correct local address. The IPv6 routing table does not use sin6_scope_id, but the embedded scope. So do not recover the scope. bug report Harald Dunkel; OK mpi@
2017-05-30Carp balancing ip does not work since there is a mac filter infriehm
ether_input(). Now we use mbuf tags instead of modifying the MAC address. ok mpi@
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@