2 /* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
5 * SPDX-License-Identifier: BSD-3-Clause
7 * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 /* IP payload compression protocol (IPComp), see RFC 2393 */
35 #include "opt_inet6.h"
37 #include <sys/param.h>
38 #include <sys/systm.h>
41 #include <sys/mutex.h>
42 #include <sys/socket.h>
43 #include <sys/kernel.h>
44 #include <sys/protosw.h>
45 #include <sys/sysctl.h>
47 #include <netinet/in.h>
48 #include <netinet/in_systm.h>
49 #include <netinet/ip.h>
50 #include <netinet/ip_var.h>
51 #include <netinet/ip_encap.h>
53 #include <net/netisr.h>
55 #include <net/if.h> /* XXXGL: net_epoch should move out there */
56 #include <net/if_var.h> /* XXXGL: net_epoch should move out there */
58 #include <netipsec/ipsec.h>
59 #include <netipsec/xform.h>
62 #include <netinet/ip6.h>
63 #include <netinet6/ip6_var.h>
64 #include <netipsec/ipsec6.h>
67 #include <netipsec/ipcomp.h>
68 #include <netipsec/ipcomp_var.h>
70 #include <netipsec/key.h>
71 #include <netipsec/key_debug.h>
73 #include <opencrypto/cryptodev.h>
74 #include <opencrypto/deflate.h>
75 #include <opencrypto/xform.h>
77 VNET_DEFINE(int, ipcomp_enable) = 1;
78 VNET_PCPUSTAT_DEFINE(struct ipcompstat, ipcompstat);
79 VNET_PCPUSTAT_SYSINIT(ipcompstat);
82 VNET_PCPUSTAT_SYSUNINIT(ipcompstat);
85 SYSCTL_DECL(_net_inet_ipcomp);
86 SYSCTL_INT(_net_inet_ipcomp, OID_AUTO, ipcomp_enable,
87 CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipcomp_enable), 0, "");
88 SYSCTL_VNET_PCPUSTAT(_net_inet_ipcomp, IPSECCTL_STATS, stats,
89 struct ipcompstat, ipcompstat,
90 "IPCOMP statistics (struct ipcompstat, netipsec/ipcomp_var.h");
92 static int ipcomp_input_cb(struct cryptop *crp);
93 static int ipcomp_output_cb(struct cryptop *crp);
96 * RFC 3173 p 2.2. Non-Expansion Policy:
97 * If the total size of a compressed payload and the IPComp header, as
98 * defined in section 3, is not smaller than the size of the original
99 * payload, the IP datagram MUST be sent in the original non-compressed
102 * When we use IPComp in tunnel mode, for small packets we will receive
103 * encapsulated IP-IP datagrams without any compression and without IPComp
107 ipcomp_encapcheck(union sockaddr_union *src, union sockaddr_union *dst)
109 struct secasvar *sav;
111 sav = key_allocsa_tunnel(src, dst, IPPROTO_IPCOMP);
116 if (src->sa.sa_family == AF_INET)
117 return (sizeof(struct in_addr) << 4);
119 return (sizeof(struct in6_addr) << 4);
123 ipcomp_nonexp_input(struct mbuf *m, int off, int proto, void *arg __unused)
141 IPCOMPSTAT_INC(ipcomps_nopf);
143 return (IPPROTO_DONE);
146 IPCOMPSTAT_ADD(ipcomps_ibytes, m->m_pkthdr.len);
147 IPCOMPSTAT_INC(ipcomps_input);
148 netisr_dispatch(isr, m);
149 return (IPPROTO_DONE);
153 * ipcomp_init() is called when an CPI is being set up.
156 ipcomp_init(struct secasvar *sav, struct xformsw *xsp)
158 const struct comp_algo *tcomp;
159 struct cryptoini cric;
161 /* NB: algorithm really comes in alg_enc and not alg_comp! */
162 tcomp = comp_algorithm_lookup(sav->alg_enc);
164 DPRINTF(("%s: unsupported compression algorithm %d\n", __func__,
168 sav->alg_comp = sav->alg_enc; /* set for doing histogram */
169 sav->tdb_xform = xsp;
170 sav->tdb_compalgxform = tcomp;
172 /* Initialize crypto session */
173 bzero(&cric, sizeof (cric));
174 cric.cri_alg = sav->tdb_compalgxform->type;
176 return crypto_newsession(&sav->tdb_cryptoid, &cric, V_crypto_support);
180 * ipcomp_zeroize() used when IPCA is deleted
183 ipcomp_zeroize(struct secasvar *sav)
186 crypto_freesession(sav->tdb_cryptoid);
187 sav->tdb_cryptoid = NULL;
192 * ipcomp_input() gets called to uncompress an input packet
195 ipcomp_input(struct mbuf *m, struct secasvar *sav, int skip, int protoff)
197 struct xform_data *xd;
198 struct cryptodesc *crdc;
200 struct ipcomp *ipcomp;
202 int error, hlen = IPCOMP_HLENGTH;
205 * Check that the next header of the IPComp is not IPComp again, before
206 * doing any real work. Given it is not possible to do double
207 * compression it means someone is playing tricks on us.
210 if (m->m_len < skip + hlen && (m = m_pullup(m, skip + hlen)) == NULL) {
211 IPCOMPSTAT_INC(ipcomps_hdrops); /*XXX*/
212 DPRINTF(("%s: m_pullup failed\n", __func__));
216 addr = (caddr_t) mtod(m, struct ip *) + skip;
217 ipcomp = (struct ipcomp *)addr;
218 if (ipcomp->comp_nxt == IPPROTO_IPCOMP) {
219 IPCOMPSTAT_INC(ipcomps_pdrops); /* XXX have our own stats? */
220 DPRINTF(("%s: recursive compression detected\n", __func__));
225 /* Get crypto descriptors */
226 crp = crypto_getreq(1);
228 DPRINTF(("%s: no crypto descriptors\n", __func__));
229 IPCOMPSTAT_INC(ipcomps_crypto);
232 /* Get IPsec-specific opaque pointer */
233 xd = malloc(sizeof(*xd), M_XDATA, M_NOWAIT | M_ZERO);
235 DPRINTF(("%s: cannot allocate xform_data\n", __func__));
236 IPCOMPSTAT_INC(ipcomps_crypto);
240 crdc = crp->crp_desc;
242 crdc->crd_skip = skip + hlen;
243 crdc->crd_len = m->m_pkthdr.len - (skip + hlen);
244 crdc->crd_inject = skip;
246 /* Decompression operation */
247 crdc->crd_alg = sav->tdb_compalgxform->type;
250 /* Crypto operation descriptor */
251 crp->crp_ilen = m->m_pkthdr.len - (skip + hlen);
252 crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_CBIFSYNC;
253 crp->crp_buf = (caddr_t) m;
254 crp->crp_callback = ipcomp_input_cb;
255 crp->crp_opaque = (caddr_t) xd;
257 /* These are passed as-is to the callback */
259 xd->protoff = protoff;
264 crp->crp_session = xd->cryptoid = sav->tdb_cryptoid;
265 SECASVAR_UNLOCK(sav);
267 return crypto_dispatch(crp);
275 * IPComp input callback from the crypto driver.
278 ipcomp_input_cb(struct cryptop *crp)
280 IPSEC_DEBUG_DECLARE(char buf[IPSEC_ADDRSTRLEN]);
281 struct xform_data *xd;
283 struct secasvar *sav;
284 struct secasindex *saidx;
286 crypto_session_t cryptoid;
287 int hlen = IPCOMP_HLENGTH, error, clen;
291 m = (struct mbuf *) crp->crp_buf;
292 xd = (struct xform_data *) crp->crp_opaque;
293 CURVNET_SET(xd->vnet);
296 protoff = xd->protoff;
297 cryptoid = xd->cryptoid;
298 saidx = &sav->sah->saidx;
299 IPSEC_ASSERT(saidx->dst.sa.sa_family == AF_INET ||
300 saidx->dst.sa.sa_family == AF_INET6,
301 ("unexpected protocol family %u", saidx->dst.sa.sa_family));
303 /* Check for crypto errors */
304 if (crp->crp_etype) {
305 if (crp->crp_etype == EAGAIN) {
306 /* Reset the session ID */
307 if (ipsec_updateid(sav, &crp->crp_session, &cryptoid) != 0)
308 crypto_freesession(cryptoid);
309 xd->cryptoid = crp->crp_session;
311 return (crypto_dispatch(crp));
313 IPCOMPSTAT_INC(ipcomps_noxform);
314 DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
315 error = crp->crp_etype;
318 /* Shouldn't happen... */
320 IPCOMPSTAT_INC(ipcomps_crypto);
321 DPRINTF(("%s: null mbuf returned from crypto\n", __func__));
325 IPCOMPSTAT_INC(ipcomps_hist[sav->alg_comp]);
327 clen = crp->crp_olen; /* Length of data after processing */
329 /* Release the crypto descriptors */
330 free(xd, M_XDATA), xd = NULL;
331 crypto_freereq(crp), crp = NULL;
333 /* In case it's not done already, adjust the size of the mbuf chain */
334 m->m_pkthdr.len = clen + hlen + skip;
336 if (m->m_len < skip + hlen && (m = m_pullup(m, skip + hlen)) == NULL) {
337 IPCOMPSTAT_INC(ipcomps_hdrops); /*XXX*/
338 DPRINTF(("%s: m_pullup failed\n", __func__));
339 error = EINVAL; /*XXX*/
343 /* Keep the next protocol field */
344 addr = (caddr_t) mtod(m, struct ip *) + skip;
345 nproto = ((struct ipcomp *) addr)->comp_nxt;
347 /* Remove the IPCOMP header */
348 error = m_striphdr(m, skip, hlen);
350 IPCOMPSTAT_INC(ipcomps_hdrops);
351 DPRINTF(("%s: bad mbuf chain, IPCA %s/%08lx\n", __func__,
352 ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)),
353 (u_long) ntohl(sav->spi)));
357 /* Restore the Next Protocol field */
358 m_copyback(m, protoff, sizeof (u_int8_t), (u_int8_t *) &nproto);
360 switch (saidx->dst.sa.sa_family) {
363 error = ipsec6_common_input_cb(m, sav, skip, protoff);
368 error = ipsec4_common_input_cb(m, sav, skip, protoff);
372 panic("%s: Unexpected address family: %d saidx=%p", __func__,
373 saidx->dst.sa.sa_family, saidx);
391 * IPComp output routine, called by ipsec[46]_perform_request()
394 ipcomp_output(struct mbuf *m, struct secpolicy *sp, struct secasvar *sav,
395 u_int idx, int skip, int protoff)
397 IPSEC_DEBUG_DECLARE(char buf[IPSEC_ADDRSTRLEN]);
398 const struct comp_algo *ipcompx;
399 struct cryptodesc *crdc;
401 struct xform_data *xd;
402 int error, ralen, maxpacketsize;
404 IPSEC_ASSERT(sav != NULL, ("null SA"));
405 ipcompx = sav->tdb_compalgxform;
406 IPSEC_ASSERT(ipcompx != NULL, ("null compression xform"));
409 * Do not touch the packet in case our payload to compress
410 * is lower than the minimal threshold of the compression
411 * alogrithm. We will just send out the data uncompressed.
412 * See RFC 3173, 2.2. Non-Expansion Policy.
414 if (m->m_pkthdr.len <= ipcompx->minlen) {
415 IPCOMPSTAT_INC(ipcomps_threshold);
416 return ipsec_process_done(m, sp, sav, idx);
419 ralen = m->m_pkthdr.len - skip; /* Raw payload length before comp. */
420 IPCOMPSTAT_INC(ipcomps_output);
422 /* Check for maximum packet size violations. */
423 switch (sav->sah->saidx.dst.sa.sa_family) {
426 maxpacketsize = IP_MAXPACKET;
431 maxpacketsize = IPV6_MAXPACKET;
435 IPCOMPSTAT_INC(ipcomps_nopf);
436 DPRINTF(("%s: unknown/unsupported protocol family %d, "
437 "IPCA %s/%08lx\n", __func__,
438 sav->sah->saidx.dst.sa.sa_family,
439 ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)),
440 (u_long) ntohl(sav->spi)));
441 error = EPFNOSUPPORT;
444 if (ralen + skip + IPCOMP_HLENGTH > maxpacketsize) {
445 IPCOMPSTAT_INC(ipcomps_toobig);
446 DPRINTF(("%s: packet in IPCA %s/%08lx got too big "
447 "(len %u, max len %u)\n", __func__,
448 ipsec_address(&sav->sah->saidx.dst, buf, sizeof(buf)),
449 (u_long) ntohl(sav->spi),
450 ralen + skip + IPCOMP_HLENGTH, maxpacketsize));
455 /* Update the counters */
456 IPCOMPSTAT_ADD(ipcomps_obytes, m->m_pkthdr.len - skip);
458 m = m_unshare(m, M_NOWAIT);
460 IPCOMPSTAT_INC(ipcomps_hdrops);
461 DPRINTF(("%s: cannot clone mbuf chain, IPCA %s/%08lx\n",
462 __func__, ipsec_address(&sav->sah->saidx.dst, buf,
463 sizeof(buf)), (u_long) ntohl(sav->spi)));
468 /* Ok now, we can pass to the crypto processing. */
470 /* Get crypto descriptors */
471 crp = crypto_getreq(1);
473 IPCOMPSTAT_INC(ipcomps_crypto);
474 DPRINTF(("%s: failed to acquire crypto descriptor\n",__func__));
478 crdc = crp->crp_desc;
480 /* Compression descriptor */
481 crdc->crd_skip = skip;
482 crdc->crd_len = ralen;
483 crdc->crd_flags = CRD_F_COMP;
484 crdc->crd_inject = skip;
486 /* Compression operation */
487 crdc->crd_alg = ipcompx->type;
489 /* IPsec-specific opaque crypto info */
490 xd = malloc(sizeof(struct xform_data), M_XDATA, M_NOWAIT | M_ZERO);
492 IPCOMPSTAT_INC(ipcomps_crypto);
493 DPRINTF(("%s: failed to allocate xform_data\n", __func__));
503 xd->protoff = protoff;
506 /* Crypto operation descriptor */
507 crp->crp_ilen = m->m_pkthdr.len; /* Total input length */
508 crp->crp_flags = CRYPTO_F_IMBUF | CRYPTO_F_CBIFSYNC;
509 crp->crp_buf = (caddr_t) m;
510 crp->crp_callback = ipcomp_output_cb;
511 crp->crp_opaque = (caddr_t) xd;
514 crp->crp_session = xd->cryptoid = sav->tdb_cryptoid;
515 SECASVAR_UNLOCK(sav);
517 return crypto_dispatch(crp);
527 * IPComp output callback from the crypto driver.
530 ipcomp_output_cb(struct cryptop *crp)
532 IPSEC_DEBUG_DECLARE(char buf[IPSEC_ADDRSTRLEN]);
533 struct xform_data *xd;
534 struct secpolicy *sp;
535 struct secasvar *sav;
537 crypto_session_t cryptoid;
539 int error, skip, protoff;
541 m = (struct mbuf *) crp->crp_buf;
542 xd = (struct xform_data *) crp->crp_opaque;
543 CURVNET_SET(xd->vnet);
548 protoff = xd->protoff;
549 cryptoid = xd->cryptoid;
551 /* Check for crypto errors */
552 if (crp->crp_etype) {
553 if (crp->crp_etype == EAGAIN) {
554 /* Reset the session ID */
555 if (ipsec_updateid(sav, &crp->crp_session, &cryptoid) != 0)
556 crypto_freesession(cryptoid);
557 xd->cryptoid = crp->crp_session;
559 return (crypto_dispatch(crp));
561 IPCOMPSTAT_INC(ipcomps_noxform);
562 DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
563 error = crp->crp_etype;
566 /* Shouldn't happen... */
568 IPCOMPSTAT_INC(ipcomps_crypto);
569 DPRINTF(("%s: bogus return buffer from crypto\n", __func__));
573 IPCOMPSTAT_INC(ipcomps_hist[sav->alg_comp]);
575 if (crp->crp_ilen - skip > crp->crp_olen) {
577 struct ipcomp *ipcomp;
581 /* Compression helped, inject IPCOMP header. */
582 mo = m_makespace(m, skip, IPCOMP_HLENGTH, &roff);
584 IPCOMPSTAT_INC(ipcomps_wrap);
585 DPRINTF(("%s: IPCOMP header inject failed "
586 "for IPCA %s/%08lx\n",
587 __func__, ipsec_address(&sav->sah->saidx.dst, buf,
588 sizeof(buf)), (u_long) ntohl(sav->spi)));
592 ipcomp = (struct ipcomp *)(mtod(mo, caddr_t) + roff);
594 /* Initialize the IPCOMP header */
595 /* XXX alignment always correct? */
596 switch (sav->sah->saidx.dst.sa.sa_family) {
599 ipcomp->comp_nxt = mtod(m, struct ip *)->ip_p;
604 ipcomp->comp_nxt = mtod(m, struct ip6_hdr *)->ip6_nxt;
608 ipcomp->comp_flags = 0;
609 ipcomp->comp_cpi = htons((u_int16_t) ntohl(sav->spi));
611 /* Fix Next Protocol in IPv4/IPv6 header */
612 prot = IPPROTO_IPCOMP;
613 m_copyback(m, protoff, sizeof(u_int8_t),
616 /* Adjust the length in the IP header */
617 switch (sav->sah->saidx.dst.sa.sa_family) {
620 mtod(m, struct ip *)->ip_len = htons(m->m_pkthdr.len);
625 mtod(m, struct ip6_hdr *)->ip6_plen =
626 htons(m->m_pkthdr.len) - sizeof(struct ip6_hdr);
630 IPCOMPSTAT_INC(ipcomps_nopf);
631 DPRINTF(("%s: unknown/unsupported protocol "
632 "family %d, IPCA %s/%08lx\n", __func__,
633 sav->sah->saidx.dst.sa.sa_family,
634 ipsec_address(&sav->sah->saidx.dst, buf,
635 sizeof(buf)), (u_long) ntohl(sav->spi)));
636 error = EPFNOSUPPORT;
640 /* Compression was useless, we have lost time. */
641 IPCOMPSTAT_INC(ipcomps_uncompr);
642 DPRINTF(("%s: compressions was useless %d - %d <= %d\n",
643 __func__, crp->crp_ilen, skip, crp->crp_olen));
644 /* XXX remember state to not compress the next couple
645 * of packets, RFC 3173, 2.2. Non-Expansion Policy */
648 /* Release the crypto descriptor */
652 /* NB: m is reclaimed by ipsec_process_done. */
653 error = ipsec_process_done(m, sp, sav, idx);
669 ipcomp4_nonexp_encapcheck(const struct mbuf *m, int off, int proto,
672 union sockaddr_union src, dst;
675 if (V_ipcomp_enable == 0)
677 if (proto != IPPROTO_IPV4 && proto != IPPROTO_IPV6)
679 bzero(&src, sizeof(src));
680 bzero(&dst, sizeof(dst));
681 src.sa.sa_family = dst.sa.sa_family = AF_INET;
682 src.sin.sin_len = dst.sin.sin_len = sizeof(struct sockaddr_in);
683 ip = mtod(m, const struct ip *);
684 src.sin.sin_addr = ip->ip_src;
685 dst.sin.sin_addr = ip->ip_dst;
686 return (ipcomp_encapcheck(&src, &dst));
689 static const struct encaptab *ipe4_cookie = NULL;
690 static const struct encap_config ipv4_encap_cfg = {
692 .min_length = sizeof(struct ip),
693 .exact_match = sizeof(in_addr_t) << 4,
694 .check = ipcomp4_nonexp_encapcheck,
695 .input = ipcomp_nonexp_input
700 ipcomp6_nonexp_encapcheck(const struct mbuf *m, int off, int proto,
703 union sockaddr_union src, dst;
704 const struct ip6_hdr *ip6;
706 if (V_ipcomp_enable == 0)
708 if (proto != IPPROTO_IPV4 && proto != IPPROTO_IPV6)
710 bzero(&src, sizeof(src));
711 bzero(&dst, sizeof(dst));
712 src.sa.sa_family = dst.sa.sa_family = AF_INET;
713 src.sin6.sin6_len = dst.sin6.sin6_len = sizeof(struct sockaddr_in6);
714 ip6 = mtod(m, const struct ip6_hdr *);
715 src.sin6.sin6_addr = ip6->ip6_src;
716 dst.sin6.sin6_addr = ip6->ip6_dst;
717 if (IN6_IS_SCOPE_LINKLOCAL(&src.sin6.sin6_addr)) {
718 /* XXX: sa6_recoverscope() */
719 src.sin6.sin6_scope_id =
720 ntohs(src.sin6.sin6_addr.s6_addr16[1]);
721 src.sin6.sin6_addr.s6_addr16[1] = 0;
723 if (IN6_IS_SCOPE_LINKLOCAL(&dst.sin6.sin6_addr)) {
724 /* XXX: sa6_recoverscope() */
725 dst.sin6.sin6_scope_id =
726 ntohs(dst.sin6.sin6_addr.s6_addr16[1]);
727 dst.sin6.sin6_addr.s6_addr16[1] = 0;
729 return (ipcomp_encapcheck(&src, &dst));
732 static const struct encaptab *ipe6_cookie = NULL;
733 static const struct encap_config ipv6_encap_cfg = {
735 .min_length = sizeof(struct ip6_hdr),
736 .exact_match = sizeof(struct in6_addr) << 4,
737 .check = ipcomp6_nonexp_encapcheck,
738 .input = ipcomp_nonexp_input
742 static struct xformsw ipcomp_xformsw = {
743 .xf_type = XF_IPCOMP,
745 .xf_init = ipcomp_init,
746 .xf_zeroize = ipcomp_zeroize,
747 .xf_input = ipcomp_input,
748 .xf_output = ipcomp_output,
756 ipe4_cookie = ip_encap_attach(&ipv4_encap_cfg, NULL, M_WAITOK);
759 ipe6_cookie = ip6_encap_attach(&ipv6_encap_cfg, NULL, M_WAITOK);
761 xform_attach(&ipcomp_xformsw);
769 ip_encap_detach(ipe4_cookie);
772 ip6_encap_detach(ipe6_cookie);
774 xform_detach(&ipcomp_xformsw);
777 SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE,
778 ipcomp_attach, NULL);
779 SYSUNINIT(ipcomp_xform_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE,
780 ipcomp_detach, NULL);