diff options
author | glebius <glebius@FreeBSD.org> | 2005-07-17 08:09:59 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2005-07-17 08:09:59 +0000 |
commit | 8462e72cfb5f746807b7c16cfc8cc25893b975f9 (patch) | |
tree | 9d390250f02b2b641445c9669ae4f7d090b6072c /sys/netgraph/netflow | |
parent | 138abbd8431c1b32c758c1ba319651eaee5060bd (diff) | |
download | FreeBSD-src-8462e72cfb5f746807b7c16cfc8cc25893b975f9.zip FreeBSD-src-8462e72cfb5f746807b7c16cfc8cc25893b975f9.tar.gz |
Check that we have first fragment before pulling up TCP/UDP header.
Diffstat (limited to 'sys/netgraph/netflow')
-rw-r--r-- | sys/netgraph/netflow/ng_netflow.c | 26 |
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) { |