Skip to content

Commit

Permalink
[network] main config file interface setting overrides dyn-mode setting
Browse files Browse the repository at this point in the history
When setting a network interface in the main config file this should
be an override for the one set in the dynamic modes. Found thanks to the
feedback of pigzz

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Oct 16, 2014
1 parent e652d85 commit e598571
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions docs/usb_moded-doc.txt
Expand Up @@ -88,9 +88,10 @@ mode = ask
The other settings and config dirs will be handled later in the appsync and dynamic modes part.
(This is optional and can be compiled out)

There is also an optional network configuration. The default ip set for usb networking is 192.168.2.15
(for Meego/Nemo). However this can be configured by hand in the ini file also (optionally in a separate
ini file which is possible due to config file merging).
There is also an optional network configuration. Certain parts of this config will override the settings
set in the dynamic mode configuration, like for example interface. The default ip set for usb networking
is 192.168.2.15 (for Meego/Nemo). However this can be configured by hand in the ini file also
(optionally in a separate ini file which is possible due to config file merging).

For example:

Expand Down
10 changes: 7 additions & 3 deletions src/usb_moded-network.c
Expand Up @@ -91,15 +91,18 @@ static char* get_interface(struct mode_list_elem *data)
char *interface = NULL;
int check = 0;

if(data)
/* check main configuration before using
the information from the specific mode */
interface = (char *)get_network_interface();
/* no interface override specified, let's use the one
from the mode config */
if(data && !interface)
{
if(data->network_interface)
{
interface = strdup(data->network_interface);
}
}
else
interface = (char *)get_network_interface();

if(interface != NULL)
check = check_interface(interface);
Expand All @@ -108,6 +111,7 @@ static char* get_interface(struct mode_list_elem *data)
{
if(interface != NULL)
free((char *)interface);
/* no known interface configured and existing, falling back to usb0 */
interface = malloc(sizeof(default_interface)*sizeof(char));
strncpy(interface, default_interface, sizeof(default_interface));
}
Expand Down

0 comments on commit e598571

Please sign in to comment.