From owner-freebsd-net Thu Sep 12 9:18:28 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDE8537B400 for ; Thu, 12 Sep 2002 09:18:24 -0700 (PDT) Received: from relay1.macomnet.ru (relay1.macomnet.ru [195.128.64.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8678243E4A for ; Thu, 12 Sep 2002 09:18:23 -0700 (PDT) (envelope-from maxim@macomnet.ru) Received: from news1.macomnet.ru (news1.macomnet.ru [195.128.64.14]) by relay1.macomnet.ru (8.11.6/8.11.6) with ESMTP id g8CGILO980711 for ; Thu, 12 Sep 2002 20:18:22 +0400 (MSD) Date: Thu, 12 Sep 2002 20:18:21 +0400 (MSD) From: Maxim Konovalov To: freebsd-net@freebsd.org Subject: ip reassembling patch Message-ID: <20020912194517.K2218-100000@news1.macomnet.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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