Hi Martin,
> doc/service-api.txt | 36 ++++++
> include/element.h | 7 ++
> include/ipconfig.h | 12 ++-
> include/property.h | 4 +
> src/connection.c | 63 +++++++----
> src/connman.h | 13 ++-
> src/element.c | 7 ++
> src/inet.c | 273 +++++++++++++++++++++++++++++++++++++++++++++++
> src/ipconfig.c | 283
> ++++++++++++++++++++++++++++++++++++++++++++++---
> src/ipv4.c | 13 ++-
> src/network.c | 75 +++++++++++++-
> src/service.c | 120 +++++++++++++++++++--
> test/set-ipv6-address | 29 +++++
> 13 files changed, 880 insertions(+), 55 deletions(-)
> create mode 100755 test/set-ipv6-address
>
> diff --git a/doc/service-api.txt b/doc/service-api.txt
> index a3e3c10..774c72b 100644
> --- a/doc/service-api.txt
> +++ b/doc/service-api.txt
> @@ -353,6 +353,42 @@ Properties string State [readonly]
> until the new configuration has been successfully
> installed.
>
> + dict IPv6 [readonly]
> +
> + string Method [readonly]
> +
> + Possible values are "dhcp", "manual"
> + and "off".
> +
> + The value "fixed" indicates an IP address
> + that can not be modified. For example
> + cellular networks return fixed information.
> +
> + "dhcp" is not supported currently.
> +
> + string Address [readonly]
> +
> + The current configured IPv6 address.
> +
> + string PrefixLength [readonly]
> +
> + The prefix length of the IPv6 address.
the range of PrefixLength is 0-128 if I am not mistaken, so this should
be actually from type byte instead of string.
> diff --git a/include/property.h b/include/property.h
> index c7f2a7b..faf9462 100644
> --- a/include/property.h
> +++ b/include/property.h
> @@ -48,6 +48,10 @@ enum connman_property_id {
> CONNMAN_PROPERTY_ID_IPV4_NAMESERVER,
> CONNMAN_PROPERTY_ID_IPV4_TIMESERVER,
> CONNMAN_PROPERTY_ID_IPV4_PAC,
> +
> + CONNMAN_PROPERTY_ID_IPV6_METHOD,
> + CONNMAN_PROPERTY_ID_IPV6_ADDRESS,
> + CONNMAN_PROPERTY_ID_IPV6_GATEWAY,
> };
Why is the PREFIXLEN here missing?
> @@ -53,11 +54,12 @@ static struct gateway_data *find_gateway(int index, const
> char *gateway)
> for (list = gateway_list; list; list = list->next) {
> struct gateway_data *data = list->data;
>
> - if (data->gateway == NULL)
> + if (data->ipv4_gateway == NULL)
> continue;
>
> if (data->index == index &&
> - g_str_equal(data->gateway, gateway) == TRUE)
> + g_str_equal(data->ipv4_gateway,
> + gateway) == TRUE)
> return data;
> }
For a cleaner commit history I would propose that you make one patch
that changes gateway into ipv4_gateway. That takes the clutter out of
the IPv6 patch and we can apply it right away.
> -void connman_ipaddress_set(struct connman_ipaddress *ipaddress,
> +static gboolean check_ipv6_address(const char *address)
> +{
> + char *c;
> +
> + if (address == NULL)
> + return FALSE;
> +
> + c = strchr(address, ':');
> +
> + if (c == NULL)
> + return FALSE;
> +
> + return TRUE;
> +}
Would be using something like inet_pton() etc. are better choice for
address conversion and testing if they are valid? The man pages have
some nice example as well.
> +static gboolean check_ipv6_gateway(const char *gateway)
> +{
> + char *c;
> + unsigned char prefix_len;
> +
> + if (gateway == NULL)
> + return FALSE;
> +
> + c = strchr(gateway, ':');
> + if (c == NULL)
> + return FALSE;
> +
> + c = strchr(gateway, '/');
> + if (c == NULL)
> + return FALSE;
> +
> + prefix_len = atol(c + 1);
> + if ((prefix_len < 0) || (prefix_len > 128))
> + return FALSE;
> +
> + return TRUE;
> +}
What is the prefix length check for the gateway good for? Why do have to
have that for the gateway?
Regards
Marcel
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman