[-]
[+]
|
Changed |
_service:tar_git:connman.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:connman.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -1,3 +1,3 @@
<services>
<service name="tar_git"><param name="url">https://github.com/mer-packages/connman.git</param></service>
-</services>
+</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/Makefile.am
^
|
@@ -255,7 +255,8 @@
-lreadline -ldl
endif
-noinst_PROGRAMS += unit/test-pbkdf2-sha1 unit/test-prf-sha1 unit/test-ippool
+noinst_PROGRAMS += unit/test-pbkdf2-sha1 unit/test-prf-sha1 unit/test-ippool \
+ unit/test-jolla-wakeup-timer unit/test-dnsproxy
unit_test_pbkdf2_sha1_SOURCES = unit/test-pbkdf2-sha1.c \
src/shared/sha1.h src/shared/sha1.c
@@ -269,7 +270,16 @@
unit_test_ippool_LDADD = gdbus/libgdbus-internal.la \
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
-TESTS = unit/test-pbkdf2-sha1 unit/test-prf-sha1 unit/test-ippool
+unit_test_jolla_wakeup_timer_SOURCES = unit/test-jolla-wakeup-timer.c \
+ src/log.c src/wakeup_timer.c \
+ plugins/jolla_wakeup_timer.c
+unit_test_jolla_wakeup_timer_LDADD = @GLIB_LIBS@ -lrt -ldl
+
+unit_test_dnsproxy_SOURCES = unit/test-dnsproxy.c src/log.c
+unit_test_dnsproxy_LDADD = @GLIB_LIBS@ -lresolv -ldl
+
+TESTS = unit/test-pbkdf2-sha1 unit/test-prf-sha1 unit/test-ippool \
+ unit/test-jolla-wakeup-timer unit/test-dnsproxy
if WISPR
noinst_PROGRAMS += tools/wispr
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/gdhcp/client.c
^
|
@@ -2049,7 +2049,7 @@
memcpy(&dhcp_client->ia_ta, &addr,
sizeof(struct in6_addr));
- if (valid > dhcp_client->expire)
+ if (valid != dhcp_client->expire)
dhcp_client->expire = valid;
}
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/gsupplicant/dbus.c
^
|
@@ -240,6 +240,8 @@
property_call->function = function;
property_call->user_data = user_data;
+ property_calls = g_slist_prepend(property_calls, property_call);
+
dbus_pending_call_set_notify(call, property_get_all_reply,
property_call, property_call_free);
@@ -327,6 +329,8 @@
property_call->function = function;
property_call->user_data = user_data;
+ property_calls = g_slist_prepend(property_calls, property_call);
+
dbus_pending_call_set_notify(call, property_get_reply,
property_call, property_call_free);
@@ -419,6 +423,8 @@
property_call->function = function;
property_call->user_data = user_data;
+ property_calls = g_slist_prepend(property_calls, property_call);
+
dbus_pending_call_set_notify(call, property_set_reply,
property_call, property_call_free);
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/gsupplicant/supplicant.c
^
|
@@ -2846,7 +2846,7 @@
err = supplicant_dbus_property_get_all(path,
SUPPLICANT_INTERFACE ".Interface",
interface_create_property, data,
- data->interface);
+ NULL);
if (err == 0)
return;
@@ -3055,7 +3055,7 @@
"RemoveInterface",
interface_remove_params,
interface_remove_result, data,
- NULL);
+ interface);
if (ret < 0) {
g_free(data->path);
dbus_free(data);
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/gweb/gweb.c
^
|
@@ -1081,7 +1081,8 @@
session->addr->ai_addrlen) < 0) {
if (errno != EINPROGRESS) {
debug(session->web, "connect() %s", strerror(errno));
- close(sk);
+ g_io_channel_unref(session->transport_channel);
+ session->transport_channel = NULL;
return -EIO;
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/plugins/jolla_wakeup_timer.c
^
|
@@ -29,6 +29,12 @@
*
* Try not to schedule wakeups too often as it can be expensive; use a
* large granularity in calculating the next scheduling.
+ *
+ * Because Glib uses CLOCK_MONOTONIC for its time counting purposes
+ * and that clock doesn't advance in suspend, keep track of timeouts
+ * in CLOCK_BOOTTIME and execute them from this code as
+ * needed. Timeout execution is driven by a Glib timer which gets
+ * re-created when we come out of suspend so that it stays on time.
*/
#include <time.h>
@@ -57,10 +63,11 @@
struct wakeup_context {
gboolean initialized;
- iphb_t handle;
GList *timeouts;
- guint source; /* unixfd source for iphb fd */
+ iphb_t wakeup_handle;
+ guint wakeup_source; /* unixfd source for iphb fd */
time_t wakeup_time;
+ guint timer_source; /* timer for the next timeout to trigger */
};
struct wakeup_timeout {
@@ -69,7 +76,7 @@
GSourceFunc function;
gpointer user_data;
GDestroyNotify notify;
- guint source;
+ GSource *source;
time_t wakeup_time;
};
@@ -78,42 +85,51 @@
NULL,
NULL,
0,
+ 0,
0
};
static void wakeup_reschedule(void);
+static void timer_reschedule(void);
+
static gboolean wakeup_wakeup(gint fd, GIOCondition cnd, gpointer data);
static void iphb_cleanup(void)
{
- if (context.source) {
- g_source_remove(context.source);
- context.source = 0;
+ if (context.wakeup_source) {
+ g_source_remove(context.wakeup_source);
+ context.wakeup_source = 0;
+ }
+
+ if (context.wakeup_handle)
+ context.wakeup_handle = iphb_close(context.wakeup_handle);
+
+ if (context.timer_source) {
+ g_source_remove(context.timer_source);
+ context.timer_source = 0;
}
- if (context.handle)
- context.handle = iphb_close(context.handle);
}
static int iphb_setup(void)
{
int r = 0, fd = -1;
- if (context.handle) {
+ if (context.wakeup_handle) {
/* already set up, no op */
goto out;
}
- context.handle = iphb_open(NULL);
- if (context.handle == NULL) {
+ context.wakeup_handle = iphb_open(NULL);
+ if (context.wakeup_handle == NULL) {
connman_warn("Cannot initialize IPHB handle: %s(%d).",
strerror(errno), errno);
r = -errno;
goto error;
}
- fd = iphb_get_fd(context.handle);
+ fd = iphb_get_fd(context.wakeup_handle);
if (fd < 0) {
connman_warn("Cannot get IPHB fd: %s(%d).",
strerror(errno), errno);
@@ -121,11 +137,11 @@
goto error;
}
- context.source = g_unix_fd_add_full(G_PRIORITY_HIGH, fd,
+ context.wakeup_source = g_unix_fd_add_full(G_PRIORITY_HIGH, fd,
G_IO_IN | G_IO_HUP |
G_IO_ERR | G_IO_NVAL,
wakeup_wakeup, NULL, NULL);
- if (!context.source) {
+ if (!context.wakeup_source) {
connman_warn("Cannot set up IPHB source.");
r = -EIO;
goto error;
@@ -150,6 +166,7 @@
/* Ok, force reschedule and that's it */
context.wakeup_time = 0;
wakeup_reschedule();
+ timer_reschedule();
return FALSE;
}
@@ -198,6 +215,22 @@
t1->tv_sec += t2->tv_sec;
}
+static void timespec_sub(struct timespec *t1, struct timespec *t2)
+{
+ if (timespec_cmp(t1, t2) < 0) { /* Clamp at 0.0 if t1 < t2 */
+ t1->tv_sec = 0;
+ t1->tv_nsec = 0;
+ } else {
+ if (t1->tv_nsec < t2->tv_nsec) {
+ t1->tv_nsec = t1->tv_nsec + 1000000000 - t2->tv_nsec;
+ t1->tv_sec--;
+ } else {
+ t1->tv_nsec -= t2->tv_nsec;
+ }
+ t1->tv_sec -= t2->tv_sec;
+ }
+}
+
static gint timeout_compare(gconstpointer a, gconstpointer b)
{
const struct wakeup_timeout *t1 = a;
@@ -231,6 +264,7 @@
timeout,
timeout_compare);
wakeup_reschedule();
+ timer_reschedule();
debug_timeouts();
}
@@ -241,11 +275,8 @@
DBG("Timeout %p expired", timeout);
- if (g_list_find(context.timeouts, timeout)) {
+ if (g_list_find(context.timeouts, timeout))
context.timeouts = g_list_remove(context.timeouts, timeout);
- wakeup_reschedule();
- debug_timeouts();
- }
/* If the timeout is to be repeated, put it back to the
bookkeeping list in the right position; if not, our
@@ -257,6 +288,7 @@
timeout_record(timeout);
} else {
DBG("Timeout %p not repeating.", timeout);
+ g_source_remove(g_source_get_id(timeout->source));
}
return again;
@@ -271,14 +303,82 @@
if (g_list_find(context.timeouts, timeout)) {
context.timeouts = g_list_remove(context.timeouts, timeout);
wakeup_reschedule();
+ timer_reschedule();
debug_timeouts();
}
if (timeout->notify)
(timeout->notify)(timeout->user_data);
+
+ g_source_unref(timeout->source);
g_free(timeout);
}
+static void timer_trigger_expired(void)
+{
+ struct timespec now;
+
+ DBG("");
+
+ clock_gettime(CLOCK_BOOTTIME, &now);
+
+ while (context.timeouts) {
+ struct wakeup_timeout *timeout = context.timeouts->data;
+
+ if (timespec_cmp(&timeout->trigger, &now) <= 0) {
+ timeout_function_wrapper(timeout);
+ }
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/plugins/vpn.c
^
|
@@ -1078,7 +1078,7 @@
char *ptr;
long int value = strtol(netmask, &ptr, 10);
if (ptr != netmask && *ptr == '\0' &&
- value <= 32)
+ value && value <= 32)
prefix_len = value;
}
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/plugins/wifi.c
^
|
@@ -1879,6 +1879,10 @@
wifi = g_supplicant_interface_get_data(interface);
+ /* Set interface to null as it's being deallocated */
+ if (wifi)
+ wifi->interface = NULL;
+
if (wifi && wifi->tethering)
return;
@@ -1887,7 +1891,6 @@
return;
}
- wifi->interface = NULL;
connman_device_set_powered(wifi->device, false);
check_p2p_technology();
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/agent-connman.c
^
|
@@ -664,6 +664,9 @@
static void request_connect_reply(DBusMessage *reply, void *user_data)
{
+ if (!reply)
+ return;
+
DBusMessageIter iter;
char *key;
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/config.c
^
|
@@ -399,7 +399,7 @@
char *ptr;
long int value = strtol(mask, &ptr, 10);
- if (ptr != mask && *ptr == '\0' && value <= 32)
+ if (ptr != mask && *ptr == '\0' && value && value <= 32)
prefix_len = value;
addr = 0xffffffff << (32 - prefix_len);
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/connman.h
^
|
@@ -408,6 +408,7 @@
int __connman_ipconfig_save(struct connman_ipconfig *ipconfig,
GKeyFile *keyfile, const char *identifier, const char *prefix);
bool __connman_ipconfig_ipv6_privacy_enabled(struct connman_ipconfig *ipconfig);
+int __connman_ipconfig_ipv6_reset_privacy(struct connman_ipconfig *ipconfig);
int __connman_ipconfig_ipv6_set_privacy(struct connman_ipconfig *ipconfig,
const char *value);
bool __connman_ipconfig_ipv6_is_enabled(struct connman_ipconfig *ipconfig);
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/device.c
^
|
@@ -186,6 +186,12 @@
if (device->powered_pending == PENDING_NONE && device->powered)
return -EALREADY;
+ if (device->index > 0) {
+ err = connman_inet_ifup(device->index);
+ if (err < 0 && err != -EALREADY)
+ return err;
+ }
+
device->powered_pending = PENDING_ENABLE;
err = device->driver->enable(device);
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/dhcp.c
^
|
@@ -35,6 +35,7 @@
#include <glib.h>
#include "connman.h"
+#include "wakeup_timer.h"
#define RATE_LIMIT_INTERVAL 60 /* delay between successive attempts */
@@ -241,9 +242,11 @@
DBG("No lease available ipv4ll %d client %p", ipv4ll_running,
dhcp->ipv4ll_client);
- dhcp->timeout = g_timeout_add_seconds(RATE_LIMIT_INTERVAL,
+ dhcp->timeout = connman_wakeup_timer_seconds(G_PRIORITY_DEFAULT,
+ RATE_LIMIT_INTERVAL,
dhcp_retry_cb,
- dhcp);
+ dhcp,
+ NULL);
if (ipv4ll_running)
return;
@@ -607,7 +610,8 @@
err = dhcp_initialize(dhcp);
if (err < 0) {
- connman_network_unref(network);
+ if (network)
+ connman_network_unref(network);
g_free(dhcp);
return err;
}
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/dhcpv6.c
^
|
@@ -36,6 +36,7 @@
#include <glib.h>
#include "connman.h"
+#include "wakeup_timer.h"
/* Transmission params in msec, RFC 3315 chapter 5.5 */
#define INF_MAX_DELAY (1 * 1000)
@@ -631,6 +632,7 @@
/* Is this prefix part of the subnet we are suppose to use? */
prefix_len = check_ipv6_addr_prefix(prefixes, address);
+ __connman_ipconfig_address_remove(ipconfig);
__connman_ipconfig_set_local(ipconfig, address);
__connman_ipconfig_set_prefixlen(ipconfig, prefix_len);
@@ -743,7 +745,11 @@
data->ifindex = ifindex;
data->callback = callback;
data->dhcp_client = g_dhcp_client_ref(dhcp_client);
- data->timeout = g_timeout_add(DEC_TIMEOUT, decline_timeout, data);
+ data->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ DEC_TIMEOUT,
+ decline_timeout,
+ data,
+ NULL);
g_dhcp_client_register_event(dhcp_client, G_DHCP_CLIENT_EVENT_DECLINE,
decline_cb, data);
@@ -989,7 +995,11 @@
dhcp->RT = calc_delay(dhcp->RT, REQ_MAX_RT);
DBG("request resend RT timeout %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, timeout_request_resend, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ timeout_request_resend,
+ dhcp,
+ NULL);
g_dhcpv6_client_set_retransmit(dhcp->dhcp_client);
@@ -1006,7 +1016,11 @@
dhcp->RT = calc_delay(dhcp->RT, REQ_MAX_RT);
DBG("request resend RT timeout %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, timeout_request_resend, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ timeout_request_resend,
+ dhcp,
+ NULL);
dhcpv6_request(dhcp, true);
@@ -1028,7 +1042,11 @@
dhcp->RT = calc_delay(dhcp->RT, REQ_MAX_RT);
DBG("resending request after %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, request_resend, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ request_resend,
+ dhcp,
+ NULL);
}
static void re_cb(enum request_type req_type, GDHCPClient *dhcp_client,
@@ -1119,6 +1137,7 @@
{
DBG("");
+ g_dhcpv6_client_reset_request(dhcp_client);
g_dhcpv6_client_clear_retransmit(dhcp_client);
re_cb(REQ_REBIND, dhcp_client, user_data);
@@ -1183,7 +1202,11 @@
if (current >= expired) {
DBG("expired by %d secs", (int)(current - expired));
- g_timeout_add(0, dhcpv6_restart, dhcp);
+ connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ 0,
+ dhcpv6_restart,
+ dhcp,
+ NULL);
return -ETIMEDOUT;
}
@@ -1202,7 +1225,11 @@
DBG("rebind RT timeout %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, timeout_rebind, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ timeout_rebind,
+ dhcp,
+ NULL);
g_dhcpv6_client_set_retransmit(dhcp->dhcp_client);
@@ -1222,7 +1249,11 @@
DBG("rebind initial RT timeout %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, timeout_rebind, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ timeout_rebind,
+ dhcp,
+ NULL);
dhcpv6_rebind(dhcp);
@@ -1293,7 +1324,11 @@
dhcp->RT = calc_delay(dhcp->RT, REQ_MAX_RT);
DBG("request RT timeout %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, timeout_request, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ timeout_request,
+ dhcp,
+ NULL);
g_dhcpv6_client_set_retransmit(dhcp->dhcp_client);
@@ -1306,6 +1341,7 @@
{
DBG("");
+ g_dhcpv6_client_reset_request(dhcp_client);
g_dhcpv6_client_clear_retransmit(dhcp_client);
re_cb(REQ_RENEW, dhcp_client, user_data);
@@ -1371,7 +1407,11 @@
DBG("renew RT timeout %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, timeout_renew, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ timeout_renew,
+ dhcp,
+ NULL);
g_dhcpv6_client_set_retransmit(dhcp->dhcp_client);
@@ -1388,7 +1428,11 @@
DBG("renew initial RT timeout %d msec", dhcp->RT);
- dhcp->timeout = g_timeout_add(dhcp->RT, timeout_renew, dhcp);
+ dhcp->timeout = connman_wakeup_timer(G_PRIORITY_DEFAULT,
+ dhcp->RT,
+ timeout_renew,
+ dhcp,
+ NULL);
dhcpv6_renew(dhcp);
@@ -1441,21 +1485,33 @@
/* RFC 3315, chapter 18.1.3, start rebind */
DBG("start rebind immediately");
- dhcp->timeout = g_timeout_add_seconds(0, start_rebind,
- dhcp);
+ dhcp->timeout =
+ connman_wakeup_timer_seconds(G_PRIORITY_DEFAULT,
+ 0,
+ start_rebind,
+ dhcp,
+ NULL);
} else if ((unsigned)current < (unsigned)started + T1) {
delta = started + T1 - current;
DBG("renew after %d secs", delta);
- dhcp->timeout = g_timeout_add_seconds(delta,
- start_renew, dhcp);
+ dhcp->timeout =
+ connman_wakeup_timer_seconds(G_PRIORITY_DEFAULT,
+ delta,
+ start_renew,
+ dhcp,
+ NULL);
} else {
delta = started + T2 - current;
DBG("rebind after %d secs", delta);
- dhcp->timeout = g_timeout_add_seconds(delta,
- start_rebind, dhcp);
+ dhcp->timeout =
+ connman_wakeup_timer_seconds(G_PRIORITY_DEFAULT,
+ delta,
+ start_rebind,
+ dhcp,
+ NULL);
}
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/dnsproxy.c
^
|
@@ -2205,7 +2205,8 @@
* without any good reason. The small delay allows the new RDNSS to
* create a new DNS server instance and the refcount does not go to 0.
*/
- g_timeout_add_seconds(3, try_remove_cache, NULL);
+ if (cache)
+ g_timeout_add_seconds(3, try_remove_cache, NULL);
g_free(server);
}
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/ipconfig.c
^
|
@@ -1701,10 +1701,6 @@
if (ipdevice->config_ipv6 == ipconfig) {
ipconfig_list = g_list_remove(ipconfig_list, ipconfig);
- if (ipdevice->config_ipv6->method ==
- CONNMAN_IPCONFIG_METHOD_AUTO)
- disable_ipv6(ipdevice->config_ipv6);
-
connman_ipaddress_clear(ipdevice->config_ipv6->system);
__connman_ipconfig_unref(ipdevice->config_ipv6);
ipdevice->config_ipv6 = NULL;
@@ -1774,6 +1770,24 @@
return 0;
}
+int __connman_ipconfig_ipv6_reset_privacy(struct connman_ipconfig *ipconfig)
+{
+ struct connman_ipdevice *ipdevice;
+ int err;
+
+ if (!ipconfig)
+ return -EINVAL;
+
+ ipdevice = g_hash_table_lookup(ipdevice_hash,
+ GINT_TO_POINTER(ipconfig->index));
+ if (!ipdevice)
+ return -ENODEV;
+
+ err = __connman_ipconfig_ipv6_set_privacy(ipconfig, privacy2string(ipdevice->ipv6_privacy));
+
+ return err;
+}
+
int __connman_ipconfig_ipv6_set_privacy(struct connman_ipconfig *ipconfig,
const char *value)
{
@@ -2091,8 +2105,7 @@
case CONNMAN_IPCONFIG_METHOD_OFF:
ipconfig->method = method;
- if (ipconfig->type == CONNMAN_IPCONFIG_TYPE_IPV6)
- disable_ipv6(ipconfig);
+
break;
case CONNMAN_IPCONFIG_METHOD_AUTO:
@@ -2102,7 +2115,7 @@
ipconfig->method = method;
if (privacy_string)
ipconfig->ipv6_privacy_config = privacy;
- enable_ipv6(ipconfig);
+
break;
case CONNMAN_IPCONFIG_METHOD_MANUAL:
@@ -2137,6 +2150,7 @@
return connman_ipaddress_set_ipv6(
ipconfig->address, address,
prefix_length, gateway);
+
break;
case CONNMAN_IPCONFIG_METHOD_DHCP:
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/main.c
^
|
@@ -532,8 +532,7 @@
G_OPTION_ARG_NONE, &option_backtrace,
"Don't print out backtrace information" },
#ifdef SYSTEMD
- { "systemd", 0, G_OPTION_FLAG_OPTIONAL_ARG,
- G_OPTION_ARG_NONE, &option_systemd,
+ { "systemd", 0, 0, G_OPTION_ARG_NONE, &option_systemd,
"Notify systemd when started"},
#endif
{ "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/network.c
^
|
@@ -463,6 +463,7 @@
unsigned int length, void *user_data)
{
struct connman_network *network = user_data;
+ struct connman_service *service;
GSList *prefixes;
DBG("reply %p", reply);
@@ -497,6 +498,23 @@
prefixes = __connman_inet_ipv6_get_prefixes(reply, length);
+ /*
+ * If IPv6 config is missing from service, then create it.
+ * The ipconfig might be missing if we got a rtnl message
+ * that disabled IPv6 config and thus removed it. This
+ * can happen if we are switching from one service to
+ * another in the same interface. The only way to get IPv6
+ * config back is to re-create it here.
+ */
+ service = connman_service_lookup_from_network(network);
+ if (service) {
+ connman_service_create_ip6config(service, network->index);
+
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_CONFIGURATION,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
+ }
+
/*
* We do stateful/stateless DHCPv6 if router advertisement says so.
*/
@@ -593,6 +611,8 @@
if (!ipconfig)
return;
+ __connman_ipconfig_address_remove(ipconfig);
+
index = __connman_ipconfig_get_index(ipconfig);
connman_network_ref(network);
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/service.c
^
|
@@ -2809,6 +2809,8 @@
service->favorite = false;
+ __connman_ipconfig_ipv6_reset_privacy(service->ipconfig_ipv6);
+
service_save(service);
service_destroy(service);
@@ -3257,7 +3259,11 @@
{
int err = 0;
- if (service->immutable || service->hidden)
+ if (service->hidden)
+ return -EINVAL;
+
+ if (service->immutable &&
+ service->security != CONNMAN_SERVICE_SECURITY_8021X)
return -EINVAL;
err = check_passphrase(service, service->security, passphrase);
@@ -3524,6 +3530,7 @@
if (is_connecting_state(service, state) ||
is_connected_state(service, state))
__connman_network_clear_ipconfig(service->network, ipconfig);
+
__connman_ipconfig_unref(ipconfig);
if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
@@ -3531,13 +3538,16 @@
else if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
service->ipconfig_ipv6 = new_ipconfig;
- __connman_ipconfig_enable(new_ipconfig);
+ if (is_connecting_state(service, state) ||
+ is_connected_state(service, state))
+ __connman_ipconfig_enable(new_ipconfig);
if (new_state && new_method != old_method) {
if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
*new_state = service->state_ipv4;
else
*new_state = service->state_ipv6;
+
__connman_service_auto_connect(CONNMAN_SERVICE_CONNECT_REASON_AUTO);
}
@@ -4512,6 +4522,8 @@
__connman_service_set_favorite(service, false);
+ __connman_ipconfig_ipv6_reset_privacy(service->ipconfig_ipv6);
+
service_save(service);
return true;
@@ -5973,6 +5985,9 @@
vpn_auto_connect();
} else if (new_state == CONNMAN_SERVICE_STATE_DISCONNECT) {
+
+ reply_pending(service, ECONNABORTED);
+
def_service = __connman_service_get_default();
if (!__connman_notifier_is_connected() &&
|
[-]
[+]
|
Changed |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/src/wispr.c
^
|
@@ -697,10 +697,10 @@
g_web_parser_end_data(wp_context->wispr_parser);
- if (wp_context->wispr_msg.message_type >= 0) {
- if (wispr_manage_message(result, wp_context))
- goto done;
- }
+// if (wp_context->wispr_msg.message_type >= 0) {
+// if (wispr_manage_message(result, wp_context))
+// goto done;
+// }
}
status = g_web_result_get_status(result);
@@ -709,8 +709,8 @@
switch (status) {
case 200:
- if (wp_context->wispr_msg.message_type >= 0)
- break;
+// if (wp_context->wispr_msg.message_type >= 0)
+// break;
if (g_web_result_get_header(result, "X-ConnMan-Status",
&str)) {
|
[-]
[+]
|
Added |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/unit/test-dnsproxy.c
^
|
@@ -0,0 +1,197 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2014 Jolla Ltd. All rights reserved.
+ * Contact: Hannu Mallat <hannu.mallat@jollamobile.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+/* Include source file to access static variables easily */
+#include "src/dnsproxy.c"
+
+static GMainLoop *main_loop = NULL;
+
+/* Stub getaddrinfo() to return test data */
+int getaddrinfo(const char *node, const char *service,
+ const struct addrinfo *hints,
+ struct addrinfo **res)
+{
+ struct addrinfo *ai = g_new0(struct addrinfo, 1);
+ ai->ai_socktype = hints->ai_socktype;
+ ai->ai_protocol = hints->ai_protocol;
+ if (hints->ai_family == AF_INET6) {
+ struct sockaddr_in6 *in6 = g_new0(struct sockaddr_in6, 1);
+ in6->sin6_family = AF_INET6;
+ in6->sin6_port = htons(53);
+ memcpy(&in6->sin6_addr.s6_addr, "0123456789abcdef", 16);
+
+ ai->ai_family = AF_INET6;
+ ai->ai_addrlen = sizeof(struct sockaddr_in6);
+ ai->ai_addr = (struct sockaddr *)in6;
+ } else {
+ struct sockaddr_in *in = g_new0(struct sockaddr_in, 1);
+ in->sin_family = AF_INET;
+ in->sin_port = htons(53);
+ in->sin_addr.s_addr = htonl(0x12345678);
+
+ ai->ai_family = AF_INET6;
+ ai->ai_addrlen = sizeof(struct sockaddr_in);
+ ai->ai_addr = (struct sockaddr *)in;
+ }
+ ai->ai_canonname = g_strdup(node);
+ ai->ai_next = NULL;
+ *res = ai;
+
+ return 0;
+}
+
+void freeaddrinfo(struct addrinfo *res)
+{
+ if (res) {
+ if (res->ai_addr) {
+ g_free(res->ai_addr);
+ }
+ if (res->ai_canonname) {
+ g_free(res->ai_canonname);
+ }
+ g_free(res);
+ }
+}
+
+/* Stub socket() that always fails */
+int socket(int domain, int type, int protocol)
+{
+ return -1;
+}
+
+GResolv *g_resolv_new(int index)
+{
+ return NULL;
+}
+
+bool g_resolv_set_address_family(GResolv *resolv, int family)
+{
+ return FALSE;
+}
+
+bool g_resolv_add_nameserver(GResolv *resolv, const char *address,
+ uint16_t port, unsigned long flags)
+{
+ return FALSE;
+}
+
+guint g_resolv_lookup_hostname(GResolv *resolv, const char *hostname,
+ GResolvResultFunc func, gpointer user_data)
+{
+ return 0;
+}
+
+int __connman_agent_request_connection(void *user_data)
+{
+ return -1;
+}
+
+char *connman_inet_ifname(int index)
+{
+ return NULL;
+}
+
+int connman_inet_ifindex(const char *name)
+{
+ return -1;
+}
+
+int __connman_inet_get_interface_address(int index, int family, void *address)
+{
+ return -1;
+}
+
+int __connman_service_get_index(struct connman_service *service)
+{
+ return -1;
+}
+
+bool __connman_service_index_is_default(int index)
+{
+ return FALSE;
+}
+
+bool __connman_service_index_is_split_routing(int index)
+{
+ return FALSE;
+}
+
+int __connman_resolvfile_append(int index, const char *domain, const char *server)
+{
+ return -1;
+}
+
+int __connman_resolvfile_remove(int index, const char *domain, const char *server)
+{
+ return -1;
+}
+
+int connman_notifier_register(struct connman_notifier *notifier)
+{
+ return 0;
+}
+
+void connman_notifier_unregister(struct connman_notifier *notifier)
+{
+}
+
+static gboolean server_creation_failure_check_state(gpointer user_data)
+{
+ DBG("cache_refcount is %d, expecting 0.", cache_refcount);
+ g_assert(cache_refcount >= 0);
+ g_main_loop_quit(main_loop);
+ return FALSE;
+}
+
+static void server_creation_failure(void)
+{
+ int i;
+
+ main_loop = g_main_loop_new(NULL, FALSE);
+ __connman_log_init("test-dnsproxy",
+ g_test_verbose() ? "*" : NULL,
+ FALSE, FALSE,
+ "test-dnsproxy", "1");
+
+ /* socket() set to fail, __connman_dnsproxy_append must therefore fail */
+ for (i = 0; i < 10; i++) {
+ g_assert(__connman_dnsproxy_append(0,
+ "example.com",
+ "ns.example.com") == -EIO);
+ }
+
+ g_timeout_add_seconds(4, server_creation_failure_check_state,
+ NULL);
+ g_main_loop_run(main_loop);
+
+ g_main_loop_unref(main_loop);
+}
+
+int main(int argc, char *argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+
+ g_test_add_func("/dnsproxy/server-creation-failure",
+ server_creation_failure);
+
+ return g_test_run();
+}
|
[-]
[+]
|
Added |
_service:tar_git:connman-1.24+git35.tar.bz2/connman/unit/test-jolla-wakeup-timer.c
^
|
@@ -0,0 +1,168 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2014 Jolla Ltd. All rights reserved.
+ * Contact: Hannu Mallat <hannu.mallat@jollamobile.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <iphbd/libiphb.h>
+
+#define CONNMAN_API_SUBJECT_TO_CHANGE
+#include "plugin.h"
+#include "wakeup_timer.h"
+
+#define CHUNK 4
+#define MAX_COUNT 100
+#define MAX_DELAY 20
+
+static GMainLoop *main_loop = NULL;
+
+extern struct connman_plugin_desc __connman_builtin_jolla_wakeup_timer;
+
+extern int __connman_log_init(const char *program, const char *debug,
+ gboolean detach, gboolean backtrace,
+ const char *program_name, const char *program_version);
+
+static unsigned int timeouts_scheduled;
+static unsigned int timeouts_handled;
+
+/* Stub IPHB calls to allow unit testing in development environment */
+
+struct iphb_stub {
+ int pipe_fd[2]; /* Pipe to nowhere */
+};
+
+iphb_t iphb_open(int *dummy)
+{
+ struct iphb_stub *stub = NULL;
+
+ stub = g_new0(struct iphb_stub, 1);
+ g_assert(pipe(stub->pipe_fd) == 0);
+
+ return stub;
+}
+
+int iphb_get_fd(iphb_t iphbh)
+{
+ struct iphb_stub *stub = iphbh;
+
+ return stub->pipe_fd[0];
+}
+
+time_t iphb_wait2(iphb_t iphbh, unsigned mintime, unsigned maxtime,
+ int must_wait, int resume)
+{
+ return 0;
+}
+
+int iphb_discard_wakeups(iphb_t iphbh)
+{
+ return 0;
+}
+
+iphb_t iphb_close(iphb_t iphbh)
+{
+ struct iphb_stub *stub = iphbh;
+
+ if (stub->pipe_fd[0] >= 0)
+ close(stub->pipe_fd[0]);
+ if (stub->pipe_fd[1] >= 0)
+ close(stub->pipe_fd[1]);
+ g_free(stub);
+
+ return NULL;
+}
+
+static gboolean create_timeout_within_callback_cb(gpointer user_data)
+{
+ int i;
+
+ DBG("scheduled %d, handled %d", timeouts_scheduled, timeouts_handled);
+
+ for (i = 0; i < CHUNK && timeouts_scheduled < MAX_COUNT; i++) {
+ timeouts_scheduled++;
+ g_assert(connman_wakeup_timer
+ (G_PRIORITY_DEFAULT,
+ g_test_rand_int_range(0, MAX_DELAY),
+ create_timeout_within_callback_cb,
+ NULL,
+ NULL) > 0);
+ }
+
+ timeouts_handled++;
+ if (timeouts_handled == MAX_COUNT) {
+ DBG("Done, let's quit");
+ g_main_loop_quit(main_loop);
+ }
+
+ return FALSE;
+}
+
+static gboolean create_timeout_within_callback_seed(gpointer user_data)
+{
+ int i;
+
+ for (i = 0; i < CHUNK && timeouts_scheduled < MAX_COUNT; i++) {
+ timeouts_scheduled++;
+ g_assert(connman_wakeup_timer
+ (G_PRIORITY_DEFAULT,
+ g_test_rand_int_range(0, MAX_DELAY),
+ create_timeout_within_callback_cb,
+ NULL,
+ NULL) > 0);
+ }
+
+ return FALSE;
+}
+
+static void create_timeout_within_callback(void)
+{
+ timeouts_scheduled = 0;
+ timeouts_handled = 0;
+
+ main_loop = g_main_loop_new(NULL, FALSE);
+ __connman_log_init("test-jolla-wakeup-timer",
+ g_test_verbose() ? "*" : NULL,
+ FALSE, FALSE,
+ "test-jolla-wakeup-timer", "1");
+ g_assert((__connman_builtin_jolla_wakeup_timer.init)() == 0);
+
+ g_timeout_add(0, create_timeout_within_callback_seed, NULL);
+ g_main_loop_run(main_loop);
+
+ (__connman_builtin_jolla_wakeup_timer.exit)();
+ g_main_loop_unref(main_loop);
+}
+
+int main(int argc, char *argv[])
+{
+ g_test_init(&argc, &argv, NULL);
+
+ g_test_add_func("/wakeup-timer/create-timeout-within-callback",
+ create_timeout_within_callback);
+
+ return g_test_run();
+}
|