diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-12-07 07:37:41 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1999-12-07 07:37:41 +0000 |
commit | 43a17c4b64eaa7019dceb70520adbb8d9dc7f369 (patch) | |
tree | 48bee32839c29799af6dcd8907ececfa6200b157 /sys | |
parent | 92f41441b316b1e9f95fc58e1bb5952a745f5a9b (diff) |
Missing "else"...
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/ip_esp_new.c | 91 |
1 files changed, 46 insertions, 45 deletions
diff --git a/sys/netinet/ip_esp_new.c b/sys/netinet/ip_esp_new.c index dbb3bddc3b6..f16618f15c1 100644 --- a/sys/netinet/ip_esp_new.c +++ b/sys/netinet/ip_esp_new.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp_new.c,v 1.52 1999/12/06 23:09:11 angelos Exp $ */ +/* $OpenBSD: ip_esp_new.c,v 1.53 1999/12/07 07:37:40 angelos Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -363,7 +363,7 @@ esp_new_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) while (oplen > 0) { - if (mo == 0) + if (mo == NULL) { DPRINTF(("esp_new_input(): bad mbuf chain, SA %s/%08x\n", ipsp_address(tdb->tdb_dst), ntohl(tdb->tdb_spi))); @@ -443,50 +443,51 @@ esp_new_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) if (!(m1->m_flags & M_PKTHDR)) m->m_pkthdr.len -= (2 * sizeof(u_int32_t) + tdb->tdb_ivlen); } - if (roff + 2 * sizeof(u_int32_t) + tdb->tdb_ivlen >= m1->m_len) - { - /* - * Part or all of the ESP header is at the end of this mbuf, so first - * let's remove the remainder of the ESP header from the - * begining of the remainder of the mbuf chain, if any. - */ - if (roff + 2 * sizeof(u_int32_t) + tdb->tdb_ivlen > m1->m_len) - { - /* Adjust the next mbuf by the remainder */ - m_adj(m1->m_next, roff + 2 * sizeof(u_int32_t) + - tdb->tdb_ivlen - m1->m_len); - - /* The second mbuf is guaranteed not to have a pkthdr... */ - m->m_pkthdr.len -= roff + 2 * sizeof(u_int32_t) + tdb->tdb_ivlen - - m1->m_len; - } - - /* Now, let's unlink the mbuf chain for a second...*/ - mo = m1->m_next; - m1->m_next = NULL; - - /* ...and trim the end of the first part of the chain...sick */ - m_adj(m1, -(m1->m_len - roff)); - if (!(m1->m_flags & M_PKTHDR)) - m->m_pkthdr.len -= (m1->m_len - roff); - - /* Finally, let's relink */ - m1->m_next = mo; - } else - { - /* - * The ESP header lies in the "middle" of the mbuf...do an - * overlapping copy of the remainder of the mbuf over the ESP - * header. - */ - bcopy(mtod(m1, u_char *) + roff + 2 * sizeof(u_int32_t) + - tdb->tdb_ivlen, - mtod(m1, u_char *) + roff, - m1->m_len - (roff + 2 * sizeof(u_int32_t) + tdb->tdb_ivlen)); - m1->m_len -= (2 * sizeof(u_int32_t) + tdb->tdb_ivlen); - m->m_pkthdr.len -= (2 * sizeof(u_int32_t) + tdb->tdb_ivlen); - } + if (roff + 2 * sizeof(u_int32_t) + tdb->tdb_ivlen >= m1->m_len) + { + /* + * Part or all of the ESP header is at the end of this mbuf, so first + * let's remove the remainder of the ESP header from the + * begining of the remainder of the mbuf chain, if any. + */ + if (roff + 2 * sizeof(u_int32_t) + tdb->tdb_ivlen > m1->m_len) + { + /* Adjust the next mbuf by the remainder */ + m_adj(m1->m_next, roff + 2 * sizeof(u_int32_t) + + tdb->tdb_ivlen - m1->m_len); + + /* The second mbuf is guaranteed not to have a pkthdr... */ + m->m_pkthdr.len -= (roff + 2 * sizeof(u_int32_t) + + tdb->tdb_ivlen - m1->m_len); + } + + /* Now, let's unlink the mbuf chain for a second...*/ + mo = m1->m_next; + m1->m_next = NULL; + + /* ...and trim the end of the first part of the chain...sick */ + m_adj(m1, -(m1->m_len - roff)); + if (!(m1->m_flags & M_PKTHDR)) + m->m_pkthdr.len -= (m1->m_len - roff); + + /* Finally, let's relink */ + m1->m_next = mo; + } + else + { + /* + * The ESP header lies in the "middle" of the mbuf...do an + * overlapping copy of the remainder of the mbuf over the ESP + * header. + */ + bcopy(mtod(m1, u_char *) + roff + 2 * sizeof(u_int32_t) + + tdb->tdb_ivlen, + mtod(m1, u_char *) + roff, + m1->m_len - (roff + 2 * sizeof(u_int32_t) + tdb->tdb_ivlen)); + m1->m_len -= (2 * sizeof(u_int32_t) + tdb->tdb_ivlen); + m->m_pkthdr.len -= (2 * sizeof(u_int32_t) + tdb->tdb_ivlen); + } /* Point to the encrypted data */ idat = mtod(mi, unsigned char *) + (mi->m_len - ilen); |