summaryrefslogtreecommitdiff
path: root/src/tethering.c
diff options
context:
space:
mode:
authorGuillaume Zajac <guillaume.zajac@linux.intel.com>2011-08-29 11:32:36 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2012-02-01 10:13:19 +0100
commit772c408e91c52c9feedec9c5bf8ba936ab13e5fe (patch)
treea30b9e88a720a0e86d64c392b2a800ceacb5bf43 /src/tethering.c
parent987c55eb3a6aaffe415ad782da21fa8cd605932d (diff)
downloadconnman-772c408e91c52c9feedec9c5bf8ba936ab13e5fe.tar.gz
connman-772c408e91c52c9feedec9c5bf8ba936ab13e5fe.tar.bz2
connman-772c408e91c52c9feedec9c5bf8ba936ab13e5fe.zip
tethering: Add notification callback implementation
Diffstat (limited to 'src/tethering.c')
-rw-r--r--src/tethering.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/tethering.c b/src/tethering.c
index 5c359dd4..b135b45a 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 index;
@@ -348,7 +354,8 @@ void __connman_tethering_set_enabled(void)
return;
index = connman_inet_ifindex(BRIDGE_NAME);
- dhcp_ippool = __connman_ippool_create(index, 1, 253, NULL, NULL);
+ dhcp_ippool = __connman_ippool_create(index, 1, 253,
+ tethering_restart, NULL);
if (dhcp_ippool == NULL) {
connman_error("Fail to create IP pool");
return;
@@ -534,6 +541,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;
@@ -585,7 +601,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(pn->fd, 1, 1, NULL, NULL);
+ pn->pool = __connman_ippool_create(pn->fd, 1, 1, ippool_disconnect, pn);
if (pn->pool == NULL) {
errno = -ENOMEM;
goto error;