aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorMaxim Konovalov <maxim@FreeBSD.org>2005-04-08 10:25:13 +0000
committerMaxim Konovalov <maxim@FreeBSD.org>2005-04-08 10:25:13 +0000
commit800af1fb81b9946ee18bb1141f86336adf7e8b21 (patch)
tree71a367d3188ea9f7535f164bdda58532637448f5 /sys/netinet/ip_input.c
parent1717bcc6f4f9e97056c223348e633716a9caff9b (diff)
downloadsrc-800af1fb81b9946ee18bb1141f86336adf7e8b21.tar.gz
src-800af1fb81b9946ee18bb1141f86336adf7e8b21.zip
o Nano optimize ip_reass() code path for the first fragment: do not
try to reasseble the packet from the fragments queue with the only fragment, finish with the first fragment as soon as we create a queue. Spotted by: Vijay Singh o Drop the fragment if maxfragsperpacket == 0, no chances we will be able to reassemble the packet in future. Reviewed by: silby
Notes
Notes: svn path=/head/; revision=144792
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 64e4046ec889..712d993e6570 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -801,8 +801,8 @@ ip_reass(struct mbuf *m)
u_int8_t ecn, ecn0;
u_short hash;
- /* If maxnipq is 0, never accept fragments. */
- if (maxnipq == 0) {
+ /* If maxnipq or maxfragsperpacket are 0, never accept fragments. */
+ if (maxnipq == 0 || maxfragsperpacket == 0) {
ipstat.ips_fragments++;
ipstat.ips_fragdropped++;
m_freem(m);
@@ -918,7 +918,7 @@ found:
fp->ipq_dst = ip->ip_dst;
fp->ipq_frags = m;
m->m_nextpkt = NULL;
- goto inserted;
+ goto done;
} else {
fp->ipq_nfrags++;
#ifdef MAC
@@ -998,8 +998,6 @@ found:
m_freem(q);
}
-inserted:
-
/*
* Check for complete reassembly and perform frag per packet
* limiting.