Deleted Added
full compact
xform_ipcomp.c (179290) xform_ipcomp.c (181803)
1/* $FreeBSD: head/sys/netipsec/xform_ipcomp.c 179290 2008-05-24 15:32:46Z bz $ */
1/* $FreeBSD: head/sys/netipsec/xform_ipcomp.c 181803 2008-08-17 23:27:27Z bz $ */
2/* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
3
4/*-
5 * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

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

36#include <sys/systm.h>
37#include <sys/mbuf.h>
38#include <sys/lock.h>
39#include <sys/mutex.h>
40#include <sys/socket.h>
41#include <sys/kernel.h>
42#include <sys/protosw.h>
43#include <sys/sysctl.h>
2/* $OpenBSD: ip_ipcomp.c,v 1.1 2001/07/05 12:08:52 jjbg Exp $ */
3
4/*-
5 * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:

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

36#include <sys/systm.h>
37#include <sys/mbuf.h>
38#include <sys/lock.h>
39#include <sys/mutex.h>
40#include <sys/socket.h>
41#include <sys/kernel.h>
42#include <sys/protosw.h>
43#include <sys/sysctl.h>
44#include <sys/vimage.h>
44
45#include <netinet/in.h>
46#include <netinet/in_systm.h>
47#include <netinet/ip.h>
48#include <netinet/ip_var.h>
49
50#include <net/route.h>
51#include <netipsec/ipsec.h>

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

109 sav->alg_comp = sav->alg_enc; /* set for doing histogram */
110 sav->tdb_xform = xsp;
111 sav->tdb_compalgxform = tcomp;
112
113 /* Initialize crypto session */
114 bzero(&cric, sizeof (cric));
115 cric.cri_alg = sav->tdb_compalgxform->type;
116
45
46#include <netinet/in.h>
47#include <netinet/in_systm.h>
48#include <netinet/ip.h>
49#include <netinet/ip_var.h>
50
51#include <net/route.h>
52#include <netipsec/ipsec.h>

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

