From: Guillaume Zajac <[email protected]>
---
src/tethering.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/tethering.c b/src/tethering.c
index 0c83797..aa55cb1 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -327,6 +327,12 @@ static void disable_nat(const char *interface)
__connman_iptables_commit("nat");
}
+static void tethering_restart(struct connman_ippool *pool, void *user_data)
+{
+ __connman_tethering_set_disabled();
+ __connman_tethering_set_enabled();
+}
+
void __connman_tethering_set_enabled(void)
{
int err;
@@ -346,7 +352,8 @@ void __connman_tethering_set_enabled(void)
if (err < 0)
return;
- dhcp_ippool = __connman_ippool_create(1, 253, NULL, NULL);
+ dhcp_ippool = __connman_ippool_create(1, 253,
+ tethering_restart, NULL);
if (dhcp_ippool == NULL) {
connman_error("Fail to create IP pool");
return;
@@ -532,6 +539,15 @@ static void owner_disconnect(DBusConnection *connection,
void *user_data)
g_hash_table_remove(pn_hash, pn->path);
}
+static void ippool_disconnect(struct connman_ippool *pool, 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;
@@ -583,7 +599,7 @@ int __connman_private_network_request(DBusMessage *msg,
const char *owner)
pn->fd = fd;
pn->interface = iface;
pn->index = index;
- pn->pool = __connman_ippool_create(1, 1, NULL, NULL);
+ pn->pool = __connman_ippool_create(1, 1, ippool_disconnect, pn);
if (pn->pool == NULL) {
errno = -ENOMEM;
goto error;
--
1.7.8.2.325.g247f9
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman