Re: [PATCH] device: Add configurable DontBringDownAtStartup list
On Mon, 2015-04-27 at 15:40 +0300, Slava Monich wrote: Particular for this patch, which issue was being fixed here? This resolves the conflict between developer mode (handled by usb-moded) and USB tethering (handled by connman) on Jolla phone. When phone boots up with USB connected, usb-moded handles it and turns on the developer mode. connman interferes with that by bringing interface down. If that happens, USB cable has to be physically reconnected to re-enable developer mode, which breaks automated testing and is generally inconvenient. I have really no idea why developer mode is any different from USB tethering. Get an IPv4 address via DHCP on the developer machine, whereafter it is immediately known that ConnMan is to be found on the same subnet as IPv4 address x.x.x.1. If one intends to have ConnMan dynamically ignore interface on the fly via main.conf, ConnMan needs to be restarted for the changes to take effect. This means the existing interface ignore setting can be used to handel developer mode, as a restart is anyway needed. Cheers, Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] device: Add configurable DontBringDownAtStartup list
Hi Slava, connman brings down managed interfaces at startup. Sometimes it's unnecessary or even harmful. DontBringDownAtStartup list in main.conf allows to make exceptions for some interfaces. this is a horrible name for an option. It is like triple negation and will make everyones head hurt who has to read this. Regards Marcel ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] device: Add configurable DontBringDownAtStartup list
On 27/04/15 08:54, Patrik Flykt wrote: On Fri, 2015-04-24 at 16:53 +0300, Slava Monich wrote: connman brings down managed interfaces at startup. Sometimes it's unnecessary or even harmful. DontBringDownAtStartup list in main.conf allows to make exceptions for some interfaces. Taking the interfaces down was the easiest way to clean up any left-over routing and IP addressing information from the time before ConnMan starts. The real issue here is what to do with existing interface IP and routing configuration present before ConnMan starts. Should those be left in place or removed and re-installed with the information ConnMan is configured with? In the latter case, we most likely break NFS, etc. anyway if we touch IP addressing and routing information? There is always the NetworkInterfaceBlacklist for interfaces that need to be left alone. This in general, any comments on removing pre-existing interface information? Particular for this patch, which issue was being fixed here? This resolves the conflict between developer mode (handled by usb-moded) and USB tethering (handled by connman) on Jolla phone. When phone boots up with USB connected, usb-moded handles it and turns on the developer mode. connman interferes with that by bringing interface down. If that happens, USB cable has to be physically reconnected to re-enable developer mode, which breaks automated testing and is generally inconvenient. We need connman to leave rndis0 alone until it's asked to turn USB tethering on. Regards, -Slava Cheers, Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] device: Add configurable DontBringDownAtStartup list
On Fri, 2015-04-24 at 16:53 +0300, Slava Monich wrote: connman brings down managed interfaces at startup. Sometimes it's unnecessary or even harmful. DontBringDownAtStartup list in main.conf allows to make exceptions for some interfaces. Taking the interfaces down was the easiest way to clean up any left-over routing and IP addressing information from the time before ConnMan starts. The real issue here is what to do with existing interface IP and routing configuration present before ConnMan starts. Should those be left in place or removed and re-installed with the information ConnMan is configured with? In the latter case, we most likely break NFS, etc. anyway if we touch IP addressing and routing information? There is always the NetworkInterfaceBlacklist for interfaces that need to be left alone. This in general, any comments on removing pre-existing interface information? Particular for this patch, which issue was being fixed here? Cheers, Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH] device: Add configurable DontBringDownAtStartup list
connman brings down managed interfaces at startup. Sometimes it's unnecessary or even harmful. DontBringDownAtStartup list in main.conf allows to make exceptions for some interfaces. --- src/device.c | 21 + src/main.c | 17 + 2 files changed, 38 insertions(+) diff --git a/src/device.c b/src/device.c index c0683ab..03eac39 100644 --- a/src/device.c +++ b/src/device.c @@ -1367,6 +1367,24 @@ list: return false; } +static bool can_bring_down(const char *devname) +{ + char **pattern = + connman_setting_get_string_list(DontBringDownAtStartup); + + if (pattern) { + while (*pattern) { + if (g_str_has_prefix(devname, *pattern++)) { + DBG(%s no, devname); + return false; + } + } + } + + DBG(%s yes, devname); + return true; +} + static void cleanup_devices(void) { /* @@ -1399,6 +1417,9 @@ static void cleanup_devices(void) if (filtered) continue; + if (!can_bring_down(interfaces[i])) + continue; + index = connman_inet_ifindex(interfaces[i]); if (index 0) continue; diff --git a/src/main.c b/src/main.c index 1c17991..52209f4 100644 --- a/src/main.c +++ b/src/main.c @@ -73,6 +73,7 @@ static struct { bool single_tech; char **tethering_technologies; bool persistent_tethering_mode; + char **dont_bring_down_at_startup; } connman_settings = { .bg_scan = true, .pref_timeservers = NULL, @@ -86,6 +87,7 @@ static struct { .single_tech = false, .tethering_technologies = NULL, .persistent_tethering_mode = false, + .dont_bring_down_at_startup = NULL, }; #define CONF_BG_SCANBackgroundScanning @@ -100,6 +102,7 @@ static struct { #define CONF_SINGLE_TECHSingleConnectedTechnology #define CONF_TETHERING_TECHNOLOGIES TetheringTechnologies #define CONF_PERSISTENT_TETHERING_MODE PersistentTetheringMode +#define CONF_DONT_BRING_DOWN_AT_STARTUP DontBringDownAtStartup static const char *supported_options[] = { CONF_BG_SCAN, @@ -114,6 +117,7 @@ static const char *supported_options[] = { CONF_SINGLE_TECH, CONF_TETHERING_TECHNOLOGIES, CONF_PERSISTENT_TETHERING_MODE, + CONF_DONT_BRING_DOWN_AT_STARTUP, NULL }; @@ -236,6 +240,7 @@ static void parse_config(GKeyFile *config) char **interfaces; char **str_list; char **tethering; + char **dontbringdown; gsize len; int timeout; @@ -347,6 +352,14 @@ static void parse_config(GKeyFile *config) g_clear_error(error); + dontbringdown = __connman_config_get_string_list(config, General, + CONF_DONT_BRING_DOWN_AT_STARTUP, len, error); + + if (!error) + connman_settings.dont_bring_down_at_startup = dontbringdown; + + g_clear_error(error); + boolean = __connman_config_get_bool(config, General, CONF_PERSISTENT_TETHERING_MODE, error); @@ -545,6 +558,9 @@ char **connman_setting_get_string_list(const char *key) if (g_str_equal(key, CONF_TETHERING_TECHNOLOGIES)) return connman_settings.tethering_technologies; + if (g_str_equal(key, CONF_DONT_BRING_DOWN_AT_STARTUP)) + return connman_settings.dont_bring_down_at_startup; + return NULL; } @@ -747,6 +763,7 @@ int main(int argc, char *argv[]) g_strfreev(connman_settings.fallback_nameservers); g_strfreev(connman_settings.blacklisted_interfaces); g_strfreev(connman_settings.tethering_technologies); + g_strfreev(connman_settings.dont_bring_down_at_startup); g_free(option_debug); g_free(option_wifi); -- 1.8.3.2 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman