summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2005-07-17 08:09:59 +0000
committerglebius <glebius@FreeBSD.org>2005-07-17 08:09:59 +0000
commit8462e72cfb5f746807b7c16cfc8cc25893b975f9 (patch)
tree9d390250f02b2b641445c9669ae4f7d090b6072c
parent138abbd8431c1b32c758c1ba319651eaee5060bd (diff)
downloadFreeBSD-src-8462e72cfb5f746807b7c16cfc8cc25893b975f9.zip
FreeBSD-src-8462e72cfb5f746807b7c16cfc8cc25893b975f9.tar.gz
Check that we have first fragment before pulling up TCP/UDP header.
-rw-r--r--sys/netgraph/netflow/ng_netflow.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c
index ca8b2a1..134fafa 100644
--- a/sys/netgraph/netflow/ng_netflow.c
+++ b/sys/netgraph/netflow/ng_netflow.c
@@ -528,19 +528,21 @@ ng_netflow_rcvdata (hook_p hook, item_p item)
break;
}
- /*
- * In case of IP header with options, we haven't pulled
- * up enough, yet.
- */
- pullup_len += (ip->ip_hl << 2) - sizeof(struct ip);
+ if ((ip->ip_off & htons(IP_OFFMASK)) == 0) {
+ /*
+ * In case of IP header with options, we haven't pulled
+ * up enough, yet.
+ */
+ pullup_len += (ip->ip_hl << 2) - sizeof(struct ip);
- switch (ip->ip_p) {
- case IPPROTO_TCP:
- M_CHECK(sizeof(struct tcphdr));
- break;
- case IPPROTO_UDP:
- M_CHECK(sizeof(struct udphdr));
- break;
+ switch (ip->ip_p) {
+ case IPPROTO_TCP:
+ M_CHECK(sizeof(struct tcphdr));
+ break;
+ case IPPROTO_UDP:
+ M_CHECK(sizeof(struct udphdr));
+ break;
+ }
}
switch (iface->info.ifinfo_dlt) {
OpenPOWER on IntegriCloud