The length of the RA packet must be returned in callback, otherwise callback cannot check RA options. The prefix length RA option is needed in stateful DHCPv6 implementation. --- src/6to4.c | 5 +++-- src/connman.h | 2 +- src/inet.c | 8 +++++--- src/network.c | 3 ++- 4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/6to4.c b/src/6to4.c index 35540bf..9e8e5c8 100644 --- a/src/6to4.c +++ b/src/6to4.c @@ -445,12 +445,13 @@ error: return -1; } -static void receive_rs_reply(struct nd_router_advert *reply, void *user_data) +static void receive_rs_reply(struct nd_router_advert *reply, + unsigned int length, void *user_data) { char *address = user_data; struct in_addr ip4addr; - DBG("reply %p address %s", reply, address); + DBG("reply %p len %d address %s", reply, length, address); /* We try to create tunnel if autoconfiguration did not work i.e., * we did not receive any reply to router solicitation message. diff --git a/src/connman.h b/src/connman.h index 5e90cf6..97cd81b 100644 --- a/src/connman.h +++ b/src/connman.h @@ -133,7 +133,7 @@ int __connman_inet_modify_address(int cmd, int flags, int index, int family, #include <netinet/icmp6.h> typedef void (*__connman_inet_rs_cb_t) (struct nd_router_advert *reply, - void *user_data); + unsigned int length, void *user_data); int __connman_inet_ipv6_send_rs(int index, int timeout, __connman_inet_rs_cb_t callback, void *user_data); diff --git a/src/inet.c b/src/inet.c index 595f52d..ed8140d 100644 --- a/src/inet.c +++ b/src/inet.c @@ -1449,7 +1449,7 @@ static gboolean rs_timeout_cb(gpointer user_data) return FALSE; if (data->callback != NULL) - data->callback(NULL, data->user_data); + data->callback(NULL, 0, data->user_data); data->rs_timeout = 0; rs_cleanup(data); @@ -1481,16 +1481,18 @@ static int icmpv6_recv(int fd, gpointer user_data) len = recvmsg(fd, &mhdr, 0); if (len < 0) { - data->callback(NULL, data->user_data); + data->callback(NULL, 0, data->user_data); rs_cleanup(data); return -errno; } hdr = (struct nd_router_advert *)buf; + DBG("code %d len %d hdr %d", hdr->nd_ra_code, len, + sizeof(struct nd_router_advert)); if (hdr->nd_ra_code != 0) return 0; - data->callback(hdr, data->user_data); + data->callback(hdr, len, data->user_data); rs_cleanup(data); return len; diff --git a/src/network.c b/src/network.c index 8ad1ee5..7f25f3e 100644 --- a/src/network.c +++ b/src/network.c @@ -990,7 +990,8 @@ static void dhcpv6_info_callback(struct connman_network *network, stop_dhcpv6(network); } -static void check_dhcpv6(struct nd_router_advert *reply, void *user_data) +static void check_dhcpv6(struct nd_router_advert *reply, + unsigned int length, void *user_data) { struct connman_network *network = user_data; -- 1.7.1 _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman