summaryrefslogtreecommitdiff
path: root/sys/net/if_pfsync.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2010-11-29 06:48:10 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2010-11-29 06:48:10 +0000
commit857eae254941e050ac642c8b0bc01ad075d1d4de (patch)
tree409d17e1ca0e581ce39aa1c7a121043313bf5054 /sys/net/if_pfsync.c
parentcdfd6281ca0bacc176f49e857caba5a2d81cd9c8 (diff)
use m_pulldown to get a contig view of the pfsync_header instead of
m_pullup. not really a significant change since most rx bufs (which we read pfsync packets from) are a single contig cluster coming off the network, so we rarely hit the case m_pullup was called in.
Diffstat (limited to 'sys/net/if_pfsync.c')
-rw-r--r--sys/net/if_pfsync.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/net/if_pfsync.c b/sys/net/if_pfsync.c
index 052cc39bd36..9bb4997b9b9 100644
--- a/sys/net/if_pfsync.c
+++ b/sys/net/if_pfsync.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pfsync.c,v 1.158 2010/11/29 05:31:38 dlg Exp $ */
+/* $OpenBSD: if_pfsync.c,v 1.159 2010/11/29 06:48:09 dlg Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
@@ -665,19 +665,12 @@ pfsync_input(struct mbuf *m, ...)
}
offset = ip->ip_hl << 2;
- if (m->m_pkthdr.len < offset + sizeof(*ph)) {
+ mp = m_pulldown(m, offset, sizeof(*ph), &offp);
+ if (mp == NULL) {
pfsyncstats.pfsyncs_hdrops++;
- goto done;
- }
-
- if (offset + sizeof(*ph) > m->m_len) {
- if (m_pullup(m, offset + sizeof(*ph)) == NULL) {
- pfsyncstats.pfsyncs_hdrops++;
- return;
- }
- ip = mtod(m, struct ip *);
+ return;
}
- ph = (struct pfsync_header *)((char *)ip + offset);
+ ph = (struct pfsync_header *)(mp->m_data + offp);
/* verify the version */
if (ph->version != PFSYNC_VERSION) {