[PATCH] consmetics: remove redundant returns at the end of functions that return void
by Vasyl Vavrychuk
Another purpose of this change is making coded to have a same style.
Previous at some functions there was redundant returns and at some no.
If this returns will be in the end of all void functions it will produce
a lot of noise while reading code.
---
client/commands.c | 6 ------
gdhcp/common.c | 6 ------
gsupplicant/supplicant.c | 1 -
plugins/wifi.c | 2 --
src/config.c | 1 -
src/inet.c | 2 --
src/network.c | 1 -
src/ntp.c | 1 -
src/provider.c | 2 --
src/service.c | 1 -
src/technology.c | 6 ------
src/timeserver.c | 6 ------
12 files changed, 35 deletions(-)
diff --git a/client/commands.c b/client/commands.c
index 05b9316..bf3531f 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -792,8 +792,6 @@ static void move_before_append_args(DBusMessageIter *iter, void *user_data)
dbus_message_iter_append_basic(iter,
DBUS_TYPE_OBJECT_PATH, &path);
-
- return;
}
static int cmd_service_move_before(char *args[], int num,
@@ -852,8 +850,6 @@ static void move_after_append_args(DBusMessageIter *iter, void *user_data)
dbus_message_iter_append_basic(iter,
DBUS_TYPE_OBJECT_PATH, &path);
-
- return;
}
static int cmd_service_move_after(char *args[], int num,
@@ -1930,8 +1926,6 @@ static void session_create_append_dict(DBusMessageIter *iter, void *user_data)
index += append.values;
}
-
- return;
}
static void session_create_append(DBusMessageIter *iter, void *user_data)
diff --git a/gdhcp/common.c b/gdhcp/common.c
index 27f14dd..8f7a65c 100644
--- a/gdhcp/common.c
+++ b/gdhcp/common.c
@@ -297,8 +297,6 @@ void dhcp_add_option_uint32(struct dhcp_packet *packet, uint8_t code,
put_be32(data, option + OPT_DATA);
dhcp_add_binary_option(packet, option);
-
- return;
}
void dhcp_add_option_uint16(struct dhcp_packet *packet, uint8_t code,
@@ -314,8 +312,6 @@ void dhcp_add_option_uint16(struct dhcp_packet *packet, uint8_t code,
put_be16(data, option + OPT_DATA);
dhcp_add_binary_option(packet, option);
-
- return;
}
void dhcp_add_option_uint8(struct dhcp_packet *packet, uint8_t code,
@@ -331,8 +327,6 @@ void dhcp_add_option_uint8(struct dhcp_packet *packet, uint8_t code,
option[OPT_DATA] = data;
dhcp_add_binary_option(packet, option);
-
- return;
}
void dhcp_init_header(struct dhcp_packet *packet, char type)
diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
index 5246c80..0cb621b 100644
--- a/gsupplicant/supplicant.c
+++ b/gsupplicant/supplicant.c
@@ -1501,7 +1501,6 @@ static void interface_network_added(DBusMessageIter *iter, void *user_data)
static void interface_network_removed(DBusMessageIter *iter, void *user_data)
{
SUPPLICANT_DBG("");
- return;
}
static char *create_name(unsigned char *ssid, int ssid_len)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index ef8f435..1288c15 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2732,8 +2732,6 @@ static void ap_create_fail(GSupplicantInterface *interface)
g_free(wifi->tethering_param);
wifi->tethering_param = NULL;
}
-
- return;
}
static unsigned char calculate_strength(GSupplicantNetwork *supplicant_network)
diff --git a/src/config.c b/src/config.c
index 4178ea8..07ae64e 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1703,7 +1703,6 @@ void connman_config_free_entries(struct connman_config_entry **entries)
}
g_free(entries);
- return;
}
bool __connman_config_address_provisioned(const char *address,
diff --git a/src/inet.c b/src/inet.c
index f6d9e9a..8337949 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -2523,8 +2523,6 @@ out:
data->callback(addr, index, data->user_data);
g_free(data);
-
- return;
}
/*
diff --git a/src/network.c b/src/network.c
index dd3f238..47a239c 100644
--- a/src/network.c
+++ b/src/network.c
@@ -844,7 +844,6 @@ static void receive_refresh_rs_reply(struct nd_router_advert *reply,
network->router_solicit_refresh_count = 0;
connman_network_unref(network);
- return;
}
int __connman_network_refresh_rs_ipv6(struct connman_network *network,
diff --git a/src/ntp.c b/src/ntp.c
index 44320fc..db2ad01 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -580,7 +580,6 @@ err:
close(nd->transmit_fd);
nd->cb(false, nd->user_data);
- return;
}
int __connman_ntp_start(char *server, __connman_ntp_cb_t callback,
diff --git a/src/provider.c b/src/provider.c
index 9c71a20..892d0fb 100644
--- a/src/provider.c
+++ b/src/provider.c
@@ -745,8 +745,6 @@ static void provider_service_changed(struct connman_service *service,
DBG("disconnect %p index %d", provider, vpn_index);
connman_provider_disconnect(provider);
-
- return;
}
static struct connman_notifier provider_notifier = {
diff --git a/src/service.c b/src/service.c
index 326bfa3..4f11bd9 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4211,7 +4211,6 @@ void __connman_service_set_provider_pending(struct connman_service *service,
}
service->provider_pending = msg;
- return;
}
static void check_pending_msg(struct connman_service *service)
diff --git a/src/technology.c b/src/technology.c
index f25be12..bd2e06a 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -196,8 +196,6 @@ done:
__connman_storage_save_global(keyfile);
g_key_file_free(keyfile);
-
- return;
}
static void tethering_changed(struct connman_technology *technology)
@@ -435,8 +433,6 @@ done:
g_free(identifier);
g_key_file_free(keyfile);
-
- return;
}
bool __connman_technology_get_offlinemode(void)
@@ -474,8 +470,6 @@ static void connman_technology_save_offlinemode(void)
}
g_key_file_free(keyfile);
-
- return;
}
static bool connman_technology_load_offlinemode(void)
diff --git a/src/timeserver.c b/src/timeserver.c
index f9467a2..4752aa3 100644
--- a/src/timeserver.c
+++ b/src/timeserver.c
@@ -75,8 +75,6 @@ static void save_timeservers(char **servers)
__connman_storage_save_global(keyfile);
g_key_file_free(keyfile);
-
- return;
}
static char **load_timeservers(void)
@@ -161,8 +159,6 @@ static void timeserver_sync_start(void)
resolv_id = g_resolv_lookup_hostname(resolv, ts_current,
resolv_result, NULL);
-
- return;
}
static gboolean timeserver_sync_restart(gpointer user_data)
@@ -214,8 +210,6 @@ static void sync_next()
resolv_id = g_resolv_lookup_hostname(resolv, ts_current,
resolv_result, NULL);
-
- return;
}
GSList *__connman_timeserver_add_list(GSList *server_list,
--
2.7.4
2 years, 4 months
[PATCH] p2p: 'scan p2p' causes stop autoscan even after scan p2p finishes
by Vasyl Vavrychuk
---
plugins/wifi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index ef8f435..abc9b8a 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1784,7 +1784,7 @@ static gboolean p2p_find_stop(gpointer data)
connman_device_set_scanning(device, CONNMAN_SERVICE_TYPE_P2P, false);
connman_device_unref(device);
- reset_autoscan(device);
+ start_autoscan(device);
return FALSE;
}
--
2.7.4
2 years, 4 months
[PATCH v2] plugins: ethernet: get rid of truncate warning
by Marcus Folkesson
The buffer will never be truncated in reality, but it is the only
warning during compile... so get rid of it.
Increase group buffer size to not make snprintf nervous about truncating
something.
Warning:
----------------------->8-----------------------------------
plugins/ethernet.c: In function ‘ethernet_newlink’:
plugins/ethernet.c:208:52: warning: ‘__builtin___snprintf_chk’ output may be truncated before the last format character [-Wformat-truncation=]
snprintf(group, sizeof(group), "p%02x_%03x_cable", dsaport, vid);
^
In file included from /usr/include/stdio.h:862,
from plugins/ethernet.c:31:
/usr/include/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output between 14 and 17 bytes into a destination of size 16
return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__bos (__s), __fmt, __va_arg_pack ());
----------------------->8-----------------------------------
Signed-off-by: Marcus Folkesson <marcus.folkesson(a)gmail.com>
---
Notes:
v2:
increase buffer size instead of changing types of dsa_port. Feels more clean.
plugins/ethernet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/ethernet.c b/plugins/ethernet.c
index 935c9671..4b265621 100644
--- a/plugins/ethernet.c
+++ b/plugins/ethernet.c
@@ -192,7 +192,7 @@ static void add_network(struct connman_device *device,
}
if (!eth_tethering) {
- char group[16] = "cable";
+ char group[25] = "cable";
int vid, dsaport;
vid = get_vlan_vid(ifname);
--
2.18.0
2 years, 4 months
RE: [PATCH] ipconfig: Incase of Manual IP Configuration, saving Gateway information during network switch
by Rahul Jain
Dear Daniel,
Please find my inputs for your question:-
[Q]Does the initial network have a proper configuration, that is it contains a valid gateway? If so why is it missing when we reach __connman_ipfconfig_save()? Do we call __connman_ipconfig_save() too late?
[A] Scenario:
1. User configured manual IP configuration in wired network with valid details (IP, Gateway, DNS etc)
>> Yes, wired network has proper configuration and connection was successful.
2. Now, user switches from wired to wireless and wireless connection successful.
>> As during wired network disconnection, __connman_connection_gateway_remove() will be called with type 3 (IPv4 + IPv6), where do_ipv4 = do_ipv6 = true; -> g_hash_table_remove(gateway_hash, service); -> remove_gateway() will make gateway null.
Immediately, when service_save()->__connman_ipconfig_save() is called for wired service,at that time, as gateway is null, so valid gateway which was stored already inside /var/lib/connman will be deleted.
As per your question, yes __connman_ipconfig_save is being called after __connman_connection_gateway_remove().
3. Now, user switches from wireless to wired.
>> As stored profile inside /var/lib/connman doesn't have gateway, so wired connection will fail.
Please let us know your opinion.
Thanks
Rahul Jain | SRI-Delhi-Platform S/W 2 Team
* rahul.jain(a)samsung.com | ( +91-99101-84111
--------- Original Message ---------
Sender : connman-request(a)lists.01.org <connman-request(a)lists.01.org>
Date : 2018-08-26 00:30 (GMT+5:30)
Title : connman Digest, Vol 34, Issue 14
Send connman mailing list submissions to
connman(a)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-request(a)lists.01.org
You can reach the person managing the list at
connman-owner(a)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. Re: [Question]: Scan schedule (Daniel Wagner)
2. Re: [PATCH] ipconfig: Incase of Manual IP Configuration,
saving Gateway information during network switch (Daniel Wagner)
3. Re: [PATCH] [dnsproxy] Simplified udp_server_event()
(Daniel Wagner)
----------------------------------------------------------------------
Message: 1
Date: Sat, 25 Aug 2018 17:14:34 +0200
From: Daniel Wagner <wagi(a)monom.org>
To: M?ns Zigher <mans.zigher(a)gmail.com>
Cc: connman@lists.01.org
Subject: Re: [Question]: Scan schedule
Message-ID: <18919cc0-7b04-bf03-df95-f2b4143c99b7(a)monom.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi M?ns,
On 08/23/2018 11:44 AM, M?ns Zigher wrote:
> I am developing an application that is using the dbus api. The
> application will setup the wifi for the unit. I am struggling a bit to
> see the best practice for making sure we have fully updated list of
> services. I know I can configure connman to automatically scan by
> using?BackgroundScanning which is by default set to true. Is the best
> practice to let connman manage the scanning or should my application
> trigger a scan whenever needed. The default scan schedule for connman is
> not enough as I see it but I know you can setup a scan schedule in
> wpa_supplicant but it looks like connman is starting wpa_supplicant so I
> am not sure how to change this default scan schedule that connman is
> setting up. Any comments are appreciated.
The theory is that the application/user shouldn't worry about scanning.
Even ConnMan shouldn't worry about this. Unfortunately, wpa_supplicant
doesn't do the full job. That's why ConnMan's wpa_supplicant plugin is
so complex (a mess).
Obviously, there are scenarios where you want to tell ConnMan do a scan
now. But you should not constantly tell ConnMan to do a scan. I am sure
this will have some nasty side effects.
Alternatively, you could give iwd a try. Though the current plugin is
only supported the very basic stuff. Needs some more work.
Thanks,
Daniel
------------------------------
Message: 2
Date: Sat, 25 Aug 2018 17:50:12 +0200
From: Daniel Wagner <wagi(a)monom.org>
To: rahul.jain@samsung.com
Cc: "connman(a)lists.01.org" <connman(a)lists.01.org>, AMIT KUMAR JAISWAL
<amit.jaiswal(a)samsung.com>, Craig McQueen
<craig.mcqueen(a)innerrange.com>
Subject: Re: [PATCH] ipconfig: Incase of Manual IP Configuration,
saving Gateway information during network switch
Message-ID: <fecf173e-d802-7338-448d-bc6fd734a3e0(a)monom.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi Rahul,
You getting better with the patch submission. I really appreciate your
effort!
On 08/23/2018 01:55 PM, Rahul Jain wrote:
> Subject: [PATCH] ipconfig: Incase of Manual IP Configuration, saving Gateway
> information during network switch
This seems to be a repetition of the emails subject. I usually send my
changes out with 'git format-patch' and 'git send-email'.
Anyway, try to trip the subject a bit. Just mention what you change.
Maybe something like 'Save gateway information'
> [Problem] If user use manual IP configuration while connect with network(suppose wired).
> Then during network switch (suppose from wired to wireless), gateway will not be saved into
> /var/lib/connman respective profile settings.
> So when user come back to earlier network(suppose wired again),
> then connection will fail as connman does not have gateway(wrong gateway as 0.0.0.0) to connect.
>
> [Solution] When device switch from wired to wireless network, gateway information was missed
> to be saved into /var/lib/connman respective profile. So during Network switch
> service_save()->__connman_ipconfig_save() will not remove "IPV4.gateway" key
> from respective profile settings file.
Format your commit message so that you don't exceed the 80 chars per line.
> Signed-off-by: Rahul Jain <rahul.jain(a)samsung.com>
We don't do Signed-off-by at this project.
> ---
> src/ipconfig.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/src/ipconfig.c b/src/ipconfig.c
> index 2565773..a2e398d 100644
> --- a/src/ipconfig.c
> +++ b/src/ipconfig.c
> @@ -2346,8 +2346,6 @@ int __connman_ipconfig_save(struct connman_ipconfig *ipconfig,
> if (ipconfig->address->gateway)
> g_key_file_set_string(keyfile, identifier,
> key, ipconfig->address->gateway);
> - else
> - g_key_file_remove_key(keyfile, identifier, key, NULL);
> g_free(key);
The g_key_file_remove_key() has been added by Craig: 60facabb03a9
("ipconfig: Remove IPv4.gateway key in settings if gateway is not
configured").
I am not sure if I am really understand the problem you want to fix. The
code you are deleting seems quite reasonable. If gateway is valid
(!NULL) save it, otherwise remove it. (The code above these lines should
probably do the same but that's a different story).
Does the initial network have a proper configuration, that is it
contains a valid gateway? If so why is it missing when we reach
__connman_ipfconfig_save()? Do we call __connman_ipconfig_save() too late?
Thanks,
Daniel
------------------------------
Message: 3
Date: Sat, 25 Aug 2018 17:53:54 +0200
From: Daniel Wagner <wagi(a)monom.org>
To: Slava Monich <slava.monich(a)jolla.com>
Cc: connman@lists.01.org
Subject: Re: [PATCH] [dnsproxy] Simplified udp_server_event()
Message-ID: <129d7dc7-84a5-baad-b79d-d9fb9ee07fe8(a)monom.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Hi Slava,
Patch applied.
Thanks,
Daniel
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
connman(a)lists.01.org
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 34, Issue 14
***************************************
2 years, 4 months
[PATCH 0/7] ACD & valgrind cleanups
by Daniel Wagner
Just a bunch of cleanups and memory leak fixes.
Daniel Wagner (7):
acd: Add acd_host_free() deallocator
list-services: Decode LastAddressConflict
main: Rename CONF_AUTO_CONNECT to CONF_AUTO_CONNECT_TECHS
main: Reset error variable before parsing
firewall-nftables: Disable debug output on default
firewall-nftables: Initialize command buffers before using
dnsproxy: Free gresolv on exit
include/acd.h | 1 +
src/acd.c | 12 ++++++++++--
src/dnsproxy.c | 5 +++++
src/firewall-nftables.c | 8 +++++++-
src/main.c | 10 ++++++----
src/network.c | 2 +-
test/list-services | 5 ++++-
7 files changed, 34 insertions(+), 9 deletions(-)
--
2.14.4
2 years, 4 months
[PATCH] [dnsproxy] Simplified udp_server_event()
by Slava Monich
---
src/dnsproxy.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 1db3eae..49bc395 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2231,7 +2231,7 @@ static gboolean udp_server_event(GIOChannel *channel, GIOCondition condition,
gpointer user_data)
{
unsigned char buf[4096];
- int sk, err, len;
+ int sk, len;
struct server_data *data = user_data;
if (condition & (G_IO_NVAL | G_IO_ERR | G_IO_HUP)) {
@@ -2243,12 +2243,9 @@ static gboolean udp_server_event(GIOChannel *channel, GIOCondition condition,
sk = g_io_channel_unix_get_fd(channel);
len = recv(sk, buf, sizeof(buf), 0);
- if (len < 12)
- return TRUE;
- err = forward_dns_reply(buf, len, IPPROTO_UDP, data);
- if (err < 0)
- return TRUE;
+ if (len >= 12)
+ forward_dns_reply(buf, len, IPPROTO_UDP, data);
return TRUE;
}
--
1.9.1
2 years, 4 months
[PATCH] ipconfig: Incase of Manual IP Configuration, saving Gateway information during network switch
by Rahul Jain
Subject: [PATCH] ipconfig: Incase of Manual IP Configuration, saving Gateway
information during network switch
[Problem] If user use manual IP configuration while connect with network(suppose wired).
Then during network switch (suppose from wired to wireless), gateway will not be saved into
/var/lib/connman respective profile settings.
So when user come back to earlier network(suppose wired again),
then connection will fail as connman does not have gateway(wrong gateway as 0.0.0.0) to connect.
[Solution] When device switch from wired to wireless network, gateway information was missed
to be saved into /var/lib/connman respective profile. So during Network switch
service_save()->__connman_ipconfig_save() will not remove "IPV4.gateway" key
from respective profile settings file.
Signed-off-by: Rahul Jain <rahul.jain(a)samsung.com>
---
src/ipconfig.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 2565773..a2e398d 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -2346,8 +2346,6 @@ int __connman_ipconfig_save(struct connman_ipconfig *ipconfig,
if (ipconfig->address->gateway)
g_key_file_set_string(keyfile, identifier,
key, ipconfig->address->gateway);
- else
- g_key_file_remove_key(keyfile, identifier, key, NULL);
g_free(key);
return 0;
--
2.7.4
2 years, 4 months
[PATCH] service: do not reply twice to Connect
by Benoît Monin
Calling Connect an a service sometime triggers the following error message in
the log:
dbus-daemon[591]: [system] Rejected send message, 0 matched rules;
type="method_return", sender=":1.139" (uid=0 pid=27373
comm="/usr/sbin/connmand -n -d ") interface="(unset)" member="(unset)" error
name="(unset)" requested_reply="0" destination=":1.141" (uid=0 pid=27384
comm="/usr/bin/connmanctl ")
This is caused by connmand replying twice to the Connect method. It can be
reproduced by calling connect on a manually configured ethernet service while
checking the dbus exchange with dbus-monitor. The dbus daemon rejects the
second reply since there is no corresponding method call.
Fix this by exiting connect_service before sending another reply if the
pending reply has already been sent.
---
src/service.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/service.c b/src/service.c
index 1a7576f6..c7f6b7cf 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4339,7 +4339,8 @@ static DBusMessage *connect_service(DBusConnection *conn,
if (service->pending) {
dbus_message_unref(service->pending);
service->pending = NULL;
- }
+ } else
+ return NULL;
if (err < 0)
return __connman_error_failed(msg, -err);
2 years, 4 months