Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet6 pullup IPv6 and subsequent headers, on IPv6 IPs...
details: https://anonhg.NetBSD.org/src/rev/a4f72b6a13e1
branches: trunk
changeset: 497089:a4f72b6a13e1
user: itojun <itojun%NetBSD.org@localhost>
date: Mon Sep 18 22:18:00 2000 +0000
description:
pullup IPv6 and subsequent headers, on IPv6 IPsec transport mode input.
(not normally visited - we have switched to m_pulldown. just for completeness)
diffstat:
sys/netinet6/esp_input.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 2 deletions(-)
diffs (64 lines):
diff -r 420c6b473883 -r a4f72b6a13e1 sys/netinet6/esp_input.c
--- a/sys/netinet6/esp_input.c Mon Sep 18 22:15:21 2000 +0000
+++ b/sys/netinet6/esp_input.c Mon Sep 18 22:18:00 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: esp_input.c,v 1.7 2000/08/29 11:32:21 itojun Exp $ */
-/* $KAME: esp_input.c,v 1.32 2000/08/29 11:22:48 itojun Exp $ */
+/* $NetBSD: esp_input.c,v 1.8 2000/09/18 22:18:00 itojun Exp $ */
+/* $KAME: esp_input.c,v 1.33 2000/09/12 08:51:49 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -789,6 +789,52 @@
m->m_pkthdr.len += n->m_pkthdr.len;
}
+#ifndef PULLDOWN_TEST
+ /*
+ * KAME requires that the packet to be contiguous on the
+ * mbuf. We need to make that sure.
+ * this kind of code should be avoided.
+ * XXX other conditions to avoid running this part?
+ */
+ if (m->m_len != m->m_pkthdr.len) {
+ struct mbuf *n = NULL;
+ int maxlen;
+
+ MGETHDR(n, M_DONTWAIT, MT_HEADER);
+ maxlen = MHLEN;
+ if (n)
+ M_COPY_PKTHDR(n, m);
+ if (n && m->m_pkthdr.len > maxlen) {
+ MCLGET(n, M_DONTWAIT);
+ maxlen = MCLBYTES;
+ if ((n->m_flags & M_EXT) == 0) {
+ m_free(n);
+ n = NULL;
+ }
+ }
+ if (!n) {
+ printf("esp6_input: mbuf allocation failed\n");
+ goto bad;
+ }
+
+ if (m->m_pkthdr.len <= maxlen) {
+ m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t));
+ n->m_len = m->m_pkthdr.len;
+ n->m_pkthdr.len = m->m_pkthdr.len;
+ n->m_next = NULL;
+ m_freem(m);
+ } else {
+ m_copydata(m, 0, maxlen, mtod(n, caddr_t));
+ m_adj(m, maxlen);
+ n->m_len = maxlen;
+ n->m_pkthdr.len = m->m_pkthdr.len;
+ n->m_next = m;
+ m->m_flags &= ~M_PKTHDR;
+ }
+ m = n;
+ }
+#endif
+
ip6 = mtod(m, struct ip6_hdr *);
ip6->ip6_plen = htons(ntohs(ip6->ip6_plen) - stripsiz);
Home |
Main Index |
Thread Index |
Old Index