- Type: Service type. We currently only support wifi and ethernet.
- IPv4: The IPv4 address, netmask and gateway. Format of the entry
is network/netmask/gateway. The mask length can be used instead
- of netmask.
+ of netmask. The field can also contain the string "off" or "dhcp".
+ If the setting is "off", then no IPv4 address is set to the interface.
+ If the setting is "dhcp", then DHCPv4 address resolution is activated.
Example: 192.168.1.2/24/192.168.1.1
192.168.200.100/255.255.255.0/192.168.200.1
- IPv6: The IPv6 address, prefix length and gateway. Format of the entry
is network/prefixlen/gateway. For IPv6 addresses only prefix length is
- accepted.
+ accepted. The field can also contain the string "off" or "auto".
+ If the setting is "off", then no IPv6 address is set to the interface.
+ If the setting is "auto", then SLAAC or DHCPv6 is used.
Example: 2001:db8::2/64/2001:db8::1
- IPv6.Privacy: IPv6 privacy option. Value can be either "disabled",
"enabled" or "prefered". See use_tempaddr variable description in Linux
return err;
}
+static connman_bool_t check_address(char *address_str, char **address)
+{
+ if (g_ascii_strcasecmp(address_str, "auto") == 0 ||
+ g_ascii_strcasecmp(address_str, "dhcp") == 0 ||
+ g_ascii_strcasecmp(address_str, "off") == 0) {
+ *address = address_str;
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static connman_bool_t load_service_generic(GKeyFile *keyfile,
const char *group, struct connman_config *config,
struct connman_config_service *service)
gsize length;
str = g_key_file_get_string(keyfile, group, SERVICE_KEY_IPv4, NULL);
- if (str != NULL) {
+ if (str != NULL && check_address(str, &service->ipv4_address) == TRUE) {
mask = NULL;
if (parse_address(str, AF_INET, &service->ipv4_address,
}
str = g_key_file_get_string(keyfile, group, SERVICE_KEY_IPv6, NULL);
- if (str != NULL) {
+ if (str != NULL && check_address(str, &service->ipv6_address) == TRUE) {
long int value;
char *ptr;
return;
}
- if (config->ipv6_address != NULL) {
+ if (config->ipv6_address == NULL) {
+ connman_network_set_ipv6_method(network,
+ CONNMAN_IPCONFIG_METHOD_AUTO);
+ } else if (g_ascii_strcasecmp(config->ipv6_address, "off") == 0) {
+ connman_network_set_ipv6_method(network,
+ CONNMAN_IPCONFIG_METHOD_OFF);
+ } else if (g_ascii_strcasecmp(config->ipv6_address, "auto") == 0 ||
+ g_ascii_strcasecmp(config->ipv6_address, "dhcp") == 0) {
+ connman_network_set_ipv6_method(network,
+ CONNMAN_IPCONFIG_METHOD_AUTO);
+ } else {
struct connman_ipaddress *address;
if (config->ipv6_prefix_length == 0 ||
config->ipv6_privacy);
}
- if (config->ipv4_address != NULL) {
+ if (config->ipv4_address == NULL) {
+ connman_network_set_ipv4_method(network,
+ CONNMAN_IPCONFIG_METHOD_DHCP);
+ } else if (g_ascii_strcasecmp(config->ipv4_address, "off") == 0) {
+ connman_network_set_ipv4_method(network,
+ CONNMAN_IPCONFIG_METHOD_OFF);
+ } else if (g_ascii_strcasecmp(config->ipv4_address, "auto") == 0 ||
+ g_ascii_strcasecmp(config->ipv4_address, "dhcp") == 0) {
+ connman_network_set_ipv4_method(network,
+ CONNMAN_IPCONFIG_METHOD_DHCP);
+ } else {
struct connman_ipaddress *address;
if (config->ipv4_netmask == 0 ||