diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-01-05 13:38:06 +0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-01-05 13:17:26 +0100 |
commit | 931367f3c9574b7fc473fdce23627f4108cfb90d (patch) | |
tree | 90c62e5e7f979206d0501d44cbf865816d4a3e37 /src | |
parent | 19e8effd134678d9467e328090717b10cef0c208 (diff) | |
download | connman-931367f3c9574b7fc473fdce23627f4108cfb90d.tar.gz connman-931367f3c9574b7fc473fdce23627f4108cfb90d.tar.bz2 connman-931367f3c9574b7fc473fdce23627f4108cfb90d.zip |
inet: Return router advertisement packet length in callback.
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/6to4.c | 5 | ||||
-rw-r--r-- | src/connman.h | 2 | ||||
-rw-r--r-- | src/inet.c | 8 | ||||
-rw-r--r-- | src/network.c | 3 |
4 files changed, 11 insertions, 7 deletions
@@ -449,12 +449,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 ae242174..e42cbe11 100644 --- a/src/connman.h +++ b/src/connman.h @@ -137,7 +137,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); @@ -1456,7 +1456,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); @@ -1488,16 +1488,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 %zd hdr %zd", 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 6dee555b..e2266d01 100644 --- a/src/network.c +++ b/src/network.c @@ -982,7 +982,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; |