Hi:
I am using a FreeBSD 4.2-RELEASE box with the last KAME code.
I am trying to parse any hop-by-hop option, by my code only parse the
IPv6 Routing Header, it can not receive any hop-by-hop option.
If I execute "tcpdump ip6" in the receiver machine, it show me that I
have
sending/receiving correct hop-by-hop option packets:
19:59:25.537828 3ffe:3328:1:1f::101 > 3ffe:3328:1:1f:2c0:26ff:fe70:1358:
[|HBH]1061 > commplex-main: udp 1024
19:59:26.538007 3ffe:3328:1:1f::101 > 3ffe:3328:1:1f:2c0:26ff:fe70:1358:
[|HBH]1061 > commplex-main: udp 1024
19:59:27.538634 3ffe:3328:1:1f::101 > 3ffe:3328:1:1f:2c0:26ff:fe70:1358:
[|HBH]1061 > commplex-main: udp 1024
19:59:28.538271 3ffe:3328:1:1f::101 > 3ffe:3328:1:1f:2c0:26ff:fe70:1358:
[|HBH]1061 > commplex-main: udp 1024
19:59:29.537900 3ffe:3328:1:1f::101 > 3ffe:3328:1:1f:2c0:26ff:fe70:1358:
[|HBH]1061 > commplex-main: udp 1024
^^^^^^^^
So something in my code is wrong, but I can not see it. I am running the
programs like root.
If I try to use gdb, the trace show me that it never get in the
following "if":
if( (cmsg_ptr->cmsg_level == IPPROTO_IPV6) && (cmsg_ptr->cmsg_type ==
IPV6_HOPOPTS) )
(___see the complete code below___)
ANOTHER THING RELATED:
I dont understand the following pharagraf extacted from
draft-ietf-ipngwg-rfc2292bis-02.txt
10.5. inet6_opt_next
int inet6_opt_next(void *extbuf, size_t extlen, int prevlen,
uint8_t *typep, size_t *lenp,
void **databufp);
This function parses received option extension headers returning the
next option. Extbuf and extlen specifies the extension header.
...bla...bla...bla
OK. What is extbuf ? is it a pointer to struct cmsghdr ? => then, the
extlen is cmsghdr->cmsg_len, is not it ?
Following I presents my function, I appreciate if someone could tell me
some feedback,
or find out errors.
Best Regards.
void RecvAncillaryData( struct msghdr *msg )
{
int current;
struct
{
uint8_t type;
uint8_t len;
uint8_t value[256];
} ptr_option;
uint8_t *ptr= NULL;
struct cmsghdr *cmsg_ptr;
char aux[INET6_ADDRSTRLEN];
/* scan the Ancillary Data Objects... */
for (cmsg_ptr = CMSG_FIRSTHDR(msg); cmsg_ptr != NULL; cmsg_ptr =
CMSG_NXTHDR(msg, cmsg_ptr))
{
/* Parse an IPv6 Routing Header */
if( (cmsg_ptr->cmsg_level == IPPROTO_IPV6) && (cmsg_ptr->cmsg_type
== IPV6_RTHDR) )
{
ptr = CMSG_DATA(cmsg_ptr);
/* process data pointed to by ptr */
write_routing_header( (struct ip6_rthdr0 *)ptr );
}
/* Parse a Hop-by-Hop Options */
if( (cmsg_ptr->cmsg_level == IPPROTO_IPV6) && (cmsg_ptr->cmsg_type
== IPV6_HOPOPTS) )
{
/* FreeBSD use the draft draft-ietf-ipngwg-rfc2292bis-02.txt,
which has
a behaviour different, using inet6_opt_next() in replace of
inet6_option_next() */
current= 0;
while( (current= inet6_opt_next( cmsg_ptr, cmsg_ptr->cmsg_len,
current,
&ptr_option.type, (int *)&ptr_option.len,
(void **)&ptr_option.value)) >= 0 )
{
if(ptr_option.type == IP6OPT_ROUTER_ALERT )
write_router_alert_option( (struct ip6_opt_router
*)&ptr_option );
else
if (ptr_option.type == IP6OPT_JUMBO)
write_jumbo_payload_option( (struct ip6_opt_jumbo
*)&ptr_option );
else
if (ptr_option.type == IP6OPT_HOME_ADDRESS)
write_home_address_option( (struct
ip6_opt_home_address *)&ptr_option );
} /* end while */
} /*end for*/
} /* end function */
---------------------------------------------------------------------
The IPv6 Users Mailing List
Unsubscribe by sending "unsubscribe users" to [EMAIL PROTECTED]