2 * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * IPsec output processing.
33 #include "opt_inet6.h"
34 #include "opt_ipsec.h"
37 #include <sys/param.h>
38 #include <sys/systm.h>
40 #include <sys/domain.h>
41 #include <sys/protosw.h>
42 #include <sys/socket.h>
43 #include <sys/errno.h>
44 #include <sys/syslog.h>
48 #include <net/route.h>
50 #include <netinet/in.h>
51 #include <netinet/in_systm.h>
52 #include <netinet/ip.h>
53 #include <netinet/ip_var.h>
54 #include <netinet/in_var.h>
55 #include <netinet/ip_ecn.h>
57 #include <netinet6/ip6_ecn.h>
60 #include <netinet/ip6.h>
62 #include <netinet6/ip6_var.h>
64 #include <netinet/in_pcb.h>
66 #include <netinet/icmp6.h>
69 #include <netipsec/ipsec.h>
71 #include <netipsec/ipsec6.h>
73 #include <netipsec/ah_var.h>
74 #include <netipsec/esp_var.h>
75 #include <netipsec/ipcomp_var.h>
77 #include <netipsec/xform.h>
79 #include <netipsec/key.h>
80 #include <netipsec/keydb.h>
81 #include <netipsec/key_debug.h>
83 #include <machine/in_cksum.h>
86 ipsec_process_done(struct mbuf *m, struct ipsecrequest *isr)
88 struct tdb_ident *tdbi;
91 struct secasindex *saidx;
94 IPSEC_SPLASSERT_SOFTNET(__func__);
96 IPSEC_ASSERT(m != NULL, ("null mbuf"));
97 IPSEC_ASSERT(isr != NULL, ("null ISR"));
99 IPSEC_ASSERT(sav != NULL, ("null SA"));
100 IPSEC_ASSERT(sav->sah != NULL, ("null SAH"));
102 saidx = &sav->sah->saidx;
103 switch (saidx->dst.sa.sa_family) {
106 /* Fix the header length, for AH processing. */
107 mtod(m, struct ip *)->ip_len = htons(m->m_pkthdr.len);
112 /* Fix the header length, for AH processing. */
113 if (m->m_pkthdr.len < sizeof (struct ip6_hdr)) {
117 if (m->m_pkthdr.len - sizeof (struct ip6_hdr) > IPV6_MAXPACKET) {
118 /* No jumbogram support. */
122 mtod(m, struct ip6_hdr *)->ip6_plen =
123 htons(m->m_pkthdr.len - sizeof(struct ip6_hdr));
127 DPRINTF(("%s: unknown protocol family %u\n", __func__,
128 saidx->dst.sa.sa_family));
134 * Add a record of what we've done or what needs to be done to the
137 mtag = m_tag_get(PACKET_TAG_IPSEC_OUT_DONE,
138 sizeof(struct tdb_ident), M_NOWAIT);
140 DPRINTF(("%s: could not get packet tag\n", __func__));
145 tdbi = (struct tdb_ident *)(mtag + 1);
146 tdbi->dst = saidx->dst;
147 tdbi->proto = saidx->proto;
148 tdbi->spi = sav->spi;
149 m_tag_prepend(m, mtag);
152 * If there's another (bundled) SA to apply, do so.
153 * Note that this puts a burden on the kernel stack size.
154 * If this is a problem we'll need to introduce a queue
155 * to set the packet on so we can unwind the stack before
156 * doing further processing.
159 ipsec4stat.ips_out_bundlesa++;
160 return ipsec4_process_packet(m, isr->next, 0, 0);
162 key_sa_recordxfer(sav, m); /* record data transfer */
165 * We're done with IPsec processing, transmit the packet using the
166 * appropriate network protocol (IP or IPv6). SPD lookup will be
167 * performed again there.
169 switch (saidx->dst.sa.sa_family) {
173 ip = mtod(m, struct ip *);
174 ip->ip_len = ntohs(ip->ip_len);
175 ip->ip_off = ntohs(ip->ip_off);
177 return ip_output(m, NULL, NULL, IP_RAWOUTPUT, NULL, NULL);
182 * We don't need massage, IPv6 header fields are always in
185 return ip6_output(m, NULL, NULL, 0, NULL, NULL, NULL);
188 panic("ipsec_process_done");
195 static struct ipsecrequest *
198 struct ipsecrequest *isr,
200 struct secasindex *saidx,
204 #define IPSEC_OSTAT(x,y,z) (isr->saidx.proto == IPPROTO_ESP ? (x)++ : \
205 isr->saidx.proto == IPPROTO_AH ? (y)++ : (z)++)
206 struct secasvar *sav;
208 IPSEC_SPLASSERT_SOFTNET(__func__);
209 IPSECREQUEST_LOCK_ASSERT(isr);
211 IPSEC_ASSERT(af == AF_INET || af == AF_INET6,
212 ("invalid address family %u", af));
215 * Craft SA index to search for proper SA. Note that
216 * we only fillin unspecified SA peers for transport
217 * mode; for tunnel mode they must already be filled in.
220 if (isr->saidx.mode == IPSEC_MODE_TRANSPORT) {
221 /* Fillin unspecified SA peers only for transport mode */
223 struct sockaddr_in *sin;
224 struct ip *ip = mtod(m, struct ip *);
226 if (saidx->src.sa.sa_len == 0) {
227 sin = &saidx->src.sin;
228 sin->sin_len = sizeof(*sin);
229 sin->sin_family = AF_INET;
230 sin->sin_port = IPSEC_PORT_ANY;
231 sin->sin_addr = ip->ip_src;
233 if (saidx->dst.sa.sa_len == 0) {
234 sin = &saidx->dst.sin;
235 sin->sin_len = sizeof(*sin);
236 sin->sin_family = AF_INET;
237 sin->sin_port = IPSEC_PORT_ANY;
238 sin->sin_addr = ip->ip_dst;
241 struct sockaddr_in6 *sin6;
242 struct ip6_hdr *ip6 = mtod(m, struct ip6_hdr *);
244 if (saidx->src.sin6.sin6_len == 0) {
245 sin6 = (struct sockaddr_in6 *)&saidx->src;
246 sin6->sin6_len = sizeof(*sin6);
247 sin6->sin6_family = AF_INET6;
248 sin6->sin6_port = IPSEC_PORT_ANY;
249 sin6->sin6_addr = ip6->ip6_src;
250 if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) {
251 /* fix scope id for comparing SPD */
252 sin6->sin6_addr.s6_addr16[1] = 0;
253 sin6->sin6_scope_id =
254 ntohs(ip6->ip6_src.s6_addr16[1]);
257 if (saidx->dst.sin6.sin6_len == 0) {
258 sin6 = (struct sockaddr_in6 *)&saidx->dst;
259 sin6->sin6_len = sizeof(*sin6);
260 sin6->sin6_family = AF_INET6;
261 sin6->sin6_port = IPSEC_PORT_ANY;
262 sin6->sin6_addr = ip6->ip6_dst;
263 if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) {
264 /* fix scope id for comparing SPD */
265 sin6->sin6_addr.s6_addr16[1] = 0;
266 sin6->sin6_scope_id =
267 ntohs(ip6->ip6_dst.s6_addr16[1]);
274 * Lookup SA and validate it.
276 *error = key_checkrequest(isr, saidx);
279 * IPsec processing is required, but no SA found.
280 * I assume that key_acquire() had been called
281 * to get/establish the SA. Here I discard
282 * this packet because it is responsibility for
283 * upper layer to retransmit the packet.
285 ipsec4stat.ips_out_nosa++;
289 if (sav == NULL) { /* XXX valid return */
290 IPSEC_ASSERT(ipsec_get_reqlevel(isr) == IPSEC_LEVEL_USE,
291 ("no SA found, but required; level %u",
292 ipsec_get_reqlevel(isr)));
293 IPSECREQUEST_UNLOCK(isr);
297 *error = EINVAL; /*XXX*/
300 IPSECREQUEST_LOCK(isr);
305 * Check system global policy controls.
307 if ((isr->saidx.proto == IPPROTO_ESP && !esp_enable) ||
308 (isr->saidx.proto == IPPROTO_AH && !ah_enable) ||
309 (isr->saidx.proto == IPPROTO_IPCOMP && !ipcomp_enable)) {
310 DPRINTF(("%s: IPsec outbound packet dropped due"
311 " to policy (check your sysctls)\n", __func__));
312 IPSEC_OSTAT(espstat.esps_pdrops, ahstat.ahs_pdrops,
313 ipcompstat.ipcomps_pdrops);
314 *error = EHOSTUNREACH;
319 * Sanity check the SA contents for the caller
320 * before they invoke the xform output method.
322 if (sav->tdb_xform == NULL) {
323 DPRINTF(("%s: no transform for SA\n", __func__));
324 IPSEC_OSTAT(espstat.esps_noxform, ahstat.ahs_noxform,
325 ipcompstat.ipcomps_noxform);
326 *error = EHOSTUNREACH;
331 IPSEC_ASSERT(*error != 0, ("error return w/ no error code"));
332 IPSECREQUEST_UNLOCK(isr);
339 * IPsec output logic for IPv4.
342 ipsec4_process_packet(
344 struct ipsecrequest *isr,
348 struct secasindex saidx;
349 struct secasvar *sav;
353 IPSEC_ASSERT(m != NULL, ("null mbuf"));
354 IPSEC_ASSERT(isr != NULL, ("null isr"));
356 IPSECREQUEST_LOCK(isr); /* insure SA contents don't change */
358 isr = ipsec_nextisr(m, isr, AF_INET, &saidx, &error);
365 /* pass the mbuf to enc0 for bpf processing */
366 ipsec_bpf(m, sav, AF_INET, ENC_OUT|ENC_BEFORE);
367 /* pass the mbuf to enc0 for packet filtering */
368 if ((error = ipsec_filter(&m, PFIL_OUT, ENC_OUT|ENC_BEFORE)) != 0)
373 union sockaddr_union *dst = &sav->sah->saidx.dst;
377 * Collect IP_DF state from the outer header.
379 if (dst->sa.sa_family == AF_INET) {
380 if (m->m_len < sizeof (struct ip) &&
381 (m = m_pullup(m, sizeof (struct ip))) == NULL) {
385 ip = mtod(m, struct ip *);
386 /* Honor system-wide control of how to handle IP_DF */
387 switch (ip4_ipsec_dfbit) {
388 case 0: /* clear in outer header */
389 case 1: /* set in outer header */
390 setdf = ip4_ipsec_dfbit;
392 default: /* propagate to outer header */
393 setdf = ntohs(ip->ip_off & IP_DF);
397 ip = NULL; /* keep compiler happy */
400 /* Do the appropriate encapsulation, if necessary */
401 if (isr->saidx.mode == IPSEC_MODE_TUNNEL || /* Tunnel requ'd */
402 dst->sa.sa_family != AF_INET || /* PF mismatch */
404 (sav->flags & SADB_X_SAFLAGS_TUNNEL) || /* Tunnel requ'd */
405 sav->tdb_xform->xf_type == XF_IP4 || /* ditto */
407 (dst->sa.sa_family == AF_INET && /* Proxy */
408 dst->sin.sin_addr.s_addr != INADDR_ANY &&
409 dst->sin.sin_addr.s_addr != ip->ip_dst.s_addr)) {
412 /* Fix IPv4 header checksum and length */
413 if (m->m_len < sizeof (struct ip) &&
414 (m = m_pullup(m, sizeof (struct ip))) == NULL) {
418 ip = mtod(m, struct ip *);
419 ip->ip_len = htons(m->m_pkthdr.len);
422 if (ip->ip_vhl == IP_VHL_BORING)
423 ip->ip_sum = in_cksum_hdr(ip);
425 ip->ip_sum = in_cksum(m,
426 _IP_VHL_HL(ip->ip_vhl) << 2);
428 ip->ip_sum = in_cksum(m, ip->ip_hl << 2);
431 /* Encapsulate the packet */
432 error = ipip_output(m, isr, &mp, 0, 0);
433 if (mp == NULL && !error) {
434 /* Should never happen. */
435 DPRINTF(("%s: ipip_output returns no mbuf and "
436 "no error!", __func__));
441 /* XXX: Should never happen! */
444 m = NULL; /* ipip_output() already freed it */
449 * ipip_output clears IP_DF in the new header. If
450 * we need to propagate IP_DF from the outer header,
451 * then we have to do it here.
453 * XXX shouldn't assume what ipip_output does.
455 if (dst->sa.sa_family == AF_INET && setdf) {
456 if (m->m_len < sizeof (struct ip) &&
457 (m = m_pullup(m, sizeof (struct ip))) == NULL) {
461 ip = mtod(m, struct ip *);
462 ip->ip_off = ntohs(ip->ip_off);
464 ip->ip_off = htons(ip->ip_off);
470 /* pass the mbuf to enc0 for bpf processing */
471 ipsec_bpf(m, sav, AF_INET, ENC_OUT|ENC_AFTER);
472 /* pass the mbuf to enc0 for packet filtering */
473 if ((error = ipsec_filter(&m, PFIL_OUT, ENC_OUT|ENC_AFTER)) != 0)
478 * Dispatch to the appropriate IPsec transform logic. The
479 * packet will be returned for transmission after crypto
480 * processing, etc. are completed. For encapsulation we
481 * bypass this call because of the explicit call done above
482 * (necessary to deal with IP_DF handling for IPv4).
484 * NB: m & sav are ``passed to caller'' who's reponsible for
485 * for reclaiming their resources.
487 if (sav->tdb_xform->xf_type != XF_IP4) {
488 ip = mtod(m, struct ip *);
490 off = offsetof(struct ip, ip_p);
491 error = (*sav->tdb_xform->xf_output)(m, isr, NULL, i, off);
493 error = ipsec_process_done(m, isr);
495 IPSECREQUEST_UNLOCK(isr);
499 IPSECREQUEST_UNLOCK(isr);
508 * Chop IP6 header from the payload.
511 ipsec6_splithdr(struct mbuf *m)
517 IPSEC_ASSERT(m->m_len >= sizeof (struct ip6_hdr),
518 ("first mbuf too short, len %u", m->m_len));
519 ip6 = mtod(m, struct ip6_hdr *);
520 hlen = sizeof(struct ip6_hdr);
521 if (m->m_len > hlen) {
522 MGETHDR(mh, M_DONTWAIT, MT_DATA);
527 M_MOVE_PKTHDR(mh, m);
534 bcopy((caddr_t)ip6, mtod(m, caddr_t), hlen);
535 } else if (m->m_len < hlen) {
536 m = m_pullup(m, hlen);
544 * IPsec output logic for IPv6, transport mode.
548 struct ipsec_output_state *state,
551 struct secpolicy *sp,
555 struct ipsecrequest *isr;
556 struct secasindex saidx;
560 IPSEC_ASSERT(state != NULL, ("null state"));
561 IPSEC_ASSERT(state->m != NULL, ("null m"));
562 IPSEC_ASSERT(nexthdrp != NULL, ("null nexthdrp"));
563 IPSEC_ASSERT(mprev != NULL, ("null mprev"));
564 IPSEC_ASSERT(sp != NULL, ("null sp"));
565 IPSEC_ASSERT(tun != NULL, ("null tun"));
567 KEYDEBUG(KEYDEBUG_IPSEC_DATA,
568 printf("%s: applied SP\n", __func__);
569 kdebug_secpolicy(sp));
572 if (isr->saidx.mode == IPSEC_MODE_TUNNEL) {
573 /* the rest will be handled by ipsec6_output_tunnel() */
574 *tun = 1; /* need tunnel-mode processing */
581 IPSECREQUEST_LOCK(isr); /* insure SA contents don't change */
582 isr = ipsec_nextisr(m, isr, AF_INET6, &saidx, &error);
585 /* XXX should notification be done for all errors ? */
587 * Notify the fact that the packet is discarded
588 * to ourselves. I believe this is better than
589 * just silently discarding. (jinmei@kame.net)
590 * XXX: should we restrict the error to TCP packets?
591 * XXX: should we directly notify sockets via
594 icmp6_error(m, ICMP6_DST_UNREACH,
595 ICMP6_DST_UNREACH_ADMIN, 0);
596 m = NULL; /* NB: icmp6_error frees mbuf */
601 error = (*isr->sav->tdb_xform->xf_output)(m, isr, NULL,
602 sizeof (struct ip6_hdr),
603 offsetof(struct ip6_hdr,
605 IPSECREQUEST_UNLOCK(isr);
609 IPSECREQUEST_UNLOCK(isr);
617 ipsec6_encapsulate(struct mbuf *m, struct secasvar *sav)
619 struct ip6_hdr *oip6;
623 /* can't tunnel between different AFs */
624 if (sav->sah->saidx.src.sa.sa_family != AF_INET6 ||
625 sav->sah->saidx.dst.sa.sa_family != AF_INET6) {
629 IPSEC_ASSERT(m->m_len == sizeof (struct ip6_hdr),
630 ("mbuf wrong size; len %u", m->m_len));
634 * grow the mbuf to accomodate the new IPv6 header.
636 plen = m->m_pkthdr.len;
637 if (M_LEADINGSPACE(m->m_next) < sizeof(struct ip6_hdr)) {
639 MGET(n, M_DONTWAIT, MT_DATA);
644 n->m_len = sizeof(struct ip6_hdr);
645 n->m_next = m->m_next;
647 m->m_pkthdr.len += sizeof(struct ip6_hdr);
648 oip6 = mtod(n, struct ip6_hdr *);
650 m->m_next->m_len += sizeof(struct ip6_hdr);
651 m->m_next->m_data -= sizeof(struct ip6_hdr);
652 m->m_pkthdr.len += sizeof(struct ip6_hdr);
653 oip6 = mtod(m->m_next, struct ip6_hdr *);
655 ip6 = mtod(m, struct ip6_hdr *);
656 bcopy((caddr_t)ip6, (caddr_t)oip6, sizeof(struct ip6_hdr));
658 /* Fake link-local scope-class addresses */
659 if (IN6_IS_SCOPE_LINKLOCAL(&oip6->ip6_src))
660 oip6->ip6_src.s6_addr16[1] = 0;
661 if (IN6_IS_SCOPE_LINKLOCAL(&oip6->ip6_dst))
662 oip6->ip6_dst.s6_addr16[1] = 0;
664 /* construct new IPv6 header. see RFC 2401 5.1.2.2 */
665 /* ECN consideration. */
666 ip6_ecn_ingress(ip6_ipsec_ecn, &ip6->ip6_flow, &oip6->ip6_flow);
667 if (plen < IPV6_MAXPACKET - sizeof(struct ip6_hdr))
668 ip6->ip6_plen = htons(plen);
670 /* ip6->ip6_plen will be updated in ip6_output() */
672 ip6->ip6_nxt = IPPROTO_IPV6;
673 ip6->ip6_src = sav->sah->saidx.src.sin6.sin6_addr;
674 ip6->ip6_dst = sav->sah->saidx.dst.sin6.sin6_addr;
675 ip6->ip6_hlim = IPV6_DEFHLIM;
677 /* XXX Should ip6_src be updated later ? */
683 * IPsec output logic for IPv6, tunnel mode.
686 ipsec6_output_tunnel(struct ipsec_output_state *state, struct secpolicy *sp, int flags)
689 struct ipsecrequest *isr;
690 struct secasindex saidx;
692 struct sockaddr_in6* dst6;
695 IPSEC_ASSERT(state != NULL, ("null state"));
696 IPSEC_ASSERT(state->m != NULL, ("null m"));
697 IPSEC_ASSERT(sp != NULL, ("null sp"));
699 KEYDEBUG(KEYDEBUG_IPSEC_DATA,
700 printf("%s: applied SP\n", __func__);
701 kdebug_secpolicy(sp));
705 * transport mode ipsec (before the 1st tunnel mode) is already
706 * processed by ipsec6_output_trans().
708 for (isr = sp->req; isr; isr = isr->next) {
709 if (isr->saidx.mode == IPSEC_MODE_TUNNEL)
713 IPSECREQUEST_LOCK(isr); /* insure SA contents don't change */
714 isr = ipsec_nextisr(m, isr, AF_INET6, &saidx, &error);
719 /* pass the mbuf to enc0 for bpf processing */
720 ipsec_bpf(m, isr->sav, AF_INET6, ENC_OUT|ENC_BEFORE);
721 /* pass the mbuf to enc0 for packet filtering */
722 if ((error = ipsec_filter(&m, PFIL_OUT, ENC_OUT|ENC_BEFORE)) != 0)
727 * There may be the case that SA status will be changed when
728 * we are refering to one. So calling splsoftnet().
730 if (isr->saidx.mode == IPSEC_MODE_TUNNEL) {
732 * build IPsec tunnel.
734 /* XXX should be processed with other familiy */
735 if (isr->sav->sah->saidx.src.sa.sa_family != AF_INET6) {
736 ipseclog((LOG_ERR, "%s: family mismatched between "
737 "inner and outer, spi=%u\n", __func__,
738 ntohl(isr->sav->spi)));
739 ipsec6stat.ips_out_inval++;
740 error = EAFNOSUPPORT;
744 m = ipsec6_splithdr(m);
746 ipsec6stat.ips_out_nomem++;
750 error = ipsec6_encapsulate(m, isr->sav);
755 ip6 = mtod(m, struct ip6_hdr *);
757 state->ro = &isr->sav->sah->sa_route;
758 state->dst = (struct sockaddr *)&state->ro->ro_dst;
759 dst6 = (struct sockaddr_in6 *)state->dst;
761 && ((state->ro->ro_rt->rt_flags & RTF_UP) == 0
762 || !IN6_ARE_ADDR_EQUAL(&dst6->sin6_addr, &ip6->ip6_dst))) {
763 RTFREE(state->ro->ro_rt);
764 state->ro->ro_rt = NULL;
766 if (state->ro->ro_rt == 0) {
767 bzero(dst6, sizeof(*dst6));
768 dst6->sin6_family = AF_INET6;
769 dst6->sin6_len = sizeof(*dst6);
770 dst6->sin6_addr = ip6->ip6_dst;
773 if (state->ro->ro_rt == 0) {
774 ip6stat.ip6s_noroute++;
775 ipsec6stat.ips_out_noroute++;
776 error = EHOSTUNREACH;
780 /* adjust state->dst if tunnel endpoint is offlink */
781 if (state->ro->ro_rt->rt_flags & RTF_GATEWAY) {
782 state->dst = (struct sockaddr *)state->ro->ro_rt->rt_gateway;
783 dst6 = (struct sockaddr_in6 *)state->dst;
787 m = ipsec6_splithdr(m);
789 ipsec6stat.ips_out_nomem++;
793 ip6 = mtod(m, struct ip6_hdr *);
796 /* pass the mbuf to enc0 for bpf processing */
797 ipsec_bpf(m, isr->sav, AF_INET6, ENC_OUT|ENC_AFTER);
798 /* pass the mbuf to enc0 for packet filtering */
799 if ((error = ipsec_filter(&m, PFIL_OUT, ENC_OUT|ENC_AFTER)) != 0)
803 error = (*isr->sav->tdb_xform->xf_output)(m, isr, NULL,
804 sizeof (struct ip6_hdr),
805 offsetof(struct ip6_hdr, ip6_nxt));
806 IPSECREQUEST_UNLOCK(isr);
810 IPSECREQUEST_UNLOCK(isr);