Skip to content

Commit

Permalink
Merge pull request #40 from nemomobile/testing
Browse files Browse the repository at this point in the history
[usb-moded] Usb-moded minor release 0.82.4
  • Loading branch information
philippedeswert committed Jul 7, 2015
2 parents 0bb1cc4 + f8b3acd commit d96ac28
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion configure.ac
@@ -1,4 +1,4 @@
AC_INIT([usb_moded], [0.82.3])
AC_INIT([usb_moded], [0.82.4])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])

AM_CONFIG_HEADER([config.h])
Expand Down
11 changes: 11 additions & 0 deletions debian/changelog
@@ -1,3 +1,14 @@
usb-moded (0.82.4) unstable; urgency=low

* [network] Fix potential memory leak. Fixes: CID#1311255, CID#1311254, CID#1311253, CID#1311252
* [modesetting] Retry network setting before starting post services. Contributes: JB#30264
* [ifconfig] Query /sys/class/net instead of ifconfig
* [network] Improve dealing with missing interfaces.
* [adb] Add dhcp server start for ADB mode. Contributes: JB#30264
* [appsync] sort appsync list alphabetically. Contributes: JB#30264

-- Philippe De Swert <philippe.deswert@jolla.com> Mon, 06 Jul 2015 13:31:13 +0300

usb-moded (0.82.3) unstable; urgency=low

* [spec] Make sure all adb services are packaged. Contributes: JB#30264
Expand Down
2 changes: 1 addition & 1 deletion rpm/usb-moded.spec
@@ -1,6 +1,6 @@
Name: usb-moded
Version: 0.82
Release: 3
Release: 4
Summary: USB mode controller
Group: System/System Control
License: LGPLv2
Expand Down
18 changes: 9 additions & 9 deletions src/usb_moded-modesetting.c
Expand Up @@ -382,6 +382,15 @@ int set_dynamic_mode(void)
#endif /* DEBIAN */
}

/* try a second time to bring up the network if it failed the first time,
this can happen with functionfs based gadgets (which is why we sleep for a bit */
if(network != 0)
{
log_debug("Retry setting up te network\n");
sleep(1);
usb_network_up(data);
}

/* Needs to be called before application post synching so
that the dhcp server has the right config */
if(data->nat || data->dhcp_server)
Expand All @@ -396,15 +405,6 @@ int set_dynamic_mode(void)
connman_set_tethering(data->connman_tethering, TRUE);
#endif

/* try a second time to bring up the network if it failed the first time,
this can happen with functionfs based gadgets (which is why we sleep for a bit */
if(network != 0)
{
log_debug("Retry setting up te network\n");
sleep(1);
usb_network_up(data);
}

if(ret)
usb_moded_send_error_signal(MODE_SETTING_FAILED);
return(ret);
Expand Down
13 changes: 7 additions & 6 deletions src/usb_moded-network.c
Expand Up @@ -81,11 +81,11 @@ static void free_ipforward_data (struct ipforward_data *ipforward)
/* This function checks if the configured interface exists */
static int check_interface(char *interface)
{
char command[32];
char path[25];
int ret = 0;

snprintf(command, 32, "ifconfig %s > /dev/null\n", interface );
ret = system(command);
snprintf(path, 25, "/sys/class/net/%s", interface );
ret = access(path, F_OK);

return(ret);
}
Expand Down Expand Up @@ -337,6 +337,10 @@ static int write_udhcpd_conf(struct ipforward_data *ipforward, struct mode_list_
return(1);
}

interface = get_interface(data);
if(interface == NULL)
return(1);

/* generate start and end ip based on the setting */
ip = get_network_ip();
if(ip == NULL)
Expand Down Expand Up @@ -365,9 +369,6 @@ static int write_udhcpd_conf(struct ipforward_data *ipforward, struct mode_list_
strcat(ipstart,"1");
strcat(ipend, "10");

interface = get_interface(data);
if(interface == NULL)
return(1);
/* print all data in the file */
fprintf(conffile, "start\t%s\n", ipstart);
fprintf(conffile, "end\t%s\n", ipend);
Expand Down

0 comments on commit d96ac28

Please sign in to comment.