110 sav->alg_comp = sav->alg_enc; /* set for doing histogram */
111 sav->tdb_xform = xsp;
112 sav->tdb_compalgxform = tcomp;
113
114 /* Initialize crypto session */
115 bzero(&cric, sizeof (cric));
116 cric.cri_alg = sav->tdb_compalgxform->type;
117
117 return crypto_newsession(&sav->tdb_cryptoid, &cric, crypto_support);
118 return crypto_newsession(&sav->tdb_cryptoid, &cric, V_crypto_support);
118}
119
120/*
121 * ipcomp_zeroize() used when IPCA is deleted
122 */
123static int
124ipcomp_zeroize(struct secasvar *sav)
125{

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

141 struct cryptop *crp;
142 int hlen = IPCOMP_HLENGTH;
143
144 /* Get crypto descriptors */
145 crp = crypto_getreq(1);
146 if (crp == NULL) {
147 m_freem(m);
148 DPRINTF(("%s: no crypto descriptors\n", __func__));
119}
120
121/*
122 * ipcomp_zeroize() used when IPCA is deleted
123 */
124static int
125ipcomp_zeroize(struct secasvar *sav)
126{

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

142 struct cryptop *crp;
143 int hlen = IPCOMP_HLENGTH;
144
145 /* Get crypto descriptors */
146 crp = crypto_getreq(1);
147 if (crp == NULL) {
148 m_freem(m);
149 DPRINTF(("%s: no crypto descriptors\n", __func__));
149 ipcompstat.ipcomps_crypto++;
150 V_ipcompstat.ipcomps_crypto++;
150 return ENOBUFS;
151 }
152 /* Get IPsec-specific opaque pointer */
153 tc = (struct tdb_crypto *) malloc(sizeof (*tc), M_XDATA, M_NOWAIT|M_ZERO);
154 if (tc == NULL) {
155 m_freem(m);
156 crypto_freereq(crp);
157 DPRINTF(("%s: cannot allocate tdb_crypto\n", __func__));
151 return ENOBUFS;
152 }
153 /* Get IPsec-specific opaque pointer */
154 tc = (struct tdb_crypto *) malloc(sizeof (*tc), M_XDATA, M_NOWAIT|M_ZERO);
155 if (tc == NULL) {
156 m_freem(m);
157 crypto_freereq(crp);
158 DPRINTF(("%s: cannot allocate tdb_crypto\n", __func__));
158 ipcompstat.ipcomps_crypto++;
159 V_ipcompstat.ipcomps_crypto++;
159 return ENOBUFS;
160 }
161 crdc = crp->crp_desc;
162
163 crdc->crd_skip = skip + hlen;
164 crdc->crd_len = m->m_pkthdr.len - (skip + hlen);
165 crdc->crd_inject = skip;
166

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

223 IPSEC_ASSERT(tc != NULL, ("null opaque crypto data area!"));
224 skip = tc->tc_skip;
225 protoff = tc->tc_protoff;
226 mtag = (struct mtag *) tc->tc_ptr;
227 m = (struct mbuf *) crp->crp_buf;
228
229 sav = KEY_ALLOCSA(&tc->tc_dst, tc->tc_proto, tc->tc_spi);
230 if (sav == NULL) {
160 return ENOBUFS;
161 }
162 crdc = crp->crp_desc;
163
164 crdc->crd_skip = skip + hlen;
165 crdc->crd_len = m->m_pkthdr.len - (skip + hlen);
166 crdc->crd_inject = skip;
167

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

224 IPSEC_ASSERT(tc != NULL, ("null opaque crypto data area!"));
225 skip = tc->tc_skip;
226 protoff = tc->tc_protoff;
227 mtag = (struct mtag *) tc->tc_ptr;
228 m = (struct mbuf *) crp->crp_buf;
229
230 sav = KEY_ALLOCSA(&tc->tc_dst, tc->tc_proto, tc->tc_spi);
231 if (sav == NULL) {
231 ipcompstat.ipcomps_notdb++;
232 V_ipcompstat.ipcomps_notdb++;
232 DPRINTF(("%s: SA expired while in crypto\n", __func__));
233 error = ENOBUFS; /*XXX*/
234 goto bad;
235 }
236
237 saidx = &sav->sah->saidx;
238 IPSEC_ASSERT(saidx->dst.sa.sa_family == AF_INET ||
239 saidx->dst.sa.sa_family == AF_INET6,

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

246 sav->tdb_cryptoid = crp->crp_sid;
247
248 if (crp->crp_etype == EAGAIN) {
249 KEY_FREESAV(&sav);
250 error = crypto_dispatch(crp);
251 return error;
252 }
253
233 DPRINTF(("%s: SA expired while in crypto\n", __func__));
234 error = ENOBUFS; /*XXX*/
235 goto bad;
236 }
237
238 saidx = &sav->sah->saidx;
239 IPSEC_ASSERT(saidx->dst.sa.sa_family == AF_INET ||
240 saidx->dst.sa.sa_family == AF_INET6,

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

247 sav->tdb_cryptoid = crp->crp_sid;
248
249 if (crp->crp_etype == EAGAIN) {
250 KEY_FREESAV(&sav);
251 error = crypto_dispatch(crp);
252 return error;
253 }
254
254 ipcompstat.ipcomps_noxform++;
255 V_ipcompstat.ipcomps_noxform++;
255 DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
256 error = crp->crp_etype;
257 goto bad;
258 }
259 /* Shouldn't happen... */
260 if (m == NULL) {
256 DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
257 error = crp->crp_etype;
258 goto bad;
259 }
260 /* Shouldn't happen... */
261 if (m == NULL) {
261 ipcompstat.ipcomps_crypto++;
262 V_ipcompstat.ipcomps_crypto++;
262 DPRINTF(("%s: null mbuf returned from crypto\n", __func__));
263 error = EINVAL;
264 goto bad;
265 }
263 DPRINTF(("%s: null mbuf returned from crypto\n", __func__));
264 error = EINVAL;
265 goto bad;
266 }
266 ipcompstat.ipcomps_hist[sav->alg_comp]++;
267 V_ipcompstat.ipcomps_hist[sav->alg_comp]++;
267
268 clen = crp->crp_olen; /* Length of data after processing */
269
270 /* Release the crypto descriptors */
271 free(tc, M_XDATA), tc = NULL;
272 crypto_freereq(crp), crp = NULL;
273
274 /* In case it's not done already, adjust the size of the mbuf chain */
275 m->m_pkthdr.len = clen + hlen + skip;
276
277 if (m->m_len < skip + hlen && (m = m_pullup(m, skip + hlen)) == 0) {
268
269 clen = crp->crp_olen; /* Length of data after processing */
270
271 /* Release the crypto descriptors */
272 free(tc, M_XDATA), tc = NULL;
273 crypto_freereq(crp), crp = NULL;
274
275 /* In case it's not done already, adjust the size of the mbuf chain */
276 m->m_pkthdr.len = clen + hlen + skip;
277
278 if (m->m_len < skip + hlen && (m = m_pullup(m, skip + hlen)) == 0) {
278 ipcompstat.ipcomps_hdrops++; /*XXX*/
279 V_ipcompstat.ipcomps_hdrops++; /*XXX*/
279 DPRINTF(("%s: m_pullup failed\n", __func__));
280 error = EINVAL; /*XXX*/
281 goto bad;
282 }
283
284 /* Keep the next protocol field */
285 addr = (caddr_t) mtod(m, struct ip *) + skip;
286 nproto = ((struct ipcomp *) addr)->comp_nxt;
287
288 /* Remove the IPCOMP header */
289 error = m_striphdr(m, skip, hlen);
290 if (error) {
280 DPRINTF(("%s: m_pullup failed\n", __func__));
281 error = EINVAL; /*XXX*/
282 goto bad;
283 }
284
285 /* Keep the next protocol field */
286 addr = (caddr_t) mtod(m, struct ip *) + skip;
287 nproto = ((struct ipcomp *) addr)->comp_nxt;
288
289 /* Remove the IPCOMP header */
290 error = m_striphdr(m, skip, hlen);
291 if (error) {
291 ipcompstat.ipcomps_hdrops++;
292 V_ipcompstat.ipcomps_hdrops++;
292 DPRINTF(("%s: bad mbuf chain, IPCA %s/%08lx\n", __func__,
293 ipsec_address(&sav->sah->saidx.dst),
294 (u_long) ntohl(sav->spi)));
295 goto bad;
296 }
297
298 /* Restore the Next Protocol field */
299 m_copyback(m, protoff, sizeof (u_int8_t), (u_int8_t *) &nproto);

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

339 sav = isr->sav;
340 IPSEC_ASSERT(sav != NULL, ("null SA"));
341 ipcompx = sav->tdb_compalgxform;
342 IPSEC_ASSERT(ipcompx != NULL, ("null compression xform"));
343
344 ralen = m->m_pkthdr.len - skip; /* Raw payload length before comp. */
345 hlen = IPCOMP_HLENGTH;
346
293 DPRINTF(("%s: bad mbuf chain, IPCA %s/%08lx\n", __func__,
294 ipsec_address(&sav->sah->saidx.dst),
295 (u_long) ntohl(sav->spi)));
296 goto bad;
297 }
298
299 /* Restore the Next Protocol field */
300 m_copyback(m, protoff, sizeof (u_int8_t), (u_int8_t *) &nproto);

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

340 sav = isr->sav;
341 IPSEC_ASSERT(sav != NULL, ("null SA"));
342 ipcompx = sav->tdb_compalgxform;
343 IPSEC_ASSERT(ipcompx != NULL, ("null compression xform"));
344
345 ralen = m->m_pkthdr.len - skip; /* Raw payload length before comp. */
346 hlen = IPCOMP_HLENGTH;
347
347 ipcompstat.ipcomps_output++;
348 V_ipcompstat.ipcomps_output++;
348
349 /* Check for maximum packet size violations. */
350 switch (sav->sah->saidx.dst.sa.sa_family) {
351#ifdef INET
352 case AF_INET:
353 maxpacketsize = IP_MAXPACKET;
354 break;
355#endif /* INET */
356#ifdef INET6
357 case AF_INET6:
358 maxpacketsize = IPV6_MAXPACKET;
359 break;
360#endif /* INET6 */
361 default:
349
350 /* Check for maximum packet size violations. */
351 switch (sav->sah->saidx.dst.sa.sa_family) {
352#ifdef INET
353 case AF_INET:
354 maxpacketsize = IP_MAXPACKET;
355 break;
356#endif /* INET */
357#ifdef INET6
358 case AF_INET6:
359 maxpacketsize = IPV6_MAXPACKET;
360 break;
361#endif /* INET6 */
362 default:
362 ipcompstat.ipcomps_nopf++;
363 V_ipcompstat.ipcomps_nopf++;
363 DPRINTF(("%s: unknown/unsupported protocol family %d, "
364 "IPCA %s/%08lx\n", __func__,
365 sav->sah->saidx.dst.sa.sa_family,
366 ipsec_address(&sav->sah->saidx.dst),
367 (u_long) ntohl(sav->spi)));
368 error = EPFNOSUPPORT;
369 goto bad;
370 }
371 if (skip + hlen + ralen > maxpacketsize) {
364 DPRINTF(("%s: unknown/unsupported protocol family %d, "
365 "IPCA %s/%08lx\n", __func__,
366 sav->sah->saidx.dst.sa.sa_family,
367 ipsec_address(&sav->sah->saidx.dst),
368 (u_long) ntohl(sav->spi)));
369 error = EPFNOSUPPORT;
370 goto bad;
371 }
372 if (skip + hlen + ralen > maxpacketsize) {
372 ipcompstat.ipcomps_toobig++;
373 V_ipcompstat.ipcomps_toobig++;
373 DPRINTF(("%s: packet in IPCA %s/%08lx got too big "
374 "(len %u, max len %u)\n", __func__,
375 ipsec_address(&sav->sah->saidx.dst),
376 (u_long) ntohl(sav->spi),
377 skip + hlen + ralen, maxpacketsize));
378 error = EMSGSIZE;
379 goto bad;
380 }
381
382 /* Update the counters */
374 DPRINTF(("%s: packet in IPCA %s/%08lx got too big "
375 "(len %u, max len %u)\n", __func__,
376 ipsec_address(&sav->sah->saidx.dst),
377 (u_long) ntohl(sav->spi),
378 skip + hlen + ralen, maxpacketsize));
379 error = EMSGSIZE;
380 goto bad;
381 }
382
383 /* Update the counters */
383 ipcompstat.ipcomps_obytes += m->m_pkthdr.len - skip;
384 V_ipcompstat.ipcomps_obytes += m->m_pkthdr.len - skip;
384
385 m = m_unshare(m, M_NOWAIT);
386 if (m == NULL) {
385
386 m = m_unshare(m, M_NOWAIT);
387 if (m == NULL) {
387 ipcompstat.ipcomps_hdrops++;
388 V_ipcompstat.ipcomps_hdrops++;
388 DPRINTF(("%s: cannot clone mbuf chain, IPCA %s/%08lx\n",
389 __func__, ipsec_address(&sav->sah->saidx.dst),
390 (u_long) ntohl(sav->spi)));
391 error = ENOBUFS;
392 goto bad;
393 }
394
395 /* Inject IPCOMP header */
396 mo = m_makespace(m, skip, hlen, &roff);
397 if (mo == NULL) {
389 DPRINTF(("%s: cannot clone mbuf chain, IPCA %s/%08lx\n",
390 __func__, ipsec_address(&sav->sah->saidx.dst),
391 (u_long) ntohl(sav->spi)));
392 error = ENOBUFS;
393 goto bad;
394 }
395
396 /* Inject IPCOMP header */
397 mo = m_makespace(m, skip, hlen, &roff);
398 if (mo == NULL) {
398 ipcompstat.ipcomps_wrap++;
399 V_ipcompstat.ipcomps_wrap++;
399 DPRINTF(("%s: IPCOMP header inject failed for IPCA %s/%08lx\n",
400 __func__, ipsec_address(&sav->sah->saidx.dst),
401 (u_long) ntohl(sav->spi)));
402 error = ENOBUFS;
403 goto bad;
404 }
405 ipcomp = (struct ipcomp *)(mtod(mo, caddr_t) + roff);
406

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

425 prot = IPPROTO_IPCOMP;
426 m_copyback(m, protoff, sizeof(u_int8_t), (u_char *) &prot);
427
428 /* Ok now, we can pass to the crypto processing */
429
430 /* Get crypto descriptors */
431 crp = crypto_getreq(1);
432 if (crp == NULL) {
400 DPRINTF(("%s: IPCOMP header inject failed for IPCA %s/%08lx\n",
401 __func__, ipsec_address(&sav->sah->saidx.dst),
402 (u_long) ntohl(sav->spi)));
403 error = ENOBUFS;
404 goto bad;
405 }
406 ipcomp = (struct ipcomp *)(mtod(mo, caddr_t) + roff);
407

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

426 prot = IPPROTO_IPCOMP;
427 m_copyback(m, protoff, sizeof(u_int8_t), (u_char *) &prot);
428
429 /* Ok now, we can pass to the crypto processing */
430
431 /* Get crypto descriptors */
432 crp = crypto_getreq(1);
433 if (crp == NULL) {
433 ipcompstat.ipcomps_crypto++;
434 V_ipcompstat.ipcomps_crypto++;
434 DPRINTF(("%s: failed to acquire crypto descriptor\n",__func__));
435 error = ENOBUFS;
436 goto bad;
437 }
438 crdc = crp->crp_desc;
439
440 /* Compression descriptor */
441 crdc->crd_skip = skip + hlen;
442 crdc->crd_len = m->m_pkthdr.len - (skip + hlen);
443 crdc->crd_flags = CRD_F_COMP;
444 crdc->crd_inject = skip + hlen;
445
446 /* Compression operation */
447 crdc->crd_alg = ipcompx->type;
448
449 /* IPsec-specific opaque crypto info */
450 tc = (struct tdb_crypto *) malloc(sizeof(struct tdb_crypto),
451 M_XDATA, M_NOWAIT|M_ZERO);
452 if (tc == NULL) {
435 DPRINTF(("%s: failed to acquire crypto descriptor\n",__func__));
436 error = ENOBUFS;
437 goto bad;
438 }
439 crdc = crp->crp_desc;
440
441 /* Compression descriptor */
442 crdc->crd_skip = skip + hlen;
443 crdc->crd_len = m->m_pkthdr.len - (skip + hlen);
444 crdc->crd_flags = CRD_F_COMP;
445 crdc->crd_inject = skip + hlen;
446
447 /* Compression operation */
448 crdc->crd_alg = ipcompx->type;
449
450 /* IPsec-specific opaque crypto info */
451 tc = (struct tdb_crypto *) malloc(sizeof(struct tdb_crypto),
452 M_XDATA, M_NOWAIT|M_ZERO);
453 if (tc == NULL) {
453 ipcompstat.ipcomps_crypto++;
454 V_ipcompstat.ipcomps_crypto++;
454 DPRINTF(("%s: failed to allocate tdb_crypto\n", __func__));
455 crypto_freereq(crp);
456 error = ENOBUFS;
457 goto bad;
458 }
459
460 tc->tc_isr = isr;
461 tc->tc_spi = sav->spi;

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

495 m = (struct mbuf *) crp->crp_buf;
496 skip = tc->tc_skip;
497 rlen = crp->crp_ilen - skip;
498
499 isr = tc->tc_isr;
500 IPSECREQUEST_LOCK(isr);
501 sav = KEY_ALLOCSA(&tc->tc_dst, tc->tc_proto, tc->tc_spi);
502 if (sav == NULL) {
455 DPRINTF(("%s: failed to allocate tdb_crypto\n", __func__));
456 crypto_freereq(crp);
457 error = ENOBUFS;
458 goto bad;
459 }
460
461 tc->tc_isr = isr;
462 tc->tc_spi = sav->spi;

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

496 m = (struct mbuf *) crp->crp_buf;
497 skip = tc->tc_skip;
498 rlen = crp->crp_ilen - skip;
499
500 isr = tc->tc_isr;
501 IPSECREQUEST_LOCK(isr);
502 sav = KEY_ALLOCSA(&tc->tc_dst, tc->tc_proto, tc->tc_spi);
503 if (sav == NULL) {
503 ipcompstat.ipcomps_notdb++;
504 V_ipcompstat.ipcomps_notdb++;
504 DPRINTF(("%s: SA expired while in crypto\n", __func__));
505 error = ENOBUFS; /*XXX*/
506 goto bad;
507 }
508 IPSEC_ASSERT(isr->sav == sav, ("SA changed\n"));
509
510 /* Check for crypto errors */
511 if (crp->crp_etype) {
512 /* Reset session ID */
513 if (sav->tdb_cryptoid != 0)
514 sav->tdb_cryptoid = crp->crp_sid;
515
516 if (crp->crp_etype == EAGAIN) {
517 KEY_FREESAV(&sav);
518 IPSECREQUEST_UNLOCK(isr);
519 error = crypto_dispatch(crp);
520 return error;
521 }
505 DPRINTF(("%s: SA expired while in crypto\n", __func__));
506 error = ENOBUFS; /*XXX*/
507 goto bad;
508 }
509 IPSEC_ASSERT(isr->sav == sav, ("SA changed\n"));
510
511 /* Check for crypto errors */
512 if (crp->crp_etype) {
513 /* Reset session ID */
514 if (sav->tdb_cryptoid != 0)
515 sav->tdb_cryptoid = crp->crp_sid;
516
517 if (crp->crp_etype == EAGAIN) {
518 KEY_FREESAV(&sav);
519 IPSECREQUEST_UNLOCK(isr);
520 error = crypto_dispatch(crp);
521 return error;
522 }
522 ipcompstat.ipcomps_noxform++;
523 V_ipcompstat.ipcomps_noxform++;
523 DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
524 error = crp->crp_etype;
525 goto bad;
526 }
527 /* Shouldn't happen... */
528 if (m == NULL) {
524 DPRINTF(("%s: crypto error %d\n", __func__, crp->crp_etype));
525 error = crp->crp_etype;
526 goto bad;
527 }
528 /* Shouldn't happen... */
529 if (m == NULL) {
529 ipcompstat.ipcomps_crypto++;
530 V_ipcompstat.ipcomps_crypto++;
530 DPRINTF(("%s: bogus return buffer from crypto\n", __func__));
531 error = EINVAL;
532 goto bad;
533 }
531 DPRINTF(("%s: bogus return buffer from crypto\n", __func__));
532 error = EINVAL;
533 goto bad;
534 }
534 ipcompstat.ipcomps_hist[sav->alg_comp]++;
535 V_ipcompstat.ipcomps_hist[sav->alg_comp]++;
535
536 if (rlen > crp->crp_olen) {
537 /* Adjust the length in the IP header */
538 switch (sav->sah->saidx.dst.sa.sa_family) {
539#ifdef INET
540 case AF_INET:
541 mtod(m, struct ip *)->ip_len = htons(m->m_pkthdr.len);
542 break;
543#endif /* INET */
544#ifdef INET6
545 case AF_INET6:
546 mtod(m, struct ip6_hdr *)->ip6_plen =
547 htons(m->m_pkthdr.len) - sizeof(struct ip6_hdr);
548 break;
549#endif /* INET6 */
550 default:
536
537 if (rlen > crp->crp_olen) {
538 /* Adjust the length in the IP header */
539 switch (sav->sah->saidx.dst.sa.sa_family) {
540#ifdef INET
541 case AF_INET:
542 mtod(m, struct ip *)->ip_len = htons(m->m_pkthdr.len);
543 break;
544#endif /* INET */
545#ifdef INET6
546 case AF_INET6:
547 mtod(m, struct ip6_hdr *)->ip6_plen =
548 htons(m->m_pkthdr.len) - sizeof(struct ip6_hdr);
549 break;
550#endif /* INET6 */
551 default:
551 ipcompstat.ipcomps_nopf++;
552 V_ipcompstat.ipcomps_nopf++;
552 DPRINTF(("%s: unknown/unsupported protocol "
553 "family %d, IPCA %s/%08lx\n", __func__,
554 sav->sah->saidx.dst.sa.sa_family,
555 ipsec_address(&sav->sah->saidx.dst),
556 (u_long) ntohl(sav->spi)));
557 error = EPFNOSUPPORT;
558 goto bad;
559 }

--- 37 unchanged lines hidden ---
553 DPRINTF(("%s: unknown/unsupported protocol "
554 "family %d, IPCA %s/%08lx\n", __func__,
555 sav->sah->saidx.dst.sa.sa_family,
556 ipsec_address(&sav->sah->saidx.dst),
557 (u_long) ntohl(sav->spi)));
558 error = EPFNOSUPPORT;
559 goto bad;
560 }

--- 37 unchanged lines hidden ---