CONNMAN_PROPERTY_TYPE_IPV4_ADDRESS,
CONNMAN_PROPERTY_TYPE_IPV4_NETMASK,
CONNMAN_PROPERTY_TYPE_IPV4_GATEWAY,
+ CONNMAN_PROPERTY_TYPE_IPV4_NAMESERVER,
};
enum connman_property_flags {
task->child = connman_element_create();
task->child->type = CONNMAN_ELEMENT_TYPE_IPV4;
task->child->netdev.index = task->ifindex;
+ task->child->netdev.name = g_strdup(task->ifname);
connman_element_update(task->element);
connman_element_register(task->child, task->element);
} else if (g_ascii_strcasecmp(text, "RENEW") == 0 ||
static int ipv4_probe(struct connman_element *element)
{
+ struct connman_element *resolver;
const char *address = NULL, *netmask = NULL, *gateway = NULL;
DBG("element %p name %s", element, element->name);
DBG("netmask %s", netmask);
DBG("gateway %s", gateway);
+ resolver = connman_element_create();
+
+ resolver->type = CONNMAN_ELEMENT_TYPE_RESOLVER;
+ resolver->netdev.name = g_strdup(element->netdev.name);
+
+ connman_element_register(resolver, element);
+
+ connman_element_set_data(element, resolver);
+
return 0;
}
static void ipv4_remove(struct connman_element *element)
{
+ struct connman_element *resolver = connman_element_get_data(element);
+
DBG("element %p name %s", element, element->name);
+
+ connman_element_set_data(element, NULL);
+
+ connman_element_unregister(resolver);
+
+ connman_element_unref(resolver);
}
static struct connman_driver ipv4_driver = {
static int resolvconf_probe(struct connman_element *element)
{
+ const char *nameserver = NULL;
gchar *cmd;
//int err;
DBG("element %p name %s", element, element->name);
+ connman_element_get_value(element,
+ CONNMAN_PROPERTY_TYPE_IPV4_NAMESERVER, &nameserver);
+
+ if (nameserver == NULL)
+ return -EINVAL;
+
cmd = g_strdup_printf("echo \"nameserver %s\" | resolvconf -a %s",
- "127.0.0.1", element->netdev.name);
+ nameserver, element->netdev.name);
DBG("%s", cmd);
g_free(element->ipv4.gateway);
element->ipv4.gateway = g_strdup(*((const char **) value));
break;
+ case CONNMAN_PROPERTY_TYPE_IPV4_NAMESERVER:
+ g_free(element->ipv4.nameserver);
+ element->ipv4.nameserver = g_strdup(*((const char **) value));
+ break;
}
g_dbus_emit_signal(connection, CONNMAN_MANAGER_PATH,
type, value);
*((char **) value) = element->ipv4.gateway;
break;
+ case CONNMAN_PROPERTY_TYPE_IPV4_NAMESERVER:
+ if (element->ipv4.nameserver == NULL)
+ return connman_element_get_value(element->parent,
+ type, value);
+ *((char **) value) = element->ipv4.nameserver;
+ break;
}
return 0;
case CONNMAN_ELEMENT_TYPE_ZEROCONF:
element->name = g_strdup("zeroconf");
break;
+ case CONNMAN_ELEMENT_TYPE_RESOLVER:
+ element->name = g_strdup("resolver");
+ break;
default:
break;
}