summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2005-04-08 10:25:13 +0000
committermaxim <maxim@FreeBSD.org>2005-04-08 10:25:13 +0000
commit1d7537ad41f9efce18e3510dc54a20f63fcf7ec6 (patch)
tree71a367d3188ea9f7535f164bdda58532637448f5 /sys/netinet/ip_input.c
parentb54f449e4399ca01a46ba6fe839025c2115e35a6 (diff)
downloadFreeBSD-src-1d7537ad41f9efce18e3510dc54a20f63fcf7ec6.zip
FreeBSD-src-1d7537ad41f9efce18e3510dc54a20f63fcf7ec6.tar.gz
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
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 64e4046..712d993 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.
OpenPOWER on IntegriCloud