[PATCH] build: Add missing binaries and conf files to ignore list
by Saurav Babu
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index 74acd7c..b7cc134 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,10 +36,13 @@ src/connman.conf
src/connman.service
src/net.connman.service
src/*-connman.rules
+src/connman-wait-online.service
+src/connmand-wait-online
plugins/connman.policy
scripts/connman
scripts/openconnect-script
scripts/openvpn-script
+scripts/connman_resolvconf.conf
client/connmanctl
tools/wispr
tools/dhcp-test
--
1.9.1
5 years
[PATCHv2] log: don't require backtrace()
by Yann E. MORIN
Not all toolchains have execinfo.h and backtrace(). For example,
support for it is optional in uClibc, while it is entirely missing
from musl.
In glibc, execinfo.h only declares backtrace() and no other function,
so we can rely on its presence/abscence to determine if we can use
backtrace().
We fix that by:
- adding a ./configure check for execinfo.h;
- moving backtrace to its own file;
- compiling backtrace.c only when execinfo.h was found.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998(a)free.fr>
Cc: Patrik Flykt <Patrik.Flykt(a)linux.intel.com>
---
Changes v1 -> v2:
- move backtrace to its own file and only compile it if execinfo.h was
found (Patrik)
Notes: this makes connman build under uClibc without execinfo.h and
backtrace(), but more work is needed to make it build with musl. I may
be able to work on this in the coming days/week, but I can't make any
hard promise... :-/
---
Makefile.am | 21 +++++---
configure.ac | 3 ++
include/backtrace.h | 32 ++++++++++++
src/backtrace.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++
src/connman.h | 2 +
src/log.c | 105 +--------------------------------------
6 files changed, 189 insertions(+), 112 deletions(-)
create mode 100644 include/backtrace.h
create mode 100644 src/backtrace.c
diff --git a/Makefile.am b/Makefile.am
index fb7c74e..d70725c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,8 @@ noinst_HEADERS = include/rtnl.h include/task.h \
include/dbus.h include/option.h \
include/provider.h include/vpn-dbus.h \
include/utsname.h include/timeserver.h include/proxy.h \
- include/technology.h include/setting.h
+ include/technology.h include/setting.h \
+ include/backtrace.h
local_headers = $(foreach file,$(include_HEADERS) $(nodist_include_HEADERS) \
$(noinst_HEADERS), include/connman/$(notdir $(file)))
@@ -42,6 +43,10 @@ else
gweb_sources += gweb/giognutls.h gweb/gionotls.c
endif
+if BACKTRACE
+backtrace_sources = src/backtrace.c
+endif
+
shared_sources = src/shared/util.h src/shared/util.c \
src/shared/netlink.h src/shared/netlink.c
@@ -101,7 +106,7 @@ MANUAL_PAGES =
sbin_PROGRAMS = src/connmand src/connmand-wait-online
-src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) \
+src_connmand_SOURCES = $(gdhcp_sources) $(gweb_sources) $(backtrace_sources) \
$(builtin_sources) $(shared_sources) src/connman.ver \
src/main.c src/connman.h src/log.c \
src/error.c src/plugin.c src/task.c \
@@ -144,7 +149,7 @@ builtin_vpn_cflags =
sbin_PROGRAMS += vpn/connman-vpnd
-vpn_connman_vpnd_SOURCES = $(builtin_vpn_sources) \
+vpn_connman_vpnd_SOURCES = $(builtin_vpn_sources) $(backtrace_sources) \
$(gweb_sources) vpn/vpn.ver vpn/main.c vpn/vpn.h \
src/log.c src/error.c src/plugin.c src/task.c \
vpn/vpn-manager.c vpn/vpn-provider.c \
@@ -273,8 +278,8 @@ endif
noinst_PROGRAMS += unit/test-ippool
-unit_test_ippool_SOURCES = src/log.c src/dbus.c src/error.c \
- src/ippool.c unit/test-ippool.c
+unit_test_ippool_SOURCES = $(backtrace_sources) src/log.c src/dbus.c \
+ src/error.c src/ippool.c unit/test-ippool.c
unit_test_ippool_LDADD = gdbus/libgdbus-internal.la \
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
@@ -325,12 +330,12 @@ tools_dbus_test_LDADD = gdbus/libgdbus-internal.la @GLIB_LIBS@ @DBUS_LIBS@
tools_polkit_test_LDADD = @DBUS_LIBS@
-tools_iptables_test_SOURCES = src/log.c src/iptables.c tools/iptables-test.c
+tools_iptables_test_SOURCES = $(backtrace_sources) src/log.c src/iptables.c tools/iptables-test.c
tools_iptables_test_LDADD = @GLIB_LIBS@ @XTABLES_LIBS@ -ldl
tools_private_network_test_LDADD = @GLIB_LIBS@ @DBUS_LIBS@
-tools_session_test_SOURCES = src/log.c src/dbus.c src/error.c \
+tools_session_test_SOURCES = $(backtrace_sources) src/log.c src/dbus.c src/error.c \
tools/session-test.c tools/session-utils.c tools/manager-api.c \
tools/session-api.c tools/session-test.h
tools_session_test_LDADD = gdbus/libgdbus-internal.la \
@@ -338,7 +343,7 @@ tools_session_test_LDADD = gdbus/libgdbus-internal.la \
tools_iptables_unit_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ @XTABLES_CFLAGS@ \
-DIPTABLES_SAVE=\""${IPTABLES_SAVE}"\"
-tools_iptables_unit_SOURCES = src/log.c \
+tools_iptables_unit_SOURCES = $(backtrace_sources) src/log.c \
src/iptables.c src/firewall.c src/nat.c tools/iptables-unit.c
tools_iptables_unit_LDADD = gdbus/libgdbus-internal.la \
@GLIB_LIBS@ @DBUS_LIBS@ @XTABLES_LIBS@ -ldl
diff --git a/configure.ac b/configure.ac
index 2cf2e14..9a5a70e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,9 @@ AC_CHECK_LIB(resolv, ns_initparse, dummy=yes, [
AC_MSG_ERROR(resolver library support is required))
])
+AC_CHECK_HEADERS([execinfo.h])
+AM_CONDITIONAL([BACKTRACE], [test "${ac_cv_header_execinfo_h}" = "yes"])
+
AC_CHECK_FUNC(signalfd, dummy=yes,
AC_MSG_ERROR(signalfd support is required))
diff --git a/include/backtrace.h b/include/backtrace.h
new file mode 100644
index 0000000..12a202d
--- /dev/null
+++ b/include/backtrace.h
@@ -0,0 +1,32 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2016 Yann E. MORIN <yann.morin.1998(a)free.fr>. All rights reserved.
+ *
+ * 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
+ *
+ */
+
+#ifndef __CONNMAN_BACKTRACE_H
+#define __CONNMAN_BACKTRACE_H
+
+#ifdef HAVE_EXECINFO_H
+void print_backtrace(const char* program_path, const char* program_exec,
+ unsigned int offset);
+#else
+#define print_backtrace(P,E,O)
+#endif
+
+#endif /* __CONNMAN_BACKTRACE_H */
diff --git a/src/backtrace.c b/src/backtrace.c
new file mode 100644
index 0000000..6a66c0a
--- /dev/null
+++ b/src/backtrace.c
@@ -0,0 +1,138 @@
+/*
+ *
+ * Connection Manager
+ *
+ * Copyright (C) 2007-2013 Intel Corporation. All rights reserved.
+ * Copyright (C) 2016 Yann E. MORIN <yann.morin.1998(a)free.fr>. All rights reserved.
+ *
+ * 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
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <execinfo.h>
+#include <dlfcn.h>
+
+#include "connman.h"
+
+void print_backtrace(const char* program_path, const char* program_exec,
+ unsigned int offset)
+{
+ void *frames[99];
+ size_t n_ptrs;
+ unsigned int i;
+ int outfd[2], infd[2];
+ int pathlen;
+ pid_t pid;
+
+ if (!program_exec)
+ return;
+
+ pathlen = strlen(program_path);
+
+ n_ptrs = backtrace(frames, G_N_ELEMENTS(frames));
+ if (n_ptrs < offset)
+ return;
+
+ if (pipe(outfd) < 0)
+ return;
+
+ if (pipe(infd) < 0) {
+ close(outfd[0]);
+ close(outfd[1]);
+ return;
+ }
+
+ pid = fork();
+ if (pid < 0) {
+ close(outfd[0]);
+ close(outfd[1]);
+ close(infd[0]);
+ close(infd[1]);
+ return;
+ }
+
+ if (pid == 0) {
+ close(outfd[1]);
+ close(infd[0]);
+
+ dup2(outfd[0], STDIN_FILENO);
+ dup2(infd[1], STDOUT_FILENO);
+
+ execlp("addr2line", "-C", "-f", "-e", program_exec, NULL);
+
+ exit(EXIT_FAILURE);
+ }
+
+ close(outfd[0]);
+ close(infd[1]);
+
+ connman_error("++++++++ backtrace ++++++++");
+
+ for (i = offset; i < n_ptrs - 1; i++) {
+ Dl_info info;
+ char addr[20], buf[PATH_MAX * 2];
+ int len, written;
+ char *ptr, *pos;
+
+ dladdr(frames[i], &info);
+
+ len = snprintf(addr, sizeof(addr), "%p\n", frames[i]);
+ if (len < 0)
+ break;
+
+ written = write(outfd[1], addr, len);
+ if (written < 0)
+ break;
+
+ len = read(infd[0], buf, sizeof(buf) - 1);
+ if (len < 0)
+ break;
+
+ buf[len] = '\0';
+
+ pos = strchr(buf, '\n');
+ *pos++ = '\0';
+
+ if (strcmp(buf, "??") == 0) {
+ connman_error("#%-2u %p in %s", i - offset,
+ frames[i], info.dli_fname);
+ continue;
+ }
+
+ ptr = strchr(pos, '\n');
+ *ptr++ = '\0';
+
+ if (strncmp(pos, program_path, pathlen) == 0)
+ pos += pathlen + 1;
+
+ connman_error("#%-2u %p in %s() at %s", i - offset,
+ frames[i], buf, pos);
+ }
+
+ connman_error("+++++++++++++++++++++++++++");
+
+ kill(pid, SIGTERM);
+
+ close(outfd[1]);
+ close(infd[0]);
+}
diff --git a/src/connman.h b/src/connman.h
index 35eb3f5..3049f08 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -135,6 +135,8 @@ void __connman_log_cleanup(gboolean backtrace);
void __connman_log_enable(struct connman_debug_desc *start,
struct connman_debug_desc *stop);
+#include <connman/backtrace.h>
+
#include <connman/option.h>
#include <connman/setting.h>
diff --git a/src/log.c b/src/log.c
index a693bd0..9bae4a3 100644
--- a/src/log.c
+++ b/src/log.c
@@ -30,7 +30,6 @@
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
-#include <execinfo.h>
#include <dlfcn.h>
#include "connman.h"
@@ -110,113 +109,11 @@ void connman_debug(const char *format, ...)
va_end(ap);
}
-static void print_backtrace(unsigned int offset)
-{
- void *frames[99];
- size_t n_ptrs;
- unsigned int i;
- int outfd[2], infd[2];
- int pathlen;
- pid_t pid;
-
- if (!program_exec)
- return;
-
- pathlen = strlen(program_path);
-
- n_ptrs = backtrace(frames, G_N_ELEMENTS(frames));
- if (n_ptrs < offset)
- return;
-
- if (pipe(outfd) < 0)
- return;
-
- if (pipe(infd) < 0) {
- close(outfd[0]);
- close(outfd[1]);
- return;
- }
-
- pid = fork();
- if (pid < 0) {
- close(outfd[0]);
- close(outfd[1]);
- close(infd[0]);
- close(infd[1]);
- return;
- }
-
- if (pid == 0) {
- close(outfd[1]);
- close(infd[0]);
-
- dup2(outfd[0], STDIN_FILENO);
- dup2(infd[1], STDOUT_FILENO);
-
- execlp("addr2line", "-C", "-f", "-e", program_exec, NULL);
-
- exit(EXIT_FAILURE);
- }
-
- close(outfd[0]);
- close(infd[1]);
-
- connman_error("++++++++ backtrace ++++++++");
-
- for (i = offset; i < n_ptrs - 1; i++) {
- Dl_info info;
- char addr[20], buf[PATH_MAX * 2];
- int len, written;
- char *ptr, *pos;
-
- dladdr(frames[i], &info);
-
- len = snprintf(addr, sizeof(addr), "%p\n", frames[i]);
- if (len < 0)
- break;
-
- written = write(outfd[1], addr, len);
- if (written < 0)
- break;
-
- len = read(infd[0], buf, sizeof(buf) - 1);
- if (len < 0)
- break;
-
- buf[len] = '\0';
-
- pos = strchr(buf, '\n');
- *pos++ = '\0';
-
- if (strcmp(buf, "??") == 0) {
- connman_error("#%-2u %p in %s", i - offset,
- frames[i], info.dli_fname);
- continue;
- }
-
- ptr = strchr(pos, '\n');
- *ptr++ = '\0';
-
- if (strncmp(pos, program_path, pathlen) == 0)
- pos += pathlen + 1;
-
- connman_error("#%-2u %p in %s() at %s", i - offset,
- frames[i], buf, pos);
- }
-
- connman_error("+++++++++++++++++++++++++++");
-
- kill(pid, SIGTERM);
-
- close(outfd[1]);
- close(infd[0]);
-}
-
static void signal_handler(int signo)
{
connman_error("Aborting (signal %d) [%s]", signo, program_exec);
- print_backtrace(2);
+ print_backtrace(program_path, program_exec, 2);
exit(EXIT_FAILURE);
}
--
1.9.1
5 years
[TEST 0/4] Clean up gateway selection
by Patrik Flykt
Hi,
In order to clean up gateway selection, the gateway code should use the
sorted list of services instead of sorting the gateways by itself.
The 'order' value in the gateway_data structure follows the service list,
i.e. the default service gets an 'order' value of 1, a VPN without split
routing a value of 10 and the rest a value of 0. This means the gateway
'order' variable gets its values so that the sorting order is the same
between gateways and services in the service list. With that, there are
now two entities that are being sorted, which in turn has caused code
duplication and a non-trivial implementation to decipher for the gateway
selection.
To change the current behavior, a function comparing the ordering between
two services is introduced in patch #1. This function is then used in
patch #3, throwing out the old code as a result. Patch #3 also combines
consecutive if statements.
Patch #2 gets the default service and uses that to look up the corresponding
gateway_data structure instead of iterating over the hash table.
Patch #4 is important, it restores the old functionality so that tests
can be performed on the newly introduced behavior wrt the old one. Should
they differ, a warning is printed out.
After these steps, it is possible to remove the 'order' variable from the
gateway_data struct, I will send the full patch set doing that shortly.
If you are interested in the well-being of ConnMan and apply this patch
set, you MUST report any warnings printed out by these changes to the
mailing list! One thing that we cannot afford is to introduce funny bugs
due to a modification like this.
Cheers,
Patrik
Patrik Flykt (4):
service: Add function to compare the order between two services
connection: Use the sorted service list to find the default gateway
connection: Use services to compare gateway ordering
connection: Make tests to ensure correct gateway selection
src/connection.c | 70 ++++++++++++++++++++++++++++++++++++++++++--------------
src/connman.h | 3 +++
src/service.c | 6 +++++
3 files changed, 62 insertions(+), 17 deletions(-)
--
2.1.4
5 years
[RFC 0/6] Clean up gateway selection
by Patrik Flykt
Hi,
In order to clean up gateway selection, the gateway code should use the
sorted list of services instead of sorting the gateways by itself.
The 'order' value in the gateway_data structure follows the service list,
i.e. the default service gets an 'order' value of 1, a VPN without split
routing a value of 10 and the rest a value of 0. This means the gateway
'order' variable gets its values so that the sorting order is the same
between gateways and services in the service list. With that, there are
now two entities that are being sorted, which in turn has caused code
duplication and a non-trivial implementation to decipher for the gateway
selection.
To change the current behavior, a function comparing the ordering between
two services is introduced in patch #1. This function is then used in
patch #3, throwing out the old code as a result. Patch #3 also combines
consecutive if statements.
Patch #2 gets the default service and uses that to look up the corresponding
gateway_data structure instead of iterating over the hash table.
With the previous ones applied, the 'order' variable is removed in patch #4,
the now unused function __connman_service_update_ordering() in patch #5 and
the TODO is updated in patch #6.
Before applying this patch set please run the "[TEST XX/4] Clean up gateway
selection" patch set to ensure no bugs have been introduced!
Cheers,
Patrik
Patrik Flykt (6):
service: Add function to compare the order between two services
connection: Use the sorted service list to find the default gateway
connection: Use services to compare gateway ordering
connection: Remove 'order' variable
service: Remove obsolete __connman_service_update_ordering() function
TODO: Mark gateway selection simplification done
TODO | 11 ---------
src/connection.c | 75 ++++++++++++++------------------------------------------
src/connman.h | 4 ++-
src/service.c | 12 ++++-----
4 files changed, 28 insertions(+), 74 deletions(-)
--
2.1.4
5 years
[PATCH v2] service: state transition to configuration
by Naveen Singh
From: nasingh <naveensingh0977(a)gmail.com>
When the DHCP renewal fails dhcp_failure is called which in turn calls
__connman_connection_gateway_remove. This function unlike its
counterpart (__connman_connection_gateway_add which does the
service transition to READY) does not the change the state to
CONFIGURATION. This causes the service state to be stuck at ONLINE.
---
src/connection.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/connection.c b/src/connection.c
index aa4e1c0..3cb428c 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -1014,6 +1014,16 @@ void __connman_connection_gateway_remove(struct connman_service *service,
if (data)
set_default_gateway(data, type);
}
+
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV4)
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_CONFIGURATION,
+ CONNMAN_IPCONFIG_TYPE_IPV4);
+
+ if (type == CONNMAN_IPCONFIG_TYPE_IPV6)
+ __connman_service_ipconfig_indicate_state(service,
+ CONNMAN_SERVICE_STATE_CONFIGURATION,
+ CONNMAN_IPCONFIG_TYPE_IPV6);
}
bool __connman_connection_update_gateway(void)
--
2.6.0.rc2.230.g3dd15c0
5 years
Iptable usage in Connman
by Lamsoge, Abhijit
Hi Patrick,
I have few questions regarding IPtable functionality provided by Connman.
1) Does connman currently have support to call iptables functions from an external application over DBUS ?
2) I can see here that, connman iptable is used only in context of firewall related stuff and session/nat , is this true ?
3) Suppose I want to just set a specific rule like "iptables -A INPUT -s xxx.xxx.xxx.xxx -j DROP" from external application what needs to be done ?
4) Test application in tools directory like iptables-test, is linked while compiling connman, how about an separate application which does not link to connman and still is able to call connman IPtable API's , say over Dbus or something else, what needs to be done in this case ?
5) I think, firewall rules are set in context of connman use cases and currently user defined rules cannot be specified, is this true ?
Thanks.
Abhijit
5 years
[PATCH] client: Add support to GetProperties Clock API in connmanctl
by Saurav Babu
---
client/commands.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/client/commands.c b/client/commands.c
index 3bfdfd7..db24d16 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -266,6 +266,33 @@ static int cmd_state(char *args[], int num, struct connman_option *options)
state_print, NULL, NULL, NULL);
}
+static int clock_print(DBusMessageIter *iter, const char *error,
+ void *user_data)
+{
+ DBusMessageIter entry;
+
+ if (error) {
+ fprintf(stderr, "Error: %s", error);
+ return 0;
+ }
+
+ dbus_message_iter_recurse(iter, &entry);
+ __connmanctl_dbus_print(&entry, " ", " = ", "\n");
+ fprintf(stdout, "\n");
+
+ return 0;
+}
+
+static int cmd_clock(char *args[], int num, struct connman_option *options)
+{
+ if (num > 1)
+ return -E2BIG;
+
+ return __connmanctl_dbus_method_call(connection, CONNMAN_SERVICE,
+ CONNMAN_PATH, "net.connman.Clock", "GetProperties",
+ clock_print, NULL, NULL, NULL);
+}
+
static int services_list(DBusMessageIter *iter, const char *error,
void *user_data)
{
@@ -2507,6 +2534,8 @@ static const struct {
"Shows if the system is online or offline", NULL },
{ "technologies", NULL, NULL, cmd_technologies,
"Display technologies", NULL },
+ { "clock", NULL, NULL, cmd_clock,
+ "Get System Clock Properties", NULL },
{ "enable", "<technology>|offline", NULL, cmd_enable,
"Enables given technology or offline mode",
lookup_technology_offline },
--
1.9.1
5 years
[PATCH] client: Add support to print DBUS_TYPE_UINT64
by Saurav Babu
---
client/dbus_helpers.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/client/dbus_helpers.c b/client/dbus_helpers.c
index 9c4cfee..461266c 100644
--- a/client/dbus_helpers.c
+++ b/client/dbus_helpers.c
@@ -38,6 +38,7 @@ void __connmanctl_dbus_print(DBusMessageIter *iter, const char *pre,
dbus_uint16_t u16;
dbus_uint32_t u;
dbus_int32_t i;
+ dbus_uint64_t u64;
double d;
char *str;
@@ -113,6 +114,11 @@ void __connmanctl_dbus_print(DBusMessageIter *iter, const char *pre,
fprintf(stdout, "%d", i);
break;
+ case DBUS_TYPE_UINT64:
+ dbus_message_iter_get_basic(iter, &u64);
+ fprintf(stdout, "%lu", u64);
+ break;
+
case DBUS_TYPE_DOUBLE:
dbus_message_iter_get_basic(iter, &d);
fprintf(stdout, "%f", d);
--
1.9.1
5 years
[PATCH] dnsproxy: send response for all requests
by Saurav Babu
When list->data is removed from GSList using g_slist_remove() then
list->next becomes NULL and the loop terminates. This patch ensures list
points to list->next before removing req from request_list.
---
src/dnsproxy.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index c497f73..06e867a 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2259,9 +2259,11 @@ hangup:
g_free(server->incoming_reply);
server->incoming_reply = NULL;
- for (list = request_list; list; list = list->next) {
+ list = request_list;
+ while (list) {
struct request_data *req = list->data;
struct domain_hdr *hdr;
+ list = list->next;
if (req->protocol == IPPROTO_UDP)
continue;
--
1.9.1
5 years
[PATCH] dhcp: Nameserver issue on IP address renewal after lease expiry.
by Naveen Singh
From: nasingh <naveensingh0977(a)gmail.com>
After lease expiry and releasing its current IP, when device eventually
gets an IP address, DNS resolution stops working. This is because
nameserver list in service structure is empty. On lease expiry when
apply_dhcp_invalidate_on_network(dhcp) is called, it removes
nameservers from the service structure but it does not free namservers in
dhcp structure. Now next time when device gets an IP address and
apply_lease_available_on_network is called, nameserver is not updated as
compare_string_arrays(nameservers, dhcp->nameservers) would return true.
The fix for this would be to free dhcp->nameservers when lease is lost so
that on successful renewal next time, nameserver properly gets updated.
---
src/dhcp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/dhcp.c b/src/dhcp.c
index e4497fc..159fecb 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -114,6 +114,8 @@ static bool apply_dhcp_invalidate_on_network(struct connman_dhcp *dhcp)
__connman_service_nameserver_remove(service,
dhcp->nameservers[i], false);
}
+ g_strfreev(dhcp->nameservers);
+ dhcp->nameservers = NULL;
}
return true;
--
2.6.0.rc2.230.g3dd15c0
5 years