summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-04-25 11:47:51 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-04-26 09:33:58 (GMT)
commitaa939f614bab24c96bf1df784efcee5bcd80cbf9 (patch)
tree7cd23c12d3062f0cd09a72dd348309083056a01b /src
parentd1ae988ca517c82a7345b8147b651866ca6df527 (diff)
downloadconnman-aa939f614bab24c96bf1df784efcee5bcd80cbf9.zip
connman-aa939f614bab24c96bf1df784efcee5bcd80cbf9.tar.gz
connman-aa939f614bab24c96bf1df784efcee5bcd80cbf9.tar.bz2
ethernet: Add tethering support
Diffstat (limited to 'src')
-rw-r--r--src/technology.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/technology.c b/src/technology.c
index f15fbd9..6e21b4b 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -99,6 +99,30 @@ static void rfkill_check(gpointer key, gpointer value, gpointer user_data)
rfkill->softblock, rfkill->hardblock);
}
+connman_bool_t
+connman_technology_is_tethering_allowed(enum connman_service_type type)
+{
+ static char *allowed_default[] = { "wifi", "bluetooth", "gadget",
+ NULL };
+ const char *type_str = __connman_service_type2string(type);
+ char **allowed;
+ int i;
+
+ if (type_str == NULL)
+ return FALSE;
+
+ allowed = connman_setting_get_string_list("AllowedTetheringTechnologies");
+ if (allowed == NULL)
+ allowed = allowed_default;
+
+ for (i = 0; allowed[i] != NULL; i++) {
+ if (g_strcmp0(allowed[i], type_str) == 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/**
* connman_technology_driver_register:
* @driver: Technology driver definition
@@ -787,6 +811,13 @@ static DBusMessage *set_property(DBusConnection *conn,
if (type != DBUS_TYPE_BOOLEAN)
return __connman_error_invalid_arguments(msg);
+ if (connman_technology_is_tethering_allowed(technology->type)
+ == FALSE) {
+ DBG("%s tethering not allowed by config file",
+ __connman_service_type2string(technology->type));
+ return __connman_error_not_supported(msg);
+ }
+
dbus_message_iter_get_basic(&value, &tethering);
if (technology->tethering == tethering) {