treewide: Various style fixups

- Mostly problems with whitespace:
	- Use of spaces instead of tabs
	- Stray spaces before closing ')
	- Missing spaces

- Missing 'void' from function declarations & definitions that
  take no arguments.

- Wrong indentation level
This commit is contained in:
Denis Kenzior 2022-01-11 10:51:11 -06:00
parent 967c95829f
commit fe95cbe077
29 changed files with 71 additions and 65 deletions

View File

@ -668,7 +668,7 @@ static void sta_append(void *data, void *user_data)
{ {
struct sta_state *sta = data; struct sta_state *sta = data;
struct l_dbus_message_builder *builder = user_data; struct l_dbus_message_builder *builder = user_data;
const char* macstr; const char *macstr;
if (!sta->authenticated) if (!sta->authenticated)
return; return;

View File

@ -162,7 +162,7 @@ static void signal_handler(int signo)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
void __iwd_backtrace_init() void __iwd_backtrace_init(void)
{ {
static char path[PATH_MAX]; static char path[PATH_MAX];
static char cwd[PATH_MAX]; static char cwd[PATH_MAX];
@ -174,6 +174,7 @@ void __iwd_backtrace_init()
len = readlink("/proc/self/exe", path, sizeof(path) - 1); len = readlink("/proc/self/exe", path, sizeof(path) - 1);
if (len > 0) { if (len > 0) {
int i; int i;
path[len] = '\0'; path[len] = '\0';
for (i = len - 1; i >= 0; i--) { for (i = len - 1; i >= 0; i--) {

View File

@ -20,6 +20,6 @@
* *
*/ */
#ifdef HAVE_BACKTRACE #ifdef HAVE_BACKTRACE
void __iwd_backtrace_init(); void __iwd_backtrace_init(void);
void __iwd_backtrace_print(unsigned int offset); void __iwd_backtrace_print(unsigned int offset);
#endif #endif

View File

@ -151,11 +151,11 @@ static const int32_t ht_vht_base_rssi[] = {
* nsds = [52, 108, 234, 468] * nsds = [52, 108, 234, 468]
* *
* for nsd in nsds: * for nsd in nsds:
* rates = [] * rates = []
* for i in xrange(0, 10): * for i in xrange(0, 10):
* data_rate = (nsd * rfactors[i] * nbpscs[i]) / 0.004 * data_rate = (nsd * rfactors[i] * nbpscs[i]) / 0.004
* rates.append(int(data_rate) * 1000) * rates.append(int(data_rate) * 1000)
* print('rates for nsd: ' + nsd + ': ' + rates) * print('rates for nsd: ' + nsd + ': ' + rates)
*/ */
static const uint64_t ht_vht_rates[4][10] = { static const uint64_t ht_vht_rates[4][10] = {

View File

@ -72,8 +72,9 @@ const unsigned char crypto_dh5_generator[] = { 0x2 };
size_t crypto_dh5_generator_size = sizeof(crypto_dh5_generator); size_t crypto_dh5_generator_size = sizeof(crypto_dh5_generator);
static bool hmac_common(enum l_checksum_type type, static bool hmac_common(enum l_checksum_type type,
const void *key, size_t key_len, const void *key, size_t key_len,
const void *data, size_t data_len, void *output, size_t size) const void *data, size_t data_len,
void *output, size_t size)
{ {
struct l_checksum *hmac; struct l_checksum *hmac;
@ -438,9 +439,9 @@ free_ctr:
return false; return false;
} }
#define SWAP(a,b) do { int _t = a; a = b; b = _t; } while (0) #define SWAP(a, b) do { int _t = a; a = b; b = _t; } while (0)
static void arc4_set_key(struct arc4_ctx *ctx, unsigned length, static void arc4_set_key(struct arc4_ctx *ctx, unsigned int length,
const uint8_t *key) const uint8_t *key)
{ {
unsigned int i, j, k; unsigned int i, j, k;
@ -458,8 +459,8 @@ static void arc4_set_key(struct arc4_ctx *ctx, unsigned length,
ctx->i = ctx->j = 0; ctx->i = ctx->j = 0;
} }
static void arc4_crypt(struct arc4_ctx *ctx, unsigned length, uint8_t *dst, static void arc4_crypt(struct arc4_ctx *ctx, unsigned int length,
const uint8_t *src) uint8_t *dst, const uint8_t *src)
{ {
uint8_t i, j; uint8_t i, j;
@ -470,7 +471,7 @@ static void arc4_crypt(struct arc4_ctx *ctx, unsigned length, uint8_t *dst,
SWAP(ctx->S[i], ctx->S[j]); SWAP(ctx->S[i], ctx->S[j]);
if (!dst || !src) if (!dst || !src)
continue; continue;
*dst++ = *src++ ^ ctx->S[ (ctx->S[i] + ctx->S[j]) & 0xff ]; *dst++ = *src++ ^ ctx->S[(ctx->S[i] + ctx->S[j]) & 0xff];
} }
ctx->i = i; ctx->j = j; ctx->i = i; ctx->j = j;
} }

View File

@ -155,7 +155,7 @@ struct dpp_configuration *dpp_parse_configuration_object(const char *json,
JSON_UNDEFINED)) JSON_UNDEFINED))
goto free_contents; goto free_contents;
if (!ssid || !util_ssid_is_utf8(strlen(ssid),(const uint8_t *)ssid)) if (!ssid || !util_ssid_is_utf8(strlen(ssid), (const uint8_t *) ssid))
goto free_contents; goto free_contents;
if (!json_iter_parse(&cred, if (!json_iter_parse(&cred,

View File

@ -473,10 +473,10 @@ static bool eap_peap_tunnel_ready(struct eap_state *eap,
struct peap_state *peap_state = eap_tls_common_get_variant_data(eap); struct peap_state *peap_state = eap_tls_common_get_variant_data(eap);
/* /*
* PEAPv1: draft-josefsson-pppext-eap-tls-eap-05, Section 2.1.1 * PEAPv1: draft-josefsson-pppext-eap-tls-eap-05, Section 2.1.1
* *
* Cleartext Success/Failure packets MUST be silently discarded once TLS * Cleartext Success/Failure packets MUST be silently discarded once
* tunnel has been brought up. * TLS tunnel has been brought up.
*/ */
eap_discard_success_and_failure(eap, true); eap_discard_success_and_failure(eap, true);

View File

@ -725,8 +725,8 @@ void eap_tls_common_handle_request(struct eap_state *eap,
proceed: proceed:
if (eap_tls->tx_pdu_buf) { if (eap_tls->tx_pdu_buf) {
/* /*
* tx_pdu_buf is used for the re-transmission and needs to be * tx_pdu_buf is used for the re-transmission and needs to be
* cleared on a new request. * cleared on a new request.
*/ */
databuf_free(eap_tls->tx_pdu_buf); databuf_free(eap_tls->tx_pdu_buf);
eap_tls->tx_pdu_buf = NULL; eap_tls->tx_pdu_buf = NULL;

View File

@ -223,7 +223,7 @@ static uint8_t *encrypted_settings_decrypt(struct eap_wsc_state *wsc,
* *
* Account for the IV being in the beginning 16 bytes * Account for the IV being in the beginning 16 bytes
*/ */
if (len < 16 ) if (len < 16)
return NULL; return NULL;
encrypted_len = len - 16; encrypted_len = len - 16;

View File

@ -222,7 +222,7 @@ static int fils_derive_key_data(struct fils_sm *fils)
/* /*
* IEEE 802.11ai - 12.12.2.6.2 (Re)Association Request for FILS key * IEEE 802.11ai - 12.12.2.6.2 (Re)Association Request for FILS key
* confirmation * confirmation
* *
* Key-Auth = HMAC-Hash(ICK, SNonce || ANonce || STA-MAC || AP-BSSID) * Key-Auth = HMAC-Hash(ICK, SNonce || ANonce || STA-MAC || AP-BSSID)
*/ */

View File

@ -726,10 +726,10 @@ static bool frame_watch_remove_by_handler(uint64_t wdev_id, uint32_t group_id,
frame_watch_cb_t handler, frame_watch_cb_t handler,
void *user_data) void *user_data)
{ {
struct watch_group_match_info group_info = struct watch_group_match_info group_info = {
{ group_id == 0 ? 0 : wdev_id, group_id }; group_id == 0 ? 0 : wdev_id, group_id };
struct frame_watch_handler_check_info handler_info = struct frame_watch_handler_check_info handler_info = {
{ wdev_id, handler, user_data }; wdev_id, handler, user_data };
struct watch_group *group = l_queue_find(watch_groups, struct watch_group *group = l_queue_find(watch_groups,
frame_watch_group_match, frame_watch_group_match,
&group_info); &group_info);

View File

@ -640,9 +640,10 @@ static int ft_rx_authenticate(struct auth_proto *ap, const uint8_t *frame,
* FT Protocol. * FT Protocol.
*/ */
if (!ft_parse_authentication_resp_frame(frame, frame_len, ft->hs->spa, if (!ft_parse_authentication_resp_frame(frame, frame_len, ft->hs->spa,
ft->hs->aa, ft->hs->aa, 2, &status_code, ft->hs->aa, ft->hs->aa,
&ies, &ies_len)) 2, &status_code,
goto auth_error; &ies, &ies_len))
goto auth_error;
/* AP Rejected the authenticate / associate */ /* AP Rejected the authenticate / associate */
if (status_code != 0) if (status_code != 0)

View File

@ -44,7 +44,7 @@
#include "src/erp.h" #include "src/erp.h"
#include "src/band.h" #include "src/band.h"
static inline unsigned int n_ecc_groups() static inline unsigned int n_ecc_groups(void)
{ {
const unsigned int *groups = l_ecc_supported_ike_groups(); const unsigned int *groups = l_ecc_supported_ike_groups();
unsigned int j = 0; unsigned int j = 0;

View File

@ -923,7 +923,7 @@ static bool ie_build_cipher_suite(uint8_t *data, const uint8_t *oui,
memcpy((data), (oui), 3); \ memcpy((data), (oui), 3); \
(data)[3] = (id); \ (data)[3] = (id); \
return true; \ return true; \
} while(0) } while (0)
/* 802.11-2016, Section 9.4.2.25.3 */ /* 802.11-2016, Section 9.4.2.25.3 */
static bool ie_build_rsn_akm_suite(uint8_t *data, enum ie_rsn_akm_suite suite) static bool ie_build_rsn_akm_suite(uint8_t *data, enum ie_rsn_akm_suite suite)

View File

@ -302,7 +302,7 @@ bool json_iter_get_int(struct json_iter *iter, int *i)
{ {
void *ptr; void *ptr;
size_t len; size_t len;
long int r; long r;
int t; int t;
char *endp; char *endp;
@ -328,7 +328,7 @@ bool json_iter_get_uint(struct json_iter *iter, unsigned int *i)
{ {
void *ptr; void *ptr;
size_t len; size_t len;
unsigned long int r; unsigned long r;
unsigned int t; unsigned int t;
char *endp; char *endp;

View File

@ -69,17 +69,17 @@ void json_iter_init(struct json_iter *iter, struct json_contents *c);
* Arguments should be specified using JSON_MANDATORY or JSON_OPTIONAL: * Arguments should be specified using JSON_MANDATORY or JSON_OPTIONAL:
* *
* r = json_iter_parse(iter, JSON_MANDATORY("mykey", JSON_STRING, &strvalue), * r = json_iter_parse(iter, JSON_MANDATORY("mykey", JSON_STRING, &strvalue),
* JSON_OPTIONAL("optkey", JSON_STRING, &optvalue), * JSON_OPTIONAL("optkey", JSON_STRING, &optvalue),
* JSON_UNDEFINED); * JSON_UNDEFINED);
* *
* String values should be of type char ** and must be freed * String values should be of type char ** and must be freed
* Object values should be of type struct json_iter * * Object values should be of type struct json_iter *
* Primitive types (numbers, booleans, null) should be of type * Primitive types (numbers, booleans, null) should be of type
* struct json_iter *. This is to allow the caller to distinguish * struct json_iter *. This is to allow the caller to distinguish
* between the actual value type after parsing using a getter for * between the actual value type after parsing using a getter for
* the expected type (get_uint/get_int/get_boolean etc.). In * the expected type (get_uint/get_int/get_boolean etc.). In
* addition this lets the caller use JSON_OPTIONAL and check post * addition this lets the caller use JSON_OPTIONAL and check post
* json_iter_parse if the iterator is valid (json_iter_is_valid). * json_iter_parse if the iterator is valid (json_iter_is_valid).
* *
* No other types are supported at this time, and json_iter_parse will fail if * No other types are supported at this time, and json_iter_parse will fail if
* other types are encountered. * other types are encountered.

View File

@ -265,7 +265,7 @@ static void print_koption(const void *key, void *value, void *user_data)
#define ADD_OPTIONAL(opt) \ #define ADD_OPTIONAL(opt) \
l_hashmap_replace(optional, opt, &r, NULL) l_hashmap_replace(optional, opt, &r, NULL)
static int check_crypto() static int check_crypto(void)
{ {
int r = 0; int r = 0;
struct l_hashmap *options = l_hashmap_string_new(); struct l_hashmap *options = l_hashmap_string_new();

View File

@ -196,7 +196,7 @@ static void manager_create_interfaces(struct wiphy_setup_state *state)
struct l_genl_msg *msg; struct l_genl_msg *msg;
char ifname[10]; char ifname[10];
uint32_t iftype; uint32_t iftype;
unsigned cmd_id; unsigned int cmd_id;
if (state->aborted) if (state->aborted)
return; return;
@ -341,7 +341,7 @@ static void manager_get_interface_cb(struct l_genl_msg *msg, void *user_data)
uint64_t wdev; uint64_t wdev;
const char *ifname; const char *ifname;
struct l_genl_msg *del_msg; struct l_genl_msg *del_msg;
unsigned cmd_id; unsigned int cmd_id;
char *pattern; char *pattern;
unsigned int i; unsigned int i;
bool whitelisted = false, blacklisted = false; bool whitelisted = false, blacklisted = false;
@ -703,7 +703,7 @@ static void manager_config_notify(struct l_genl_msg *msg, void *user_data)
case NL80211_CMD_NEW_INTERFACE: case NL80211_CMD_NEW_INTERFACE:
/* /*
* Interfaces are normally dumped on the NEW_WIPHY events and * Interfaces are normally dumped on the NEW_WIPHY events and
* and we have nothing to do here. But check if by any chance * we have nothing to do here. But check if by any chance
* we've queried this wiphy and it was still busy initialising, * we've queried this wiphy and it was still busy initialising,
* in that case retry the setup now that an interface, likely * in that case retry the setup now that an interface, likely
* the initial default one, has been added. * the initial default one, has been added.

View File

@ -364,6 +364,7 @@ static bool validate_mgmt_ies(const uint8_t *ies, size_t ies_len,
while (ie_tlv_iter_next(&iter)) { while (ie_tlv_iter_next(&iter)) {
int i = 0; int i = 0;
tag = ie_tlv_iter_get_tag(&iter); tag = ie_tlv_iter_get_tag(&iter);
/* Check that the tag is part of the valid set */ /* Check that the tag is part of the valid set */

View File

@ -2901,7 +2901,7 @@ process_resp_ies:
if (netdev_get_oci(netdev) < 0) if (netdev_get_oci(netdev) < 0)
goto deauth; goto deauth;
} else if (!eapol_start(netdev->sm)) } else if (!eapol_start(netdev->sm))
goto deauth; goto deauth;
return; return;
} }
@ -2912,7 +2912,6 @@ process_resp_ies:
HANDSHAKE_EVENT_SETTING_KEYS); HANDSHAKE_EVENT_SETTING_KEYS);
netdev_connect_ok(netdev); netdev_connect_ok(netdev);
return; return;
error: error:

View File

@ -121,8 +121,8 @@ enum p2p_public_action_frame_type {
/* Table 75 */ /* Table 75 */
enum p2p_action_frame_type { enum p2p_action_frame_type {
P2P_ACTION_NOTICE_OF_ABSENCE = 0, P2P_ACTION_NOTICE_OF_ABSENCE = 0,
P2P_ACTION_PRESENCE_REQ = 1, P2P_ACTION_PRESENCE_REQ = 1,
P2P_ACTION_PRESENCE_RESP = 2, P2P_ACTION_PRESENCE_RESP = 2,
P2P_ACTION_GO_DISCOVERABILITY_REQ = 3, P2P_ACTION_GO_DISCOVERABILITY_REQ = 3,
}; };

View File

@ -438,7 +438,7 @@ static struct l_ecc_point *sae_compute_pwe(const struct l_ecc_curve *curve,
* Set base to either dummy or password, depending on found's * Set base to either dummy or password, depending on found's
* value. * value.
* A non-secure version would be: * A non-secure version would be:
* base = (found ? dummy : password); * base = (found ? dummy : password);
*/ */
util_secure_select(found, dummy, (uint8_t *)password, util_secure_select(found, dummy, (uint8_t *)password,
base, base_len); base, base_len);
@ -729,7 +729,7 @@ static int sae_process_commit(struct sae_sm *sm, const uint8_t *from,
* *
* NOTE: We use hkdf_extract here since it is just an hmac invocation * NOTE: We use hkdf_extract here since it is just an hmac invocation
* and it handles the case of the zero key for us. * and it handles the case of the zero key for us.
*/ */
if (sm->sae_type != CRYPTO_SAE_LOOPING && sm->rejected_groups) { if (sm->sae_type != CRYPTO_SAE_LOOPING && sm->rejected_groups) {
salt = sm->rejected_groups + 1; salt = sm->rejected_groups + 1;
salt_len = sm->rejected_groups[0] * sizeof(uint16_t); salt_len = sm->rejected_groups[0] * sizeof(uint16_t);
@ -999,7 +999,7 @@ static int sae_verify_committed(struct sae_sm *sm, uint16_t transaction,
* checking that the group matches here, e.g. * checking that the group matches here, e.g.
* *
* if (l_get_le16(frame) != sm->group) * if (l_get_le16(frame) != sm->group)
* return false; * return false;
* *
* According to 802.11 Section 12.4.8.6.4: * According to 802.11 Section 12.4.8.6.4:
* *

View File

@ -562,6 +562,7 @@ static int scan_request_send_trigger(struct scan_context *sc,
struct scan_request *sr) struct scan_request *sr)
{ {
struct l_genl_msg *cmd = l_queue_peek_head(sr->cmds); struct l_genl_msg *cmd = l_queue_peek_head(sr->cmds);
if (!cmd) if (!cmd)
return -ENOMSG; return -ENOMSG;
@ -2087,7 +2088,7 @@ static int scan_init(void)
return 0; return 0;
} }
static void scan_exit() static void scan_exit(void)
{ {
l_queue_destroy(scan_contexts, l_queue_destroy(scan_contexts,
(l_queue_destroy_func_t) scan_context_free); (l_queue_destroy_func_t) scan_context_free);

View File

@ -125,7 +125,7 @@ struct iwd_sim_auth *iwd_sim_auth_find(bool sim, bool aka);
* @param data User data * @param data User data
* *
* @return Transaction ID, used to cancel the request if needed * @return Transaction ID, used to cancel the request if needed
* < 0 in case of an error * < 0 in case of an error
*/ */
int sim_auth_check_milenage(struct iwd_sim_auth *auth, int sim_auth_check_milenage(struct iwd_sim_auth *auth,
const uint8_t *rand, const uint8_t *autn, const uint8_t *rand, const uint8_t *autn,
@ -141,7 +141,7 @@ int sim_auth_check_milenage(struct iwd_sim_auth *auth,
* @param data User data * @param data User data
* *
* @return Transaction ID, used to cancel the request if needed * @return Transaction ID, used to cancel the request if needed
* < 0 in case of an error * < 0 in case of an error
*/ */
int sim_auth_run_gsm(struct iwd_sim_auth *auth, const uint8_t *rands, int sim_auth_run_gsm(struct iwd_sim_auth *auth, const uint8_t *rands,
int num_rands, sim_auth_run_gsm_cb_t cb, void *data); int num_rands, sim_auth_run_gsm_cb_t cb, void *data);

View File

@ -1105,7 +1105,7 @@ build_ie:
* any offload features are detected (since IWD prefers to use offload). * any offload features are detected (since IWD prefers to use offload).
*/ */
info.ocvc = !disable_ocv && bss_info.ocvc && info.mfpc && info.ocvc = !disable_ocv && bss_info.ocvc && info.mfpc &&
!wiphy_can_offload(wiphy);; !wiphy_can_offload(wiphy);
/* /*
* IEEE 802.11-2020 9.4.2.24.4 states extended key IDs can only be used * IEEE 802.11-2020 9.4.2.24.4 states extended key IDs can only be used
@ -1887,9 +1887,9 @@ static void station_ft_ds_action_start(struct station *station)
continue; continue;
/* /*
* Fire and forget. Netdev will maintain a cache of responses and * Fire and forget. Netdev will maintain a cache of responses
* when the time comes these can be referenced for a roam * and when the time comes these can be referenced for a roam
*/ */
netdev_fast_transition_over_ds_action(station->netdev, bss); netdev_fast_transition_over_ds_action(station->netdev, bss);
} }
} }
@ -2601,7 +2601,7 @@ static void station_ap_directed_roam(struct station *station,
pos += 12; pos += 12;
} }
if (req_mode & WNM_REQUEST_MODE_ESS_DISASSOCIATION_IMMINENT ) { if (req_mode & WNM_REQUEST_MODE_ESS_DISASSOCIATION_IMMINENT) {
uint8_t url_len; uint8_t url_len;
if (pos + 1 > body_len) if (pos + 1 > body_len)
@ -2625,7 +2625,7 @@ static void station_ap_directed_roam(struct station *station,
if (req_mode & WNM_REQUEST_MODE_PREFERRED_CANDIDATE_LIST) { if (req_mode & WNM_REQUEST_MODE_PREFERRED_CANDIDATE_LIST) {
l_debug("roam: AP sent a preferred candidate list"); l_debug("roam: AP sent a preferred candidate list");
station_neighbor_report_cb(station->netdev, 0, body + pos, station_neighbor_report_cb(station->netdev, 0, body + pos,
body_len - pos,station); body_len - pos, station);
} else { } else {
l_debug("roam: AP did not include a preferred candidate list"); l_debug("roam: AP did not include a preferred candidate list");
if (station_roam_scan(station, NULL) < 0) if (station_roam_scan(station, NULL) < 0)

View File

@ -39,7 +39,7 @@
const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid) const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid)
{ {
static char buf[3* 32 + 1]; static char buf[3 * 32 + 1];
size_t i = 0, pos = 0; size_t i = 0, pos = 0;
const uint8_t *start = ssid, *end; const uint8_t *start = ssid, *end;
@ -136,7 +136,7 @@ bool util_string_to_address(const char *str, uint8_t *out_addr)
if (str[i + 2] != ':') if (str[i + 2] != ':')
return false; return false;
} }
if (!l_ascii_isxdigit(str[i])) if (!l_ascii_isxdigit(str[i]))
return false; return false;

View File

@ -918,6 +918,7 @@ static void wiphy_print_band_info(struct band *band, const char *name)
if (band->ht_supported) { if (band->ht_supported) {
uint8_t max_nss = bit_field(band->ht_mcs_set[12], 2, 2) + 1; uint8_t max_nss = bit_field(band->ht_mcs_set[12], 2, 2) + 1;
l_info("\t\tHT Capabilities:"); l_info("\t\tHT Capabilities:");
if (test_bit(band->ht_capabilities, 1)) if (test_bit(band->ht_capabilities, 1))

View File

@ -555,7 +555,7 @@ static void wsc_store_credentials(struct wsc_credentials_info *creds,
else else
l_settings_set_bytes(settings, "Security", l_settings_set_bytes(settings, "Security",
"PreSharedKey", creds[i].psk, "PreSharedKey", creds[i].psk,
sizeof(creds[i].psk)); sizeof(creds[i].psk));
} }
l_debug("Storing credential for '%s(%s)'", ssid, l_debug("Storing credential for '%s(%s)'", ssid,

View File

@ -1751,6 +1751,7 @@ static uint8_t *wsc_attr_builder_free(struct wsc_attr_builder *builder,
if (builder->curlen > 0) { if (builder->curlen > 0) {
uint8_t *bytes = builder->buf + builder->offset; uint8_t *bytes = builder->buf + builder->offset;
l_put_be16(builder->curlen - 4, bytes + 2); l_put_be16(builder->curlen - 4, bytes + 2);
builder->offset += builder->curlen; builder->offset += builder->curlen;
builder->curlen = 0; builder->curlen = 0;