From: Marcel Holtmann Date: Thu, 3 Jan 2008 06:48:25 +0000 (+0100) Subject: Add support for setting the nameserver using resolvconf X-Git-Tag: 2.0_alpha~4965 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a580c5a50681601db10786f327899b309879009;p=framework%2Fconnectivity%2Fconnman.git Add support for setting the nameserver using resolvconf --- diff --git a/src/iface.c b/src/iface.c index 5fc4eaf..53031f6 100644 --- a/src/iface.c +++ b/src/iface.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -153,6 +154,7 @@ int connman_iface_set_ipv4(struct connman_iface *iface, struct ifreq ifr; struct rtentry rt; struct sockaddr_in *addr; + char cmd[128]; int sk, err; if ((iface->flags & CONNMAN_IFACE_FLAG_RTNL) == 0) @@ -225,6 +227,13 @@ int connman_iface_set_ipv4(struct connman_iface *iface, return -1; } + sprintf(cmd, "echo \"nameserver %s\" | resolvconf -a %s", + inet_ntoa(ipv4->nameserver), ifr.ifr_name); + + DBG("%s", cmd); + + system(cmd); + return 0; } @@ -232,6 +241,7 @@ int connman_iface_clear_ipv4(struct connman_iface *iface) { struct ifreq ifr; struct sockaddr_in *addr; + char cmd[128]; int sk, err; if ((iface->flags & CONNMAN_IFACE_FLAG_RTNL) == 0) @@ -267,6 +277,12 @@ int connman_iface_clear_ipv4(struct connman_iface *iface) return -1; } + sprintf(cmd, "resolvconf -d %s", ifr.ifr_name); + + DBG("%s", cmd); + + system(cmd); + return 0; }