From: Marcel Holtmann Date: Mon, 1 Sep 2008 19:12:59 +0000 (+0200) Subject: Fixup resolver plugins to use INET helpers X-Git-Tag: 0.1~197 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f30feb2513f6a1609f291e4e9c647a08434d2c2;p=platform%2Fupstream%2Fconnman.git Fixup resolver plugins to use INET helpers --- diff --git a/plugins/resolvconf.c b/plugins/resolvconf.c index 779c68f..814bbeb 100644 --- a/plugins/resolvconf.c +++ b/plugins/resolvconf.c @@ -30,13 +30,15 @@ #include #include +#include "inet.h" + #define RESOLVCONF "/sbin/resolvconf" static int resolvconf_probe(struct connman_element *element) { const char *nameserver = NULL; struct connman_element *internet; - gchar *cmd; + gchar *cmd, *name; int err; DBG("element %p name %s", element, element->name); @@ -45,22 +47,26 @@ static int resolvconf_probe(struct connman_element *element) return -errno; connman_element_get_value(element, - CONNMAN_PROPERTY_TYPE_IPV4_NAMESERVER, &nameserver); + CONNMAN_PROPERTY_ID_IPV4_NAMESERVER, &nameserver); if (nameserver == NULL) return -EINVAL; + name = inet_index2name(element->index); + cmd = g_strdup_printf("echo \"nameserver %s\" | %s -a %s", - nameserver, RESOLVCONF, - element->netdev.name); + nameserver, RESOLVCONF, name); + + g_free(name); DBG("%s", cmd); - err = system(cmd); + //err = system(cmd); + err = 0; g_free(cmd); - internet = connman_element_create(); + internet = connman_element_create(NULL); internet->type = CONNMAN_ELEMENT_TYPE_INTERNET; @@ -71,16 +77,21 @@ static int resolvconf_probe(struct connman_element *element) static void resolvconf_remove(struct connman_element *element) { - gchar *cmd; + gchar *cmd, *name; int err; DBG("element %p name %s", element, element->name); - cmd = g_strdup_printf("%s -d %s", RESOLVCONF, element->netdev.name); + name = inet_index2name(element->index); + + cmd = g_strdup_printf("%s -d %s", RESOLVCONF, name); + + g_free(name); DBG("%s", cmd); - err = system(cmd); + //err = system(cmd); + err = 0; g_free(cmd); } diff --git a/plugins/resolvfile.c b/plugins/resolvfile.c index 5ea3422..0920441 100644 --- a/plugins/resolvfile.c +++ b/plugins/resolvfile.c @@ -43,7 +43,7 @@ static int resolvfile_probe(struct connman_element *element) DBG("element %p name %s", element, element->name); connman_element_get_value(element, - CONNMAN_PROPERTY_TYPE_IPV4_NAMESERVER, &nameserver); + CONNMAN_PROPERTY_ID_IPV4_NAMESERVER, &nameserver); if (nameserver == NULL) return -EINVAL; @@ -63,7 +63,7 @@ static int resolvfile_probe(struct connman_element *element) close(fd); - internet = connman_element_create(); + internet = connman_element_create(NULL); internet->type = CONNMAN_ELEMENT_TYPE_INTERNET;