diff options
Diffstat (limited to 'sys/netinet/ip_esp.c')
-rw-r--r-- | sys/netinet/ip_esp.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index 4b44c77c76c..2c7b988e73f 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.138 2016/08/15 11:35:25 dlg Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.139 2016/08/18 06:01:10 dlg Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -884,18 +884,14 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, /* * Loop through mbuf chain; if we find a readonly mbuf, - * replace the rest of the chain. + * copy the packet. */ - mo = NULL; mi = m; - while (mi != NULL && !M_READONLY(mi)) { - mo = mi; + while (mi != NULL && !M_READONLY(mi)) mi = mi->m_next; - } if (mi != NULL) { - /* Replace the rest of the mbuf chain. */ - struct mbuf *n = m_dup_pkt(mi, 0, M_DONTWAIT); + struct mbuf *n = m_dup_pkt(m, 0, M_DONTWAIT); if (n == NULL) { DPRINTF(("esp_output(): bad mbuf chain, SA %s/%08x\n", @@ -906,12 +902,8 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, return ENOBUFS; } - if (mo != NULL) - mo->m_next = n; - else - m = n; - - m_freem(mi); + m_freem(m); + m = n; } /* Inject ESP header. */ |