some device want to support wifi open tethering network type
our ConnMan already supported, just not export the API, I also
not sure whether we force the user to use encrypied wifi network
for security consideration
---
src/technology.c | 18 +++++++++++++-----
test/enable-tethering | 7 +++++--
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/technology.c b/src/technology.c
index bf82b8d..d4382b8 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -216,9 +216,6 @@ static int set_tethering(struct connman_technology
*technology,
{
const char *ident, *passphrase, *bridge;
- ident = technology->tethering_ident;
- passphrase = technology->tethering_passphrase;
-
if (technology->driver == NULL ||
technology->driver->set_tethering == NULL)
return -EOPNOTSUPP;
@@ -227,12 +224,23 @@ static int set_tethering(struct connman_technology
*technology,
if (technology->enabled == FALSE)
return -EACCES;
+ /* Clear passphrase filed when disable wifi tethering,
+ * else if we once enabled encrypied wifi network,
+ * we may failed to enable open wifi network type
+ */
+ if (enabled == FALSE) {
+ g_free(technology->tethering_passphrase);
+ technology->tethering_passphrase = NULL;
+ }
+
+ ident = technology->tethering_ident;
+ passphrase = technology->tethering_passphrase;
+
bridge = __connman_tethering_get_bridge();
if (bridge == NULL)
return -EOPNOTSUPP;
- if (technology->type == CONNMAN_SERVICE_TYPE_WIFI &&
- (ident == NULL || passphrase == NULL))
+ if (technology->type == CONNMAN_SERVICE_TYPE_WIFI && ident == NULL)
return -EINVAL;
return technology->driver->set_tethering(technology, ident, passphrase,
diff --git a/test/enable-tethering b/test/enable-tethering
index cbcd4e7..5a42854 100755
--- a/test/enable-tethering
+++ b/test/enable-tethering
@@ -3,8 +3,8 @@
import sys
import dbus
-if (len(sys.argv) >= 3 and len(sys.argv) != 4 and sys.argv[1] == "wifi"):
- print "Usage: %s wifi [SSID] [passphrase]" % (sys.argv[0])
+if (len(sys.argv) > 4 and sys.argv[1] == "wifi"):
+ print "Usage: %s wifi <SSID> [passphrase]" % (sys.argv[0])
sys.exit(1)
elif (len(sys.argv) < 2):
print "Usage: %s type" % (sys.argv[0])
@@ -44,6 +44,9 @@ for path,_ in technologies:
if (len(sys.argv) == 4):
tech = technology_enable_tethering(path,
sys.argv[1], sys.argv[2], sys.argv[3])
+ elif (len(sys.argv) == 3):
+ tech = technology_enable_tethering(path,
+ sys.argv[1], sys.argv[2], "")
else:
tech = technology_enable_tethering(path, sys.argv[1], "", "")
--
1.7.9.5
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman