summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/icmp6.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* rework icmp6_error() to be closer to icmp_error()denis2018-12-251-39/+56
| | | | input & OK mpi@
* When forwarding IPv6 packets, generated ICMP6 packets used thebluhm2018-12-101-2/+8
| | | | | | | | interface address of the route as source address. To avoid using link-local addresses in ICMP6 packets sent into networks where they are out of scope, use the regular IPv6 source selection algorithm also in this icmp6_reflect() case. reported by sthen@; fix from Arnaud BRAND; OK claudio@
* M_LEADINGSPACE() and M_TRAILINGSPACE() are just wrappers forclaudio2018-11-091-2/+2
| | | | | | m_leadingspace() and m_trailingspace(). Convert all callers to call directly the functions and remove the defines. OK krw@, mpi@
* factor error code in icmp6_mtudisc_clone(); ok kn@ florian@miko2018-09-051-17/+12
|
* rtm_send() the cloned routes because of ICMP mtu changes. Until nowclaudio2018-07-111-1/+2
| | | | | | | 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@
* Move the declarations of the raw ip and ip6 pcb tables into thebluhm2018-06-021-2/+1
| | | | | in_pcb.h header file. OK mpi@ visa@
* All places that call carp_lsdrop() use the interface pointer already.bluhm2018-05-211-4/+3
| | | | | | | | 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@
* Use memcpy instead of bcopy when the memory does not overlap.dhill2018-03-271-7/+7
| | | | OK deraadt@ florian@
* The pf code marks ICMP packets belonging to an TCP or UDP divertbluhm2017-12-141-1/+6
| | | | | | | | | | | | | | | | | 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@
* We are processing Router Solicitation / Advertisement messages onlyflorian2017-11-031-18/+9
| | | | | | | | 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
* When reusing an mbuf at the upper end of the network stack, stripbluhm2017-10-181-7/+10
| | | | | | | | | | 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@
* Setting the IPV6_MINMTU flag in the call to ip6_output() was movedbluhm2017-10-181-7/+1
| | | | | | | 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@
* Reduces the scope of the NET_LOCK() in sysctl(2) path.mpi2017-10-091-4/+10
| | | | | | Exposes per-CPU counters to real parrallelism. ok visa@, bluhm@, jca@
* Change sosetopt() to no longer free the mbuf it receives and changempi2017-09-011-6/+2
| | | | | | all the callers to call m_freem(9). Support from deraadt@ and tedu@, ok visa@, bluhm@
* icmp_mtudisc() might be called by TCP even on loopback after abluhm2017-08-101-1/+11
| | | | | | | | 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@
* RFC 1885 was obsoleted nearly 20 years ago by RFC 2463 which was obsoletedflorian2017-08-031-16/+1
| | | | | over 10 years ago by RFC 4443. We are probably not going back. OK deraadt, jca
* Get rid of ICMPV6CTL_ND6_DRLIST and ICMPV6CTL_ND6_PRLIST sysctlsflorian2017-07-121-4/+1
| | | | | | | 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
* When pinging an IPv6 link-local address, the reflected packet hadbluhm2017-06-261-5/+1
| | | | | | | | ::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@
* Carp balancing ip does not work since there is a mac filter infriehm2017-05-301-2/+2
| | | | | | | ether_input(). Now we use mbuf tags instead of modifying the MAC address. ok mpi@
* Fix a possible NULL pointer deference on icmp6 echo reply caught byrzalamena2017-05-081-3/+3
| | | | | | clang. with tweak from and ok bluhm@
* Remove icmp6_reflect() micro optimization to simplify code and avoid arzalamena2017-05-081-17/+8
| | | | | | M_LOOP flag dance in ip6_output(). ok bluhm@, mpi@
* If m is not a continuous mbuf cluster, m_pullup() in pr_input maybluhm2017-05-041-3/+3
| | | | | | | 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@
* icmp6_rip6_input() was mostly duplicated code from rip6_input().bluhm2017-04-191-103/+2
| | | | | Merge these functions together and remove icmp6_rip6_input(). OK mpi@
* Use the rt_rmx defines that hide the struct rt_kmetrics indirection.bluhm2017-04-191-6/+6
| | | | | No binary change. OK mpi@
* Pass down the address family through the pr_input calls. Thisbluhm2017-04-141-2/+2
| | | | | allows to simplify code used for both IPv4 and IPv6. OK mikeb@ deraadt@
* When building counter memory in preparation to copy to userland, alwaysderaadt2017-04-051-2/+2
| | | | | | zero the buffers first. All the current objects appear to be safe, however future changes might introduce structure pads. Discussed with guenther, ok bluhm
* Replace a panic with a compile time assert in icmp6_reflect().bluhm2017-03-031-5/+3
| | | | OK mpi@
* Use the routing table rather than the global list of IPv6 address.mpi2017-03-021-13/+15
| | | | ok bluhm@
* Dedup calls to icmp6stat_inc in icmp6_errcount, should save a few bytesjca2017-02-091-26/+29
| | | | ok bluhm@
* percpu counters for raw ipv6 and icmp6 statsjca2017-02-091-45/+61
| | | | ok mpi@
* Use percpu counters for ip6statjca2017-02-051-2/+7
| | | | | | | | | 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@
* In sogetopt, preallocate an mbuf to avoid using sleeping mallocs withdhill2017-02-011-4/+2
| | | | | | | | 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@
* RFC 8021 "IPv6 Atomic Fragments Considered Harmful" deprecatesbluhm2017-01-191-6/+2
| | | | | | generating atomic fragments. So remove the code that sends them. CVE-2016-10142 has been assigned to that issue. OK visa@ mpi@
* Use LIST_FOREACH to traverse icmp6_mtudisc_callbacks. Fix whitespaces.bluhm2017-01-181-7/+5
| | | | No functional change.
* Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsmpi2016-12-191-3/+3
| | | | | | | | | | | 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@
* Explicitly initialize rti_ifa when automagically adding a route.mpi2016-11-281-1/+2
| | | | | | This will allow to strengthen checks when userland adds a route. ok phessler@, bluhm@
* Bring icmp6_mtudisc_clone() in line with icmp_mtudisc_clone(). Thebluhm2016-11-161-14/+15
| | | | | | | 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@
* Inherit route label when creating dynamic routes for path MTU.bluhm2016-11-161-3/+6
| | | | From Rivo Nurges; OK claudio@ mpi@ phessler@
* Do not call splsoftnet() recursively, this won't work with a lock.mpi2016-11-091-7/+5
| | | | | | | Timers configured via rt_timer_add(9) always run at IPL_SOFTNET, so assert that rather than calling splsoftnet(). ok bluhm@
* Use rtalloc(9) directly instead of in6_selectsr() in icmp6_reflect().mpi2016-08-241-15/+12
| | | | | | This is another little step towards deprecating 'struct route{,_in6}'. ok bluhm@
* Commit in6_selectsrc() split again, with missing assignment fixed.vgross2016-08-041-2/+2
|
* Revert in_selectsrc() refactoring, it breaks IPv6.mpi2016-07-221-2/+2
| | | | | | Reported by Heiko on bugs@. ok stsp@, claudio@
* Split in6_selectsrc() into a low-level part and a pcb-level part, andvgross2016-07-201-2/+2
| | | | | | convert in_selectsrc() prototype to match. Ok bluhm@ mpi@.
* Expand IN6_IFF_NOTREADY, ok bluhm@mpi2016-07-051-8/+8
|
* remove dead stores and unused variableschl2016-03-291-6/+1
| | | | ok bluhm@ jca@
* add a missing if_put() in a carp specific pathjsg2016-01-211-2/+4
| | | | ok mpi@
* Always pass a valid interface pointer to rtdeletemsg().mpi2015-12-091-13/+21
| | | | | | | 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@
* ip_send()/ip6_send() allow PF to send response packet in ipsoftnet task.sashan2015-12-031-2/+2
| | | | | | | | | | | 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@
* When destroying an interface, we have to wait until all referencesbluhm2015-12-021-3/+3
| | | | | | | | | 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@
* Kill the RT_REPORT flag to rtalloc() and stop sending RTM_MISS messagesclaudio2015-12-021-2/+2
| | | | | | 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@