From owner-freebsd-net Mon Mar 3 5: 3:27 2003 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 8E79E37B401 for ; Mon, 3 Mar 2003 05:03:21 -0800 (PST) Received: from mx1.dev.itouchnet.net (devco.net [196.15.188.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEC7443FAF for ; Mon, 3 Mar 2003 05:03:17 -0800 (PST) (envelope-from bvi@itouchlabs.com) Received: from nobody by mx1.dev.itouchnet.net with scanned_ok (Exim 3.35 #1) id 18ppbv-000HgW-00 for net@freebsd.org; Mon, 03 Mar 2003 15:04:03 +0200 Received: from devco.net ([196.15.188.2] helo=Beastie) by mx1.dev.itouchnet.net with esmtp (Exim 3.35 #1) id 18ppbu-000HgN-00; Mon, 03 Mar 2003 15:04:02 +0200 Message-ID: <004001c2e184$bfcb4e60$4508a8c0@Beastie> From: "Barry Irwin" To: , "Audsin" References: <5.2.0.9.0.20030303115628.00ad6d48@pop2.kcl.ac.uk> Subject: Re: Fragmentation Avoidance Code Date: Mon, 3 Mar 2003 14:59:34 +0200 Organization: iTouch Labs MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Checked: This message has been scanned for any virusses and unauthorized attachments. X-iScan-ID: 67978-1046696643-24023@unconfigured version $Name: REL_2_0_4 $ 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 Hi While I cant really comment on your code as such, another place this kind of action would be useful would be for IPSEC processing. More often than not, the IPSEC headder bumps the packet size over the limit and so fragmentation occurs, particularly where the IPSEC is being handled by a gatewway box. Barry -- Barry Irwin bvi@itouchlabs.com Tel: +27214875178 Systems Administrator: Networks And Security iTouch TAS http://www.itouchlabs.com Mobile: +27824457210 ----- Original Message ----- From: "Audsin" To: Sent: Monday, March 03, 2003 1:57 PM Subject: Fragmentation Avoidance Code > Respected Sir > > I am currently working in the fragmentation avoidance technique caused by > the overhead introduced by MIP6. I am using FreeBSD 4.4 and Kame Snap. > I have introduced some code in netinet6/ip6_output.c code and > netinet6/in6_pcb.h and netinet/in_pcb.h so that length of the MIP6 > extension header if present is taken into account, when calculation the > ipoptlen() and hence frag is avoided. Below i am pasting the code to which > i have made changes. The lines starting with @ symbol shows the code > introduced by me. Please go thru the code and let me know whether this > takes account of the Extension header length introduced by MIP6. Since, > this is my first research project, i kindly request you to go thru the code > and help me. > I have explained my code under the heading "Implementation" in the last ie. > after the codes > > > Please let me know, whether this code will take into account the length > occupied by MIP6 Ext header. If any changes is required pls let me know. > > Thanks and sorry for the disturbance > > Code > ----- > > netinet6/in6_pcb.h and netinet/in_pcb.h > --------------------------------------- > > @ #ifdef MIP6 > @ #include > @ #include > @ #include > @ #include > @ #endif /* MIP6 */ > > . > . > . > > struct in6pcb ( > . > . > . > struct ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */ > > @ #ifdef MIP6 > @ struct mip6_pktopts *mip6_outputopts /* MIP6 options for outgoing > packets */ > @ #endif > . > . > . > > ); > > > > netinet6/ip6_output.c > ---------------------- > > In the last part of netinet6/ip6_output.c I have changed the code and > pasted it under Modified code > > > Modified Code: > ----------------- > > > /* > * Compute IPv6 and MIP6 extension header length. > */ > #ifdef HAVE_NRL_INPCB > # define in6pcb inpcb > # define in6p_outputopts inp_outputopts6 > #endif > int > ip6_optlen(in6p) > struct in6pcb *in6p; > { > int len; > > @ if (!(in6p->in6p_outputopts || > @ #ifdef MIP6 > @ in6p->mip6_outputopts > @ #endif > @ )) > @ return 0; > > len = 0; > #define elen(x) \ > (((struct ip6_ext *)(x)) ? (((struct ip6_ext *)(x))->ip6e_len + 1) << > 3 : 0) > > len += elen(in6p->in6p_outputopts->ip6po_hbh); > if (in6p->in6p_outputopts->ip6po_rthdr) > /* dest1 is valid with rthdr only */ > len += elen(in6p->in6p_outputopts->ip6po_dest1); > len += elen(in6p->in6p_outputopts->ip6po_rthdr); > len += elen(in6p->in6p_outputopts->ip6po_dest2); > > @ #ifdef MIP6 > > @ len += elen(in6p->mip6_outputopts->mip6po_rthdr);/* MIP6 Routing Header */ > > @ len += elen(in6p->mip6_outputopts->mip6po_haddr);/* MIP6 Home Addr > Option */ > > @ len += elen(in6p->mip6_outputopts->mip6_dest2); /* MIP6 Dest2 Option */ > > @ #endif > return len; > #undef elen > } > #ifdef HAVE_NRL_INPCB > # undef in6pcb > # undef in6p_outputopts > #endif > > > > > Original netinet6/ip6_output.c kame Code > ------------------------------ > > /* > * Compute IPv6 extension header length. > */ > #ifdef HAVE_NRL_INPCB > # define in6pcb inpcb > # define in6p_outputopts inp_outputopts6 > #endif > int > ip6_optlen(in6p) > struct in6pcb *in6p; > { > int len; > > if (!in6p->in6p_outputopts) > return 0; > > len = 0; > #define elen(x) \ > (((struct ip6_ext *)(x)) ? (((struct ip6_ext *)(x))->ip6e_len + 1) << > 3 : 0) > > len += elen(in6p->in6p_outputopts->ip6po_hbh); > if (in6p->in6p_outputopts->ip6po_rthdr) > /* dest1 is valid with rthdr only */ > len += elen(in6p->in6p_outputopts->ip6po_dest1); > len += elen(in6p->in6p_outputopts->ip6po_rthdr); > len += elen(in6p->in6p_outputopts->ip6po_dest2); > return len; > #undef elen > } > #ifdef HAVE_NRL_INPCB > # undef in6pcb > # undef in6p_outputopts > #endif > > Implementation > ---------------- > > 1)netinet6/in6_pcb.h and netinet/in_pcb.h > > Create a pointer to struct mip6_pktopts, if MIP6 is defined and name the > pointer as *mip6_outputopts > > @ #ifdef MIP6 > @ struct mip6_pktopts *mip6_outputopts /* MIP6 options for outgoing > packets */ > @ #endif > > 2) netinet6/ip6_output.c > > Modify the code of macro elen(x) present in function ip6_optlen(in6p) in > netinet6/ip6_output.c such that it takes into account, the length occupied > by Mip6 Extension headers > > @ #ifdef MIP6 > > @ len += elen(in6p->mip6_outputopts->mip6po_rthdr);/* MIP6 Routing Header */ > > @ len += elen(in6p->mip6_outputopts->mip6po_haddr);/* MIP6 Home Addr > Option */ > > @ len += elen(in6p->mip6_outputopts->mip6_dest2); /* MIP6 Dest2 Option */ > > @ #endif > > > Regards > Dev > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message > > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message