---
 src/tethering.c |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/tethering.c b/src/tethering.c
index c1a10ee..8940528 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -329,6 +329,12 @@ static void disable_nat(const char *interface)
        __connman_iptables_commit("nat");
 }
 
+static void tethering_restart(void *user_data)
+{
+       __connman_tethering_set_disabled();
+       __connman_tethering_set_enabled();
+}
+
 void __connman_tethering_set_enabled(void)
 {
        int err;
@@ -348,7 +354,8 @@ void __connman_tethering_set_enabled(void)
                        return;
 
                dhcp_pool = __connman_ippool_create(BRIDGE_NAME, 100, 100,
-                                                       NULL, NULL, &gateway,
+                                                       tethering_restart,
+                                                       NULL, &gateway,
                                                        &broadcast, &start_ip,
                                                        &end_ip, &subnet,
                                                        &err);
@@ -526,6 +533,15 @@ static void owner_disconnect(DBusConnection *connection, 
void *user_data)
        g_hash_table_remove(pn_hash, pn->path);
 }
 
+static void ippool_disconnect(void *user_data)
+{
+       struct connman_private_network *pn = user_data;
+
+       DBG("block used externally");
+
+       g_hash_table_remove(pn_hash, pn->path);
+}
+
 int __connman_private_network_request(DBusMessage *msg, const char *owner)
 {
        struct connman_private_network *pn;
@@ -577,9 +593,10 @@ int __connman_private_network_request(DBusMessage *msg, 
const char *owner)
        pn->fd = fd;
        pn->interface = iface;
        pn->index = index;
-       pn->pool = __connman_ippool_create(iface, 1, 0, NULL, NULL, NULL, NULL,
-                                               &pn->server_ip, &pn->peer_ip,
-                                               &pn->subnet_mask, &err);
+       pn->pool = __connman_ippool_create(iface, 1, 0, ippool_disconnect, pn,
+                                               NULL, NULL, &pn->server_ip,
+                                               &pn->peer_ip, &pn->subnet_mask,
+                                               &err);
        if (pn->pool == NULL)
                goto error;
 
-- 
1.7.1

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to