Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 03 Mar 2003 13:39:40 +0000
From:      Audsin <dev.dhas@kcl.ac.uk>
To:        freebsd-mobile@freebsd.org
Subject:   Fragmentation Avoidance Code
Message-ID:  <5.2.0.9.0.20030303133828.00ace4e8@pop2.kcl.ac.uk>

next in thread | raw e-mail | index | archive | help
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 <sys/syslog.h>
  @  #include <net/if_hif.h>
  @  #include <netinet6/mip6_var.h>
  @  #include <netinet6/mip6.h>
  @  #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




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