From: Denis Kenzior <denkenz@gmail.com>
To: iwd@lists.01.org
Subject: Re: [PATCH 7/9] netconfig: Move loading settings to new method, refactor
Date: Wed, 25 Aug 2021 08:50:56 -0500 [thread overview]
Message-ID: <6b81dfe5-686e-5ad7-762a-1133d85a7de5@gmail.com> (raw)
In-Reply-To: <20210823141430.223543-7-andrew.zaborowski@intel.com>
[-- Attachment #1: Type: text/plain, Size: 3171 bytes --]
On 8/23/21 9:14 AM, Andrew Zaborowski wrote:
> Split loading settings out of network_configure into a new method,
> network_load_settings. Make sure both consistently handle errors by
> printing messages and informing the caller.
> ---
> src/netconfig.c | 157 +++++++++++++++++++++++++++++++-----------------
> src/netconfig.h | 5 +-
> src/p2p.c | 12 +++-
> src/station.c | 20 +++---
> 4 files changed, 127 insertions(+), 67 deletions(-)
>
CC src/netconfig.o
src/netconfig.c: In function ‘netconfig_get_static4_address’:
src/netconfig.c:298:5: error: implicit declaration of function
‘util_netmask_from_prefix’ [-Werror=implicit-function-declaration]
298 | util_netmask_from_prefix(prefix_len)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/netconfig.c:297:29: error: comparison of integer expressions of different
signedness: ‘__uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
297 | if (ntohl(in_addr.s_addr) !=
| ^~
cc1: all warnings being treated as errors
<snip>
> @@ -998,22 +997,22 @@ static int validate_dns_list(int family, char **dns_list)
> return n_valid;
> }
>
> -bool netconfig_configure(struct netconfig *netconfig,
> +bool netconfig_load_settings(struct netconfig *netconfig,
> const struct l_settings *active_settings,
> - const uint8_t *mac_address,
> - netconfig_notify_func_t notify, void *user_data)
> + const uint8_t *mac_address)
> {
> char *mdns;
> - char hostname[HOST_NAME_MAX + 1];
> bool send_hostname;
> + bool enabled;
>
> + l_strfreev(netconfig->dns4_overrides);
? shouldn't this be taken care of by netconfig_reset? We generally don't like
side-effects in our APIs.
> netconfig->dns4_overrides = l_settings_get_string_list(active_settings,
> "IPv4", "DNS", ' ');
>
> if (netconfig->dns4_overrides) {
> int r = validate_dns_list(AF_INET, netconfig->dns4_overrides);
>
> - if (r <= 0) {
> + if (unlikely(r <= 0)) {
> l_strfreev(netconfig->dns4_overrides);
> netconfig->dns4_overrides = NULL;
> }
> @@ -1022,13 +1021,14 @@ bool netconfig_configure(struct netconfig *netconfig,
> l_error("netconfig: Empty IPv4.DNS entry, skipping...");
> }
>
> + l_strfreev(netconfig->dns6_overrides);
Same here?
> netconfig->dns6_overrides = l_settings_get_string_list(active_settings,
> "IPv6", "DNS", ' ');
>
> if (netconfig->dns6_overrides) {
> int r = validate_dns_list(AF_INET6, netconfig->dns6_overrides);
>
> - if (r <= 0) {
> + if (unlikely(r <= 0)) {
> l_strfreev(netconfig->dns6_overrides);
> netconfig->dns6_overrides = NULL;
> }
> @@ -1038,8 +1038,6 @@ bool netconfig_configure(struct netconfig *netconfig,
> }
>
> netconfig->active_settings = active_settings;
Do we even need active settings now?
> - netconfig->notify = notify;
> - netconfig->user_data = user_data;
>
> l_dhcp_client_set_address(netconfig->dhcp_client, ARPHRD_ETHER,
> mac_address, ETH_ALEN);
Regards,
-Denis
next prev parent reply other threads:[~2021-08-25 13:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-23 14:14 [PATCH 1/9] handshake: Add HANDSHAKE_EVENT_P2P_IP_REQUEST Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 2/9] ap: Implement P2P GO-side 4-way handshake IP Allocation Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 3/9] autotests: Test GO-side IP Allocation in testP2P Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 4/9] ap: Expire client's leases on disconnect Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 5/9] ie: Add FILS IP Address Assignment parsers and builders Andrew Zaborowski
2021-08-25 13:47 ` Denis Kenzior
2021-08-25 21:34 ` Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 6/9] ap: Support FILS IP Address Assignment IE Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 7/9] netconfig: Move loading settings to new method, refactor Andrew Zaborowski
2021-08-25 13:50 ` Denis Kenzior [this message]
2021-08-25 22:17 ` Andrew Zaborowski
2021-08-25 22:37 ` Denis Kenzior
2021-08-25 22:56 ` Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 8/9] netconfig: FILS IP assigment API Andrew Zaborowski
2021-08-23 14:14 ` [PATCH 9/9] station, netdev: Enable FILS IP Address Assignment Andrew Zaborowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6b81dfe5-686e-5ad7-762a-1133d85a7de5@gmail.com \
--to=denkenz@gmail.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).