Send connman mailing list submissions to connman@lists.01.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.01.org/mailman/listinfo/connman or, via email, send a message with subject or body 'help' to connman-requ...@lists.01.org
You can reach the person managing the list at connman-ow...@lists.01.org When replying, please edit your Subject line so it is more specific than "Re: Contents of connman digest..." Today's Topics: 1. [PATCH] rfkill: Open /dev/rfkill read-only if we are only reading from it (Slava Monich) 2. [PATCH 02/16] common: Check setsockopt() retval (Peter Meerwald-Stadler) 3. [PATCH 00/16] Coverity warnings and cleanup (Peter Meerwald-Stadler) 4. [PATCH 03/16] ntp: Fix unused value (Peter Meerwald-Stadler) 5. [PATCH 04/16] gdhcp: Fix potential NULL deref (Peter Meerwald-Stadler) 6. [PATCH 01/16] dhcpv6: Check setsockopt() retval (Peter Meerwald-Stadler) 7. [PATCH 05/16] ofono: Fix potential NULL deref (Peter Meerwald-Stadler) 8. [PATCH 06/16] peer_service: Setting retval ignored, always overwritten (Peter Meerwald-Stadler) 9. [PATCH 07/16] dhcpv6: Remove pointless compute_random() helper (Peter Meerwald-Stadler) 10. [PATCH 08/16] build: Fix whitespace Makefile.am (Peter Meerwald-Stadler) 11. [PATCH 09/16] util: Make file handle of /dev/urandom static (Peter Meerwald-Stadler) ---------------------------------------------------------------------- Message: 1 Date: Sat, 17 Sep 2016 13:14:08 +0300 From: Slava Monich <slava.mon...@jolla.com> To: connman@lists.01.org Subject: [PATCH] rfkill: Open /dev/rfkill read-only if we are only reading from it Message-ID: <1474107248-6314-1-git-send-email-slava.mon...@jolla.com> --- src/rfkill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rfkill.c b/src/rfkill.c index 2bfb092..d9bed4d 100644 --- a/src/rfkill.c +++ b/src/rfkill.c @@ -196,7 +196,7 @@ int __connman_rfkill_init(void) DBG(""); - fd = open("/dev/rfkill", O_RDWR | O_CLOEXEC); + fd = open("/dev/rfkill", O_RDONLY | O_CLOEXEC); if (fd < 0) { connman_error("Failed to open RFKILL control device"); return -EIO; -- 1.9.1 ------------------------------ Message: 2 Date: Sat, 17 Sep 2016 13:05:22 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 02/16] common: Check setsockopt() retval Message-ID: <1474110336-13602-3-git-send-email-pme...@pmeerw.net> CID 1075205, 1075204 --- gdhcp/common.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gdhcp/common.c b/gdhcp/common.c index b23cadf..3cc6a09 100644 --- a/gdhcp/common.c +++ b/gdhcp/common.c @@ -644,7 +644,10 @@ int dhcp_send_kernel_packet(struct dhcp_packet *dhcp_pkt, if (fd < 0) return -errno; - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { + close(fd); + return -errno; + } memset(&client, 0, sizeof(client)); client.sin_family = AF_INET; @@ -685,7 +688,10 @@ int dhcp_l3_socket(int port, const char *interface, int family) if (fd < 0) return -errno; - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { + close(fd); + return -errno; + } if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, interface, strlen(interface) + 1) < 0) { -- 2.7.4 ------------------------------ Message: 3 Date: Sat, 17 Sep 2016 13:05:20 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 00/16] Coverity warnings and cleanup Message-ID: <1474110336-13602-1-git-send-email-pme...@pmeerw.net> patches 1 to 6 address issues flagged by Coverity patch 7 removes necessary code and an invalid comment patches 8 and 9 are cleanup patch 10 addresses a Coverity issue patch 11 removes unused code patches 12 to 16 unifies get_random() code and moves it into shared/ Peter Meerwald-Stadler (16): dhcpv6: Check setsockopt() retval common: Check setsockopt() retval ntp: Fix unused value gdhcp: Fix potential NULL deref ofono: Fix potential NULL deref peer_service: Setting retval ignored, always overwritten dhcpv6: Remove pointless compute_random() helper build: Fix whitespace Makefile.am util: Make file handle of /dev/urandom static util: Reading from /dev/urandom ignores the number of bytes read shared: Drop unused shared/debugfs.c|.h shared: Add util_get_random() gdhcp: Use util_get_random() gdhcp: Remove dhcp_get_random() Use util_get_random() Remove __connman_util_get_random() Makefile.am | 8 ++--- gdhcp/client.c | 10 +++--- gdhcp/common.c | 53 ++++++++----------------------- gdhcp/common.h | 1 + gdhcp/gdhcp.h | 3 -- gdhcp/ipv4ll.c | 7 ++--- plugins/ofono.c | 3 +- src/config.c | 4 ++- src/connman.h | 3 -- src/dhcp.c | 2 -- src/dhcpv6.c | 20 +++++------- src/dnsproxy.c | 4 +-- src/main.c | 4 +-- src/ntp.c | 3 +- src/peer_service.c | 3 -- src/shared/debugfs.c | 66 --------------------------------------- src/shared/debugfs.h | 24 -------------- src/shared/util.c | 45 +++++++++++++++++++++++++++ src/shared/util.h | 5 +++ src/util.c | 88 ---------------------------------------------------- 20 files changed, 95 insertions(+), 261 deletions(-) delete mode 100644 src/shared/debugfs.c delete mode 100644 src/shared/debugfs.h delete mode 100644 src/util.c -- 2.7.4 ------------------------------ Message: 4 Date: Sat, 17 Sep 2016 13:05:23 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 03/16] ntp: Fix unused value Message-ID: <1474110336-13602-4-git-send-email-pme...@pmeerw.net> msg.poll is assigned twice, the first assignment should probably be a comment RFC5905 specifies MINPOLL 6 and MAXPOLL 17 CID 1352485 --- src/ntp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ntp.c b/src/ntp.c index 3da1018..0829570 100644 --- a/src/ntp.c +++ b/src/ntp.c @@ -172,8 +172,7 @@ static void send_packet(int fd, struct sockaddr *server, uint32_t timeout) memset(&msg, 0, sizeof(msg)); msg.flags = NTP_FLAGS_ENCODE(NTP_FLAG_LI_NOTINSYNC, NTP_FLAG_VN_VER4, NTP_FLAG_MD_CLIENT); - msg.poll = 4; // min - msg.poll = 10; // max + msg.poll = 10; /* minimum value is 4 */ msg.precision = NTP_PRECISION_S; if (server->sa_family == AF_INET) { -- 2.7.4 ------------------------------ Message: 5 Date: Sat, 17 Sep 2016 13:05:24 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 04/16] gdhcp: Fix potential NULL deref Message-ID: <1474110336-13602-5-git-send-email-pme...@pmeerw.net> packet6 is not set if dhcpv6_recv_l3_packet() returns an error CID 1352473 --- gdhcp/client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gdhcp/client.c b/gdhcp/client.c index e9e38e7..af1b953 100644 --- a/gdhcp/client.c +++ b/gdhcp/client.c @@ -2289,6 +2289,8 @@ static gboolean listener_event(GIOChannel *channel, GIOCondition condition, if (dhcp_client->type == G_DHCP_IPV6) { re = dhcpv6_recv_l3_packet(&packet6, buf, sizeof(buf), dhcp_client->listener_sockfd); + if (re < 0) + return TRUE; pkt_len = re; pkt = packet6; xid = packet6->transaction_id[0] << 16 | -- 2.7.4 ------------------------------ Message: 6 Date: Sat, 17 Sep 2016 13:05:21 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 01/16] dhcpv6: Check setsockopt() retval Message-ID: <1474110336-13602-2-git-send-email-pme...@pmeerw.net> CID 1352468 --- gdhcp/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdhcp/common.c b/gdhcp/common.c index 3817bcc..b23cadf 100644 --- a/gdhcp/common.c +++ b/gdhcp/common.c @@ -490,7 +490,10 @@ int dhcpv6_send_packet(int index, struct dhcpv6_packet *dhcp_pkt, int len) if (fd < 0) return -errno; - setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { + close(fd); + return -errno; + } memset(&src, 0, sizeof(src)); src.sin6_family = AF_INET6; -- 2.7.4 ------------------------------ Message: 7 Date: Sat, 17 Sep 2016 13:05:25 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 05/16] ofono: Fix potential NULL deref Message-ID: <1474110336-13602-6-git-send-email-pme...@pmeerw.net> could probably also remove if (!modem->context_list) and assert that modem->context_list is NULL CID 1352472 --- plugins/ofono.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/ofono.c b/plugins/ofono.c index 651cdaa..b6616e7 100644 --- a/plugins/ofono.c +++ b/plugins/ofono.c @@ -1801,7 +1801,8 @@ static void add_cdma_network(struct modem_data *modem) context = network_context_alloc(modem->path); modem->context_list = g_slist_prepend(modem->context_list, context); - } + } else + context = modem->context_list->data; if (!modem->name) modem->name = g_strdup("CDMA Network"); -- 2.7.4 ------------------------------ Message: 8 Date: Sat, 17 Sep 2016 13:05:26 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 06/16] peer_service: Setting retval ignored, always overwritten Message-ID: <1474110336-13602-7-git-send-email-pme...@pmeerw.net> CID 1352484 --- src/peer_service.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/peer_service.c b/src/peer_service.c index 053672a..a457bff 100644 --- a/src/peer_service.c +++ b/src/peer_service.c @@ -293,9 +293,6 @@ int __connman_peer_service_register(const char *owner, DBusMessage *msg, if (service) { DBG("Found one existing service %p", service); - if (g_strcmp0(service->owner, owner)) - ret = -EBUSY; - if (service->pending) ret = -EINPROGRESS; else -- 2.7.4 ------------------------------ Message: 9 Date: Sat, 17 Sep 2016 13:05:27 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 07/16] dhcpv6: Remove pointless compute_random() helper Message-ID: <1474110336-13602-8-git-send-email-pme...@pmeerw.net> the comment "Make sure the value is always positive so strip MSB" is not appropriate, a guint is always positive, no need to strip one bit --- src/dhcpv6.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 1bd0000..4346817 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -105,20 +105,14 @@ static void clear_timer(struct connman_dhcpv6 *dhcp) } } -static inline guint get_random(void) +static guint compute_random(guint val) { - uint64_t val; - - __connman_util_get_random(&val); + uint64_t rand; - /* Make sure the value is always positive so strip MSB */ - return ((uint32_t)val) >> 1; -} + __connman_util_get_random(&rand); -static guint compute_random(guint val) -{ return val - val / 10 + - (get_random() % (2 * 1000)) * val / 10 / 1000; + ((guint) rand % (2 * 1000)) * val / 10 / 1000; } /* Calculate a random delay, RFC 3315 chapter 14 */ -- 2.7.4 ------------------------------ Message: 10 Date: Sat, 17 Sep 2016 13:05:28 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 08/16] build: Fix whitespace Makefile.am Message-ID: <1474110336-13602-9-git-send-email-pme...@pmeerw.net> --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 9c13630..96a305d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -377,7 +377,7 @@ endif tools_dnsproxy_test_SOURCES = tools/dnsproxy-test.c tools_dnsproxy_test_LDADD = @GLIB_LIBS@ -tools_netlink_test_SOURCES =$(shared_sources) tools/netlink-test.c +tools_netlink_test_SOURCES = $(shared_sources) tools/netlink-test.c tools_netlink_test_LDADD = @GLIB_LIBS@ endif -- 2.7.4 ------------------------------ Message: 11 Date: Sat, 17 Sep 2016 13:05:29 +0200 From: Peter Meerwald-Stadler <pme...@pmeerw.net> To: Patrik Flykt <patrik.fl...@linux.intel.com> Cc: connman@lists.01.org Subject: [PATCH 09/16] util: Make file handle of /dev/urandom static Message-ID: <1474110336-13602-10-git-send-email-pme...@pmeerw.net> --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index da32cc5..d9cb905 100644 --- a/src/util.c +++ b/src/util.c @@ -36,7 +36,7 @@ #define URANDOM "/dev/urandom" -int f = -1; +static int f = -1; int __connman_util_get_random(uint64_t *val) { -- 2.7.4 ------------------------------ Subject: Digest Footer _______________________________________________ connman mailing list connman@lists.01.org https://lists.01.org/mailman/listinfo/connman ------------------------------ End of connman Digest, Vol 11, Issue 19 ***************************************