Deleted Added
sdiff udiff text old ( 191340 ) new ( 191672 )
full compact
1/*-
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 47 unchanged lines hidden (view full) ---

56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)ip_icmp.c 8.2 (Berkeley) 1/4/94
61 */
62
63#include <sys/cdefs.h>
64__FBSDID("$FreeBSD: head/sys/netinet6/icmp6.c 191340 2009-04-20 22:45:21Z rwatson $");
65
66#include "opt_inet.h"
67#include "opt_inet6.h"
68#include "opt_ipsec.h"
69#include "opt_route.h"
70
71#include <sys/param.h>
72#include <sys/domain.h>

--- 69 unchanged lines hidden (view full) ---

142
143
144void
145icmp6_init(void)
146{
147 INIT_VNET_INET6(curvnet);
148
149 V_icmp6errpps_count = 0;
150
151 mld6_init();
152}
153
154static void
155icmp6_errcount(struct icmp6errstat *stat, int type, int code)
156{
157 switch (type) {
158 case ICMP6_DST_UNREACH:
159 switch (code) {

--- 264 unchanged lines hidden (view full) ---

424
425 ip6 = mtod(m, struct ip6_hdr *);
426 if (icmp6len < sizeof(struct icmp6_hdr)) {
427 ICMP6STAT_INC(icp6s_tooshort);
428 goto freeit;
429 }
430
431 /*
432 * calculate the checksum
433 */
434#ifndef PULLDOWN_TEST
435 icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off);
436#else
437 IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6));
438 if (icmp6 == NULL) {
439 ICMP6STAT_INC(icp6s_tooshort);

--- 170 unchanged lines hidden (view full) ---

610 case ICMP6_ECHO_REPLY:
611 icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_echoreply);
612 if (code != 0)
613 goto badcode;
614 break;
615
616 case MLD_LISTENER_QUERY:
617 case MLD_LISTENER_REPORT:
618 if (icmp6len < sizeof(struct mld_hdr))
619 goto badlen;
620 if (icmp6->icmp6_type == MLD_LISTENER_QUERY) /* XXX: ugly... */
621 icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldquery);
622 else
623 icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mldreport);
624 if ((n = m_copym(m, 0, M_COPYALL, M_DONTWAIT)) == NULL) {
625 /* give up local */
626 mld6_input(m, off);
627 m = NULL;
628 goto freeit;
629 }
630 mld6_input(n, off);
631 /* m stays. */
632 break;
633
634 case MLD_LISTENER_DONE:
635 icmp6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_mlddone);
636 if (icmp6len < sizeof(struct mld_hdr)) /* necessary? */
637 goto badlen;
638 break; /* nothing to be done in kernel */
639
640 case MLD_MTRACE_RESP:
641 case MLD_MTRACE:
642 /* XXX: these two are experimental. not officially defined. */
643 /* XXX: per-interface statistics? */
644 break; /* just pass it to applications */
645
646 case ICMP6_WRUREQUEST: /* ICMP6_FQDN_QUERY */
647 {
648 enum { WRU, FQDN } mode;
649
650 if (!V_icmp6_nodeinfo)
651 break;
652
653 if (icmp6len == sizeof(struct icmp6_hdr) + 4)

--- 1391 unchanged lines hidden (view full) ---

2045 if (opts)
2046 m_freem(opts);
2047 SOCKBUF_UNLOCK(&last->inp_socket->so_rcv);
2048 } else
2049 sorwakeup_locked(last->inp_socket);
2050 INP_RUNLOCK(last);
2051 } else {
2052 m_freem(m);
2053 V_ip6stat.ip6s_delivered--;
2054 }
2055 return IPPROTO_DONE;
2056}
2057
2058/*
2059 * Reflect the ip6 packet back to the source.
2060 * OFF points to the icmp6 header, counted from the top of the mbuf.
2061 */

--- 155 unchanged lines hidden (view full) ---

2217 m_freem(m);
2218 return;
2219}
2220
2221void
2222icmp6_fasttimo(void)
2223{
2224
2225 return;
2226}
2227
2228static const char *
2229icmp6_redirect_diag(struct in6_addr *src6, struct in6_addr *dst6,
2230 struct in6_addr *tgt6)
2231{
2232 static char buf[1024];
2233 char ip6bufs[INET6_ADDRSTRLEN];
2234 char ip6bufd[INET6_ADDRSTRLEN];
2235 char ip6buft[INET6_ADDRSTRLEN];

--- 599 unchanged lines hidden ---