Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Sep 2002 20:18:21 +0400 (MSD)
From:      Maxim Konovalov <maxim@macomnet.ru>
To:        freebsd-net@freebsd.org
Subject:   ip reassembling patch
Message-ID:  <20020912194517.K2218-100000@news1.macomnet.ru>

next in thread | raw e-mail | index | archive | help

Hello -net,

There is a minor bug in reassembling code.

sys/netinet/ip_input.c::ip_input():

730 if (ip->ip_off & IP_MF) {
731	/*
732	 * Make sure that fragments have a data length
733	 * that's a non-zero multiple of 8 bytes.
734	 */
735 	if (ip->ip_len == 0 || (ip->ip_len & 0x7) != 0) {
736		ipstat.ips_toosmall++; /* XXX */
737			goto bad;
738	}
739	m->m_flags |= M_FRAG;
740 }

In the code above we go through all mbufs with fragments and set
M_FRAG for all mbufs except the last one.

sys/netinet/ip_input.c::ip_reass() checks this flag later:

1013 /* Make sure the last packet didn't have the IP_MF flag */
1014 if (p->m_flags & M_FRAG)
1015	return (0);

It doesn't work for simplex interfaces because ip_output() sets M_FRAG
for *all* mbufs with fragments.

That is why

# ifconfig lo0 mtu 16384 && ping -s 20000 localhost

doesn't work. (It works for mtu ~= MCLBYTES due to looutput()'s
feature/bug).

I have already discussed this problem with bde and jlemon, I made
several patches, the less intrusive one is below:

Index: sys/netinet/ip_input.c
===================================================================
RCS file: /home/ncvs/src/sys/netinet/ip_input.c,v
retrieving revision 1.130.2.38
diff -u -r1.130.2.38 ip_input.c
--- sys/netinet/ip_input.c	9 Aug 2002 14:49:22 -0000	1.130.2.38
+++ sys/netinet/ip_input.c	9 Sep 2002 14:35:39 -0000
@@ -714,7 +714,8 @@
 				goto bad;
 			}
 			m->m_flags |= M_FRAG;
-		}
+		} else
+			m->m_flags &= ~M_FRAG;
 		ip->ip_off <<= 3;

 		/*

%%%

Any objections?

-- 
Maxim Konovalov, MAcomnet, Internet Dept., system engineer
phone: +7 (095) 796-9079, mailto:maxim@macomnet.ru


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020912194517.K2218-100000>