Hi,
 
  I would like to add an option to the mobility header. However, when I came to function mh_try_pad in mh.c, I do not know what to add to it. May I know how did the values '2' and '0' in optpad(2,0,len) or '8' and '4' in optpad(8,4,len) came about? How did you determine the values?

static int mh_try_pad(const struct iovec *in, struct iovec *out, int count)

{

size_t len = 0;

int m, n = 1, pad = 0;

struct ip6_mh_opt *opt;

out[0].iov_len = in[0].iov_len;

out[0].iov_base = in[0].iov_base;

len += in[0].iov_len;

for (m = 1; m < count; m++) {

opt = (struct ip6_mh_opt *)in[m].iov_base;

switch (opt->ip6mhopt_type) {

case IP6_MHOPT_BREFRESH:

      pad = optpad(2, 0, len); /* 2n */

      break;

case IP6_MHOPT_ALTCOA:

     pad = optpad(8, 6, len); /* 8n+6 */

    break;

case IP6_MHOPT_NONCEID:

    pad = optpad(2, 0, len); /* 2n */

   break;

case IP6_MHOPT_BAUTH:

    pad = optpad(8, 2, len); /* 8n+2 */

    break;

case IP6_MHOPT_MOB_NET_PRFX:

    pad = optpad(8, 4, len); /* 8n+4 */

     break;

}

if (pad > 0) {

create_opt_pad(&out[n++], pad);

len += pad;

}

len += in[m].iov_len;

out[n].iov_len = in[m].iov_len;

out[n].iov_base = in[m].iov_base;

n++;

}

if (count == 1) {

pad = optpad(8, 0, len);

create_opt_pad(&out[n++], pad);

}

return n;

}

 

 

Thank you.

_______________________________________________
mipl mailing list
[email protected]
http://www.mobile-ipv6.org/cgi-bin/mailman/listinfo/mipl

Reply via email to