Index: sys/netipsec/xform_ipcomp.c =================================================================== RCS file: /cvsroot/src/sys/netipsec/xform_ipcomp.c,v retrieving revision 1.25 diff -u -u -p -r1.25 xform_ipcomp.c --- sys/netipsec/xform_ipcomp.c 24 Feb 2011 20:03:41 -0000 1.25 +++ sys/netipsec/xform_ipcomp.c 29 Mar 2011 19:24:04 -0000 @@ -326,6 +326,14 @@ ipcomp_input_cb(struct cryptop *crp) /* Keep the next protocol field */ addr = (uint8_t*) mtod(m, struct ip *) + skip; nproto = ((struct ipcomp *) addr)->comp_nxt; + if (nproto == IPPROTO_IPCOMP || nproto == IPPROTO_AH || nproto == IPPROTO_ESP) { + IPCOMP_STATINC(IPCOMP_STAT_HDROPS); + DPRINTF(("ipcomp_input_cb: nested ipcomp, IPCA %s/%08lx\n", + ipsec_address(&sav->sah->saidx.dst), + (u_long) ntohl(sav->spi))); + error = EINVAL; + goto bad; + } /* Remove the IPCOMP header */ error = m_striphdr(m, skip, hlen);