diff options
author | Martin Xu <martin.xu@intel.com> | 2010-04-13 13:28:52 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-04-13 15:51:25 +0200 |
commit | 428db1e4c509d192851478eac5ba451719150f2c (patch) | |
tree | 7483fd881eba1df807b5977fa61a689e3f21ee76 | |
parent | 449f2e3c3cb9e8d707c1c08172f848ce52d62dd4 (diff) | |
download | connman-428db1e4c509d192851478eac5ba451719150f2c.tar.gz connman-428db1e4c509d192851478eac5ba451719150f2c.tar.bz2 connman-428db1e4c509d192851478eac5ba451719150f2c.zip |
Reset ipconfig index
With PAN, the bnep device index might change and thus it needs to be set
appropriately whenever connman_network_set_index() gets called.
-rw-r--r-- | src/network.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/network.c b/src/network.c index fc4cd010..735ad4f4 100644 --- a/src/network.c +++ b/src/network.c @@ -446,19 +446,31 @@ const char *connman_network_get_path(struct connman_network *network) */ void connman_network_set_index(struct connman_network *network, int index) { - if (network->element.index < 0) { - struct connman_service *service; + struct connman_service *service; + + service = __connman_service_lookup_from_network(network); + if (service == NULL) + goto done; + if (network->element.index < 0) /* * This is needed for plugins that havent set their ipconfig * layer yet, due to not being able to get a network index * prior to creating a service. */ - service = __connman_service_lookup_from_network(network); - if (service != NULL) - __connman_service_create_ipconfig(service, index); + __connman_service_create_ipconfig(service, index); + else { + struct connman_ipconfig *ipconfig; + + /* If index changed, the index of ipconfig must be reset. */ + ipconfig = __connman_service_get_ipconfig(service); + if (ipconfig == NULL) + goto done; + + __connman_ipconfig_set_index(ipconfig, index); } +done: network->element.index = index; } |