summaryrefslogtreecommitdiff
path: root/src/tethering.c
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-21 16:25:11 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-11-22 13:23:56 +0200
commit99e49dd2add20aecafe79b24effb4b87353449f9 (patch)
tree921fa679315338259ce489bb03c96ccd172aa476 /src/tethering.c
parent86f21518b2ad016df155610524d9fc3f72018861 (diff)
downloadconnman-99e49dd2add20aecafe79b24effb4b87353449f9.tar.gz
connman-99e49dd2add20aecafe79b24effb4b87353449f9.tar.bz2
connman-99e49dd2add20aecafe79b24effb4b87353449f9.zip
core: Use interface index instead of interface name
Service and network code use only interface indexes. Convert the rest of the code using interface names to use interface indexes instead. The files affected are: include/resolver.h src/connman.h src/dnsproxy.c src/resolver.c src/rtnl.c src/service.c src/tethering.c As the network and service code used interface indexes, the interface name had to be looked up via a SIOCGIFNAME ioctl when needed. If a service was removed due to the interface and network being taken down, the lookup wouldn't work. This caused DNS servers to be left behind with broken sockets since removing the DNS servers was done using the interface name.
Diffstat (limited to 'src/tethering.c')
-rw-r--r--src/tethering.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tethering.c b/src/tethering.c
index f3d67dfa..b9df21b3 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -228,7 +228,7 @@ void __connman_tethering_set_enabled(void)
}
dns = gateway;
- if (__connman_dnsproxy_add_listener(BRIDGE_NAME) < 0) {
+ if (__connman_dnsproxy_add_listener(index) < 0) {
connman_error("Can't add listener %s to DNS proxy",
BRIDGE_NAME);
dns = BRIDGE_DNS;
@@ -255,9 +255,12 @@ void __connman_tethering_set_enabled(void)
void __connman_tethering_set_disabled(void)
{
+ int index;
+
DBG("enabled %d", tethering_enabled - 1);
- __connman_dnsproxy_remove_listener(BRIDGE_NAME);
+ index = connman_inet_ifindex(BRIDGE_NAME);
+ __connman_dnsproxy_remove_listener(index);
if (__sync_fetch_and_sub(&tethering_enabled, 1) != 1)
return;