IPv6 Destination Option Header options problem

Colin O'Keeffe cokeeffe at gmail.com
Sat Aug 18 16:00:29 UTC 2012


Hi,

As part of a research task, I'm trying to add additional options to a
ip6_dest header. I've taken the code for the jumbo option header
(ip6_output.c line 1254) and modified that to take one value (a
u_int32). I can send and receive this header, with this value no
problem.

The problem I'm having is adding a second option into the extension
header. Can anyone guide me into what I'm doing wrong?

I've tried the following

u_int32_t myfirstvalue;
u_int32_t mysecondvalue;
.
.
.
 optbuf[2] = IP6OPT_MYOPTA; //defined as 0x15 in ip6.h
 optbuf[3] = 4;
 v = (u_int32_t)htonl(myfirstvalue);
 bcopy(&v, &optbuf[4], sizeof(u_int32_t));


 optbuf5] = IP6OPT_MYOPTB; //defined as 0x16 in ip6.h
 optbuf[6] = 4;
 v = (u_int32_t)htonl(mysecondvalue);
 bcopy(&v, &optbuf[7], sizeof(u_int32_t));

The receiving host detects the IP6OPT_MYOPTA and prints the value out
correctly, but it does not detect the second option or value. I'm
guessing it has something to do with padding and alignment in the
extension header?

thanks


More information about the freebsd-net mailing list