Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netipsec Call m_pullup earlier, fixes one branch.
details: https://anonhg.NetBSD.org/src/rev/41511cfe12e1
branches: trunk
changeset: 320941:41511cfe12e1
user: maxv <maxv%NetBSD.org@localhost>
date: Mon Mar 05 11:50:25 2018 +0000
description:
Call m_pullup earlier, fixes one branch.
diffstat:
sys/netipsec/ipsec_output.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diffs (55 lines):
diff -r de16c4966ac4 -r 41511cfe12e1 sys/netipsec/ipsec_output.c
--- a/sys/netipsec/ipsec_output.c Mon Mar 05 11:24:34 2018 +0000
+++ b/sys/netipsec/ipsec_output.c Mon Mar 05 11:50:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec_output.c,v 1.70 2018/03/03 09:39:29 maxv Exp $ */
+/* $NetBSD: ipsec_output.c,v 1.71 2018/03/05 11:50:25 maxv Exp $ */
/*
* Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.70 2018/03/03 09:39:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.71 2018/03/05 11:50:25 maxv Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -485,6 +485,12 @@
}
KASSERT(sav != NULL);
+ if (m->m_len < sizeof(struct ip) &&
+ (m = m_pullup(m, sizeof(struct ip))) == NULL) {
+ error = ENOBUFS;
+ goto unrefsav;
+ }
+
/*
* Check if we need to handle NAT-T fragmentation.
*/
@@ -509,11 +515,6 @@
* Collect IP_DF state from the outer header.
*/
if (dst->sa.sa_family == AF_INET) {
- if (m->m_len < sizeof(struct ip) &&
- (m = m_pullup(m, sizeof(struct ip))) == NULL) {
- error = ENOBUFS;
- goto unrefsav;
- }
ip = mtod(m, struct ip *);
/* Honor system-wide control of how to handle IP_DF */
switch (ip4_ipsec_dfbit) {
@@ -545,11 +546,6 @@
struct mbuf *mp;
/* Fix IPv4 header checksum and length */
- if (m->m_len < sizeof(struct ip) &&
- (m = m_pullup(m, sizeof(struct ip))) == NULL) {
- error = ENOBUFS;
- goto unrefsav;
- }
ip = mtod(m, struct ip *);
ip->ip_len = htons(m->m_pkthdr.len);
ip->ip_sum = 0;
Home |
Main Index |
Thread Index |
Old Index