From owner-freebsd-mobile Mon Mar 3 6: 8: 8 2003 Delivered-To: freebsd-mobile@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A184E37B401 for ; Mon, 3 Mar 2003 06:08:03 -0800 (PST) Received: from angelo.kcl.ac.uk (angelo.kcl.ac.uk [137.73.66.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6AC1543FBD for ; Mon, 3 Mar 2003 06:08:02 -0800 (PST) (envelope-from dev.dhas@kcl.ac.uk) Received: from ctr-Dev.kcl.ac.uk (EE077.eee.kcl.ac.uk [137.73.10.124]) by angelo.kcl.ac.uk with ESMTP id h23DVIvX008564 for ; Mon, 3 Mar 2003 13:31:24 GMT Message-Id: <5.2.0.9.0.20030303133828.00ace4e8@pop2.kcl.ac.uk> X-Sender: kkqd2740@pop2.kcl.ac.uk X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Mon, 03 Mar 2003 13:39:40 +0000 To: freebsd-mobile@freebsd.org From: Audsin Subject: Fragmentation Avoidance Code Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-MailScanner: Found to be clean Sender: owner-freebsd-mobile@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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-mobile" in the body of the message