77#include <sys/malloc.h>
80#include <sys/domain.h>
81#include <sys/protosw.h>
83#include <sys/socket.h>
84#include <sys/socketvar.h>
87#include <sys/kernel.h>
89#include <sys/rmlock.h>
90#include <sys/syslog.h>
91#include <sys/sysctl.h>
94#include <net/if_var.h>
95#include <net/if_types.h>
98#include <net/netisr.h>
99#include <net/rss_config.h>
103#include <netinet/in.h>
104#include <netinet/in_kdtrace.h>
105#include <netinet/ip_var.h>
106#include <netinet/in_systm.h>
107#include <net/if_llatbl.h>
109#include <netinet/ip.h>
110#include <netinet/ip_icmp.h>
112#include <netinet/ip6.h>
115#include <netinet/in_pcb.h>
116#include <netinet/icmp6.h>
123#include <netipsec/ipsec_support.h>
137 .nh_proto = NETISR_IPV6,
140 .nh_policy = NETISR_POLICY_CPU,
141 .nh_dispatch = NETISR_DISPATCH_HYBRID,
143 .nh_policy = NETISR_POLICY_FLOW,
152 netisr_getqlimit(&
ip6_nh, &qlimit);
153 error = sysctl_handle_int(oidp, &qlimit, 0, req);
154 if (error || !req->newptr)
158 return (netisr_setqlimit(&
ip6_nh, qlimit));
161SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_INTRQMAXLEN, intr_queue_maxlen,
162 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
164 "Maximum size of the IPv6 input queue");
167#define V_ip6_sav VNET(ip6_sav)
169 CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_sav),
true,
170 "Drop incoming packets with source address that is a local address");
173static struct netisr_handler ip6_direct_nh = {
174 .nh_name =
"ip6_direct",
176 .nh_proto = NETISR_IPV6_DIRECT,
178 .nh_policy = NETISR_POLICY_CPU,
179 .nh_dispatch = NETISR_DISPATCH_HYBRID,
183sysctl_netinet6_intr_direct_queue_maxlen(SYSCTL_HANDLER_ARGS)
187 netisr_getqlimit(&ip6_direct_nh, &qlimit);
188 error = sysctl_handle_int(oidp, &qlimit, 0, req);
189 if (error || !req->newptr)
193 return (netisr_setqlimit(&ip6_direct_nh, qlimit));
195SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_INTRDQMAXLEN, intr_direct_queue_maxlen,
196 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
197 0, 0, sysctl_netinet6_intr_direct_queue_maxlen,
"I",
198 "Maximum size of the IPv6 direct input queue");
207VNET_PCPUSTAT_SYSUNINIT(
ip6stat);
222 struct pfil_head_args args;
224 TUNABLE_INT_FETCH(
"net.inet6.ip6.auto_linklocal",
234 args.pa_version = PFIL_VERSION;
235 args.pa_flags = PFIL_IN | PFIL_OUT;
236 args.pa_type = PFIL_TYPE_IP6;
240 if (hhook_head_register(HHOOK_TYPE_IPSEC_IN, AF_INET6,
241 &V_ipsec_hhh_in[HHOOK_IPSEC_INET6],
242 HHOOK_WAITOK | HHOOK_HEADISINVNET) != 0)
243 printf(
"%s: WARNING: unable to register input helper hook\n",
245 if (hhook_head_register(HHOOK_TYPE_IPSEC_OUT, AF_INET6,
246 &V_ipsec_hhh_out[HHOOK_IPSEC_INET6],
247 HHOOK_WAITOK | HHOOK_HEADISINVNET) != 0)
248 printf(
"%s: WARNING: unable to register output helper hook\n",
260 netisr_register_vnet(&
ip6_nh);
262 netisr_register_vnet(&ip6_direct_nh);
274 pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
275 KASSERT(pr, (
"%s: PF_INET6 not found", __func__));
278 for (
int i = 0; i < IPPROTO_MAX; i++)
286 if (pr->pr_domain->dom_family == PF_INET6 &&
287 pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW) {
289 if (pr->pr_protocol < IPPROTO_MAX)
295 netisr_register(&ip6_direct_nh);
310 if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX)
311 return (EPROTONOSUPPORT);
317 pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
319 return (EPFNOSUPPORT);
328 if (pr->pr_domain->dom_family == PF_INET6 &&
329 pr->pr_protocol && pr->pr_protocol == ip6proto) {
334 return (EPROTONOSUPPORT);
343 if (ip6proto <= 0 || ip6proto >= IPPROTO_MAX)
344 return (EPROTONOSUPPORT);
347 pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
349 return (EPFNOSUPPORT);
360ip6_destroy(
void *unused __unused)
362 struct ifaddr *ifa, *nifa;
367 netisr_unregister_vnet(&ip6_direct_nh);
369 netisr_unregister_vnet(&
ip6_nh);
372 error = hhook_head_deregister(V_ipsec_hhh_in[HHOOK_IPSEC_INET6]);
374 printf(
"%s: WARNING: unable to deregister input helper hook "
375 "type HHOOK_TYPE_IPSEC_IN, id HHOOK_IPSEC_INET6: "
376 "error %d returned\n", __func__, error);
378 error = hhook_head_deregister(V_ipsec_hhh_out[HHOOK_IPSEC_INET6]);
380 printf(
"%s: WARNING: unable to deregister output helper hook "
381 "type HHOOK_TYPE_IPSEC_OUT, id HHOOK_IPSEC_INET6: "
382 "error %d returned\n", __func__, error);
387 CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) {
390 CK_STAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) {
391 if (ifa->ifa_addr->sa_family != AF_INET6)
402 rib_flush_routes_family(AF_INET6);
411VNET_SYSUNINIT(inet6, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, ip6_destroy, NULL);
431 ip6 = mtod(m,
struct ip6_hdr *);
438 if (ip6->ip6_plen == 0 && *plen == 0) {
448 ICMP6_PARAMPROB_HEADER,
449 (caddr_t)&ip6->ip6_plen - (caddr_t)ip6);
453 hbh = (
struct ip6_hbh *)(ip6 + 1);
454 *nxt = hbh->ip6h_nxt;
463 if (*rtalert != ~0) {
465 case IP6OPT_RTALERT_MLD:
500 KASSERT(mtag != NULL, (
"Reinjected packet w/o direct ctx tag!"));
508 m_tag_delete(m, mtag);
510 while (nxt != IPPROTO_DONE) {
520 if (m->m_pkthdr.len < off) {
526#if defined(IPSEC) || defined(IPSEC_SUPPORT)
527 if (IPSEC_ENABLED(ipv6)) {
528 if (IPSEC_INPUT(ipv6, m, off, nxt) != 0)
549 u_int32_t rtalert = ~0;
550 int off =
sizeof(
struct ip6_hdr), nest;
557 rcvif = m->m_pkthdr.rcvif;
561#if defined(IPSEC) || defined(IPSEC_SUPPORT)
568 m->m_flags &= ~M_AUTHIPHDR;
569 m->m_flags &= ~M_AUTHIPDGM;
577 ip6 = mtod(m,
struct ip6_hdr *);
584 if (m->m_flags & M_EXT) {
591 if (m->m_flags &
M_LOOP) {
609 if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) {
612 if (m->m_pkthdr.len > MHLEN)
613 n = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
615 n = m_gethdr(M_NOWAIT, MT_DATA);
620 m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t));
621 n->m_len = n->m_pkthdr.len;
625 if (m->m_len <
sizeof(
struct ip6_hdr)) {
626 if ((m = m_pullup(m,
sizeof(
struct ip6_hdr))) == NULL) {
633 ip6 = mtod(m,
struct ip6_hdr *);
634 if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
641 IP_PROBE(receive, NULL, NULL, ip6, rcvif, NULL, ip6);
680 if (altq_input != NULL && (*altq_input)(m, AF_INET6) == 0) {
728#
if defined(IPSEC) || defined(IPSEC_SUPPORT)
729 && (!IPSEC_ENABLED(ipv6) ||
730 IPSEC_CAPS(ipv6, m, IPSEC_CAP_OPERABLE) == 0)
736 ip6 = mtod(m,
struct ip6_hdr *);
740#if defined(IPSEC) || defined(IPSEC_SUPPORT)
744 if (IPSEC_ENABLED(ipv6) &&
745 IPSEC_CAPS(ipv6, m, IPSEC_CAP_BYPASS_FILTER) != 0)
764 ip6 = mtod(m,
struct ip6_hdr *);
767 m_tag_find(m, PACKET_TAG_IPFORWARD, NULL) != NULL) {
798 m->m_flags &= ~M_FASTFWD_OURS;
823 "ip6_input: packet to an unready address %s->%s\n",
828 if (
V_ip6_sav && !(rcvif->if_flags & IFF_LOOPBACK) &&
835 counter_u64_add(ia->
ia_ifa.ifa_ipackets, 1);
836 counter_u64_add(ia->
ia_ifa.ifa_ibytes, m->m_pkthdr.len);
856 plen = (u_int32_t)ntohs(ip6->ip6_plen);
857 if (ip6->ip6_nxt == IPPROTO_HOPOPTS) {
858 if (
ip6_input_hbh(&m, &plen, &rtalert, &off, &nxt, &ours) != 0)
876 if (m->m_pkthdr.len -
sizeof(
struct ip6_hdr) < plen) {
881 if (m->m_pkthdr.len >
sizeof(
struct ip6_hdr) + plen) {
882 if (m->m_len == m->m_pkthdr.len) {
883 m->m_len =
sizeof(
struct ip6_hdr) + plen;
884 m->m_pkthdr.len =
sizeof(
struct ip6_hdr) + plen;
886 m_adj(m,
sizeof(
struct ip6_hdr) + plen - m->m_pkthdr.len);
921 while (nxt != IPPROTO_DONE) {
931 if (m->m_pkthdr.len < off) {
937#if defined(IPSEC) || defined(IPSEC_SUPPORT)
938 if (IPSEC_ENABLED(ipv6)) {
939 if (IPSEC_INPUT(ipv6, m, off, nxt) != 0)
961 struct mbuf **mp,
int *offp)
963 struct mbuf *m = *mp;
964 int off = *offp, hbhlen;
968 if (m->m_len < off +
sizeof(*hbh)) {
969 m = m_pullup(m, off +
sizeof(*hbh));
976 hbh = (
struct ip6_hbh *)(mtod(m, caddr_t) + off);
977 hbhlen = (hbh->ip6h_len + 1) << 3;
979 if (m->m_len < off + hbhlen) {
980 m = m_pullup(m, off + hbhlen);
987 hbh = (
struct ip6_hbh *)(mtod(m, caddr_t) + off);
989 hbhlen -=
sizeof(
struct ip6_hbh);
991 hbhlen, rtalertp, plenp) < 0) {
1013 u_int32_t *rtalertp, u_int32_t *plenp)
1015 struct ip6_hdr *ip6;
1017 u_int8_t *opt = opthead;
1018 u_int16_t rtalert_val;
1019 u_int32_t jumboplen;
1020 const int erroff =
sizeof(
struct ip6_hdr) + sizeof(struct ip6_hbh);
1022 for (; hbhlen > 0; hbhlen -= optlen, opt += optlen) {
1028 if (hbhlen < IP6OPT_MINLEN) {
1032 optlen = *(opt + 1) + 2;
1034 case IP6OPT_ROUTER_ALERT:
1036 if (hbhlen < IP6OPT_RTALERT_LEN) {
1040 if (*(opt + 1) != IP6OPT_RTALERT_LEN - 2) {
1043 ICMP6_PARAMPROB_HEADER,
1044 erroff + opt + 1 - opthead);
1047 optlen = IP6OPT_RTALERT_LEN;
1048 bcopy((caddr_t)(opt + 2), (caddr_t)&rtalert_val, 2);
1049 *rtalertp = ntohs(rtalert_val);
1053 if (hbhlen < IP6OPT_JUMBO_LEN) {
1057 if (*(opt + 1) != IP6OPT_JUMBO_LEN - 2) {
1060 ICMP6_PARAMPROB_HEADER,
1061 erroff + opt + 1 - opthead);
1064 optlen = IP6OPT_JUMBO_LEN;
1070 ip6 = mtod(m,
struct ip6_hdr *);
1071 if (ip6->ip6_plen) {
1074 ICMP6_PARAMPROB_HEADER,
1075 erroff + opt - opthead);
1083 bcopy(opt + 2, &jumboplen,
sizeof(jumboplen));
1084 jumboplen = (u_int32_t)htonl(jumboplen);
1098 ICMP6_PARAMPROB_HEADER,
1099 erroff + opt + 2 - opthead);
1107 if (jumboplen <= IPV6_MAXPACKET) {
1110 ICMP6_PARAMPROB_HEADER,
1111 erroff + opt + 2 - opthead);
1118 if (hbhlen < IP6OPT_MINLEN) {
1123 erroff + opt - opthead);
1147 struct ip6_hdr *ip6;
1149 switch (IP6OPT_TYPE(*optp)) {
1150 case IP6OPT_TYPE_SKIP:
1151 return ((
int)*(optp + 1));
1152 case IP6OPT_TYPE_DISCARD:
1155 case IP6OPT_TYPE_FORCEICMP:
1157 icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_OPTION, off);
1159 case IP6OPT_TYPE_ICMP:
1161 ip6 = mtod(m,
struct ip6_hdr *);
1163 (m->m_flags & (M_BCAST|M_MCAST)))
1167 ICMP6_PARAMPROB_OPTION, off);
1193 struct ip6_hdr *ip6 = mtod(m,
struct ip6_hdr *);
1196 if ((inp->inp_socket->so_options & SO_TIMESTAMP) != 0) {
1202 struct bintime boottimebin, bt1;
1203 struct timespec ts1;
1207 switch (inp->inp_socket->so_ts_clock) {
1208 case SO_TS_REALTIME_MICRO:
1209 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1211 mbuf_tstmp2timespec(m, &ts1);
1212 timespec2bintime(&ts1, &bt1);
1213 getboottimebin(&boottimebin);
1214 bintime_add(&bt1, &boottimebin);
1215 bintime2timeval(&bt1, &t.tv);
1219 *mp = sbcreatecontrol((caddr_t) &t.tv,
sizeof(t.tv),
1220 SCM_TIMESTAMP, SOL_SOCKET);
1222 mp = &(*mp)->m_next;
1228 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1230 mbuf_tstmp2timespec(m, &ts1);
1231 timespec2bintime(&ts1, &t.bt);
1232 getboottimebin(&boottimebin);
1233 bintime_add(&t.bt, &boottimebin);
1237 *mp = sbcreatecontrol((caddr_t)&t.bt,
sizeof(t.bt),
1238 SCM_BINTIME, SOL_SOCKET);
1240 mp = &(*mp)->m_next;
1245 case SO_TS_REALTIME:
1246 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1248 mbuf_tstmp2timespec(m, &t.ts);
1249 getboottimebin(&boottimebin);
1250 bintime2timespec(&boottimebin, &ts1);
1251 timespecadd(&t.ts, &ts1, &t.ts);
1255 *mp = sbcreatecontrol((caddr_t)&t.ts,
sizeof(t.ts),
1256 SCM_REALTIME, SOL_SOCKET);
1258 mp = &(*mp)->m_next;
1263 case SO_TS_MONOTONIC:
1264 if ((m->m_flags & (M_PKTHDR | M_TSTMP)) == (M_PKTHDR |
1266 mbuf_tstmp2timespec(m, &t.ts);
1269 *mp = sbcreatecontrol((caddr_t)&t.ts,
sizeof(t.ts),
1270 SCM_MONOTONIC, SOL_SOCKET);
1272 mp = &(*mp)->m_next;
1278 panic(
"unknown (corrupted) so_ts_clock");
1280 if (stamped && (m->m_flags & (M_PKTHDR | M_TSTMP)) ==
1281 (M_PKTHDR | M_TSTMP)) {
1282 struct sock_timestamp_info sti;
1284 bzero(&sti,
sizeof(sti));
1285 sti.st_info_flags = ST_INFO_HW;
1286 if ((m->m_flags & M_TSTMP_HPREC) != 0)
1287 sti.st_info_flags |= ST_INFO_HW_HPREC;
1288 *mp = sbcreatecontrol((caddr_t)&sti,
sizeof(sti),
1289 SCM_TIME_INFO, SOL_SOCKET);
1291 mp = &(*mp)->m_next;
1296#define IS2292(inp, x, y) (((inp)->inp_flags & IN6P_RFC2292) ? (x) : (y))
1298 if ((inp->inp_flags & IN6P_PKTINFO) != 0) {
1301 if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
1305 ip = mtod(m,
struct ip *);
1309 pi6.
ipi6_addr.s6_addr32[3] = ip->ip_dst.s_addr;
1319 (m && m->m_pkthdr.rcvif) ? m->m_pkthdr.rcvif->if_index : 0;
1321 *mp = sbcreatecontrol((caddr_t) &pi6,
1325 mp = &(*mp)->m_next;
1328 if ((inp->inp_flags & IN6P_HOPLIMIT) != 0) {
1331 if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
1335 ip = mtod(m,
struct ip *);
1342 hlim = ip6->ip6_hlim & 0xff;
1344 *mp = sbcreatecontrol((caddr_t) &hlim,
sizeof(
int),
1348 mp = &(*mp)->m_next;
1351 if ((inp->inp_flags & IN6P_TCLASS) != 0) {
1354 if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
1358 ip = mtod(m,
struct ip *);
1359 tclass = ip->ip_tos;
1367 flowinfo = (u_int32_t)ntohl(ip6->ip6_flow & IPV6_FLOWINFO_MASK);
1369 tclass = flowinfo & 0xff;
1371 *mp = sbcreatecontrol((caddr_t) &tclass,
sizeof(
int),
1374 mp = &(*mp)->m_next;
1377 if (v4only != NULL) {
1378 if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
1391 struct ip6_hdr *ip6;
1398 ip6 = mtod(m,
struct ip6_hdr *);
1406 if ((inp->inp_flags & IN6P_HOPOPTS) != 0) {
1414 if (ip6->ip6_nxt == IPPROTO_HOPOPTS) {
1415 struct ip6_hbh *hbh;
1418 hbh = (
struct ip6_hbh *)(ip6 + 1);
1419 hbhlen = (hbh->ip6h_len + 1) << 3;
1428 *mp = sbcreatecontrol((caddr_t)hbh, hbhlen,
1432 mp = &(*mp)->m_next;
1436 if ((inp->inp_flags & (IN6P_RTHDR | IN6P_DSTOPTS)) != 0) {
1437 int nxt = ip6->ip6_nxt, off =
sizeof(
struct ip6_hdr);
1447 struct ip6_ext *ip6e = NULL;
1455 case IPPROTO_DSTOPTS:
1456 case IPPROTO_ROUTING:
1457 case IPPROTO_HOPOPTS:
1464 if (off +
sizeof(*ip6e) > m->m_len)
1466 ip6e = (
struct ip6_ext *)(mtod(m, caddr_t) + off);
1467 if (nxt == IPPROTO_AH)
1468 elen = (ip6e->ip6e_len + 2) << 2;
1470 elen = (ip6e->ip6e_len + 1) << 3;
1471 if (off +
elen > m->m_len)
1475 case IPPROTO_DSTOPTS:
1476 if (!(inp->inp_flags & IN6P_DSTOPTS))
1479 *mp = sbcreatecontrol((caddr_t)ip6e,
elen,
1484 mp = &(*mp)->m_next;
1486 case IPPROTO_ROUTING:
1487 if (!(inp->inp_flags & IN6P_RTHDR))
1490 *mp = sbcreatecontrol((caddr_t)ip6e,
elen,
1494 mp = &(*mp)->m_next;
1496 case IPPROTO_HOPOPTS:
1512 nxt = ip6e->ip6e_nxt;
1519 if (inp->inp_flags2 & INP_RECVFLOWID) {
1520 uint32_t flowid, flow_type;
1522 flowid = m->m_pkthdr.flowid;
1523 flow_type = M_HASHTYPE_GET(m);
1529 *mp = sbcreatecontrol((caddr_t) &flowid,
1532 mp = &(*mp)->m_next;
1533 *mp = sbcreatecontrol((caddr_t) &flow_type,
1536 mp = &(*mp)->m_next;
1540 if (inp->inp_flags2 & INP_RECVRSSBUCKETID) {
1541 uint32_t flowid, flow_type;
1542 uint32_t rss_bucketid;
1544 flowid = m->m_pkthdr.flowid;
1545 flow_type = M_HASHTYPE_GET(m);
1547 if (rss_hash2bucket(flowid, flow_type, &rss_bucketid) == 0) {
1548 *mp = sbcreatecontrol((caddr_t) &rss_bucketid,
1551 mp = &(*mp)->m_next;
1566 KASSERT(inp != NULL, (
"%s: inp == NULL", __func__));
1576 if ((inp->inp_flags & IN6P_MTU) == 0 || (
1586 if ((m_mtu = sbcreatecontrol((caddr_t)&mtuctl,
sizeof(mtuctl),
1590 so = inp->inp_socket;
1591 if (sbappendaddr(&so->so_rcv, (
struct sockaddr *)dst, NULL, m_mtu)
1607 struct ip6_ext ip6e;
1608 struct ip6_hdr *ip6;
1611 if (off ==
sizeof(
struct ip6_hdr))
1612 return (offsetof(
struct ip6_hdr, ip6_nxt));
1613 if (off <
sizeof(
struct ip6_hdr))
1614 panic(
"%s: off < sizeof(struct ip6_hdr)", __func__);
1616 ip6 = mtod(m,
struct ip6_hdr *);
1618 len =
sizeof(
struct ip6_hdr);
1621 m_copydata(m, len,
sizeof(ip6e), (caddr_t)&ip6e);
1623 case IPPROTO_FRAGMENT:
1624 nlen =
sizeof(
struct ip6_frag);
1627 nlen = (ip6e.ip6e_len + 2) << 2;
1630 nlen = (ip6e.ip6e_len + 1) << 3;
1633 nxt = ip6e.ip6e_nxt;
1635 return (len - nlen);
1645 struct ip6_ext ip6e;
1650 panic(
"ip6_nexthdr: m == NULL");
1651 if ((m->m_flags & M_PKTHDR) == 0 || m->m_pkthdr.len < off)
1656 if (m->m_pkthdr.len < off +
sizeof(ip6))
1658 m_copydata(m, off,
sizeof(ip6), (caddr_t)&ip6);
1660 *nxtp = ip6.ip6_nxt;
1664 case IPPROTO_FRAGMENT:
1669 if (m->m_pkthdr.len < off +
sizeof(fh))
1671 m_copydata(m, off,
sizeof(fh), (caddr_t)&fh);
1673 if (fh.ip6f_offlg & IP6F_OFF_MASK)
1676 *nxtp = fh.ip6f_nxt;
1677 off +=
sizeof(
struct ip6_frag);
1681 if (m->m_pkthdr.len < off +
sizeof(ip6e))
1683 m_copydata(m, off,
sizeof(ip6e), (caddr_t)&ip6e);
1685 *nxtp = ip6e.ip6e_nxt;
1686 off += (ip6e.ip6e_len + 2) << 2;
1689 case IPPROTO_HOPOPTS:
1690 case IPPROTO_ROUTING:
1691 case IPPROTO_DSTOPTS:
1692 if (m->m_pkthdr.len < off +
sizeof(ip6e))
1694 m_copydata(m, off,
sizeof(ip6e), (caddr_t)&ip6e);
1696 *nxtp = ip6e.ip6e_nxt;
1697 off += (ip6e.ip6e_len + 1) << 3;
1702 case IPPROTO_IPCOMP:
1730 else if (newoff < off)
1732 else if (newoff == off)
1746 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH,
1747 EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED,
1748 EMSGSIZE, EHOSTUNREACH, 0, 0,
1749 0, 0, EHOSTUNREACH, 0,
1750 ENOPROTOOPT, ECONNREFUSED
void icmp6_error(struct mbuf *m, int type, int code, int param)
void in6_purgeaddr(struct ifaddr *ifa)
char * ip6_sprintf(char *ip6buf, const struct in6_addr *addr)
bool in6_localip_fib(struct in6_addr *in6, uint16_t fib)
struct in6_ifaddr * in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid, bool referenced)
#define IPV6_ADDR_INT32_SMP
#define IPV6_ADDR_MC_SCOPE(a)
#define IN6_IS_ADDR_UNSPECIFIED(a)
#define IPV6_2292HOPLIMIT
#define IN6_ARE_ADDR_EQUAL(a, b)
#define IN6_IS_ADDR_V4COMPAT(a)
#define IN6_IS_ADDR_V4MAPPED(a)
#define IN6_IS_ADDR_MULTICAST(a)
void addrsel_policy_init(void)
#define IN6_IS_ADDR_MC_INTFACELOCAL(a)
void in6_ifdetach_destroy(struct ifnet *ifp)
void in6_ifattach_destroy(void)
struct mbuf * ip6_tryforward(struct mbuf *)
#define V_in6_ifaddrhashtbl
#define in6_ifstat_inc(ifp, tag)
#define V_in6_ifaddrhmask
void ip6_forward(struct mbuf *m, int srcrt)
#define V_ip6_accept_rtadv
#define IP6STAT_INC(name)
#define V_ip6_sendredirects
#define V_ip6_auto_linklocal
#define V_ip6_hdrnestlimit
void ip6_direct_input(struct mbuf *)
#define V_inet6_pfil_head
int(* ip6_mforward)(struct ip6_hdr *, struct ifnet *, struct mbuf *)
VNET_SYSUNINIT(vnet_mld_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_mld_uninit, NULL)
void mld_domifdetach(struct ifnet *ifp)
#define MAX_TEMP_DESYNC_FACTOR
#define ND6_IFF_IFDISABLED
#define V_ip6_desync_factor
int in6_setscope(struct in6_addr *in6, struct ifnet *ifp, u_int32_t *ret_id)
int in6_clearscope(struct in6_addr *in6)
int sa6_recoverscope(struct sockaddr_in6 *sin6)
struct in6_addr ipi6_addr
unsigned int ipi6_ifindex
struct sockaddr_in6 ip6m_addr
struct in6_addr sin6_addr