tethering: Use tether device IP as tethering DNS server
authorYu A Wang <yu.a.wang@intel.com>
Thu, 21 Apr 2011 07:26:15 +0000 (03:26 -0400)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 27 Apr 2011 08:33:35 +0000 (10:33 +0200)
src/tethering.c

index 3e4750d2be6de7f0a8e292e80f51cada80a1c6dd..f7732c99ac2bdf5e2cb7a280a2adb1106d4177df 100644 (file)
@@ -344,11 +344,15 @@ void __connman_tethering_set_enabled(void)
                        return;
                }
 
+               if (__connman_dnsproxy_add_listener(BRIDGE_NAME) < 0)
+                       connman_error("Can't add listener %s to DNS proxy",
+                                                               BRIDGE_NAME);
+
                tethering_dhcp_server =
                        dhcp_server_start(BRIDGE_NAME,
                                                BRIDGE_IP, BRIDGE_SUBNET,
                                                BRIDGE_IP_START, BRIDGE_IP_END,
-                                                       24 * 3600, BRIDGE_DNS);
+                                                       24 * 3600, BRIDGE_IP);
                if (tethering_dhcp_server == NULL) {
                        disable_bridge(BRIDGE_NAME);
                        remove_bridge(BRIDGE_NAME);
@@ -365,6 +369,8 @@ void __connman_tethering_set_disabled(void)
 {
        DBG("enabled %d", tethering_enabled - 1);
 
+       __connman_dnsproxy_remove_listener(BRIDGE_NAME);
+
        if (g_atomic_int_dec_and_test(&tethering_enabled) == TRUE) {
                disable_nat(default_interface);