3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-07 12:39:23 +01:00
Commit Graph

39 Commits

Author SHA1 Message Date
James Prestwood
59a0947c76 util: add scan_freq_set_remove
Removes one frequency from a scan_freq_set object.
2022-12-14 15:37:01 -06:00
James Prestwood
0bc44a038b util: add scan_freq_set_clone
This creates a new scan_freq_set from an input set which only contains
frequencies from bands included in the mask.
2022-08-05 11:49:18 -05:00
Denis Kenzior
82f873a025 util: Allow scan_freq_set to be autodestructed 2022-08-05 09:27:59 -05:00
James Prestwood
081b0af2d6 util: add scan_freq_set_subtract
Removes any frequencies from one set that are found in the other.
2022-07-26 13:13:11 -05:00
James Prestwood
3f1d72e545 util: make scan_freq_set_get_bands const 2022-07-26 13:13:04 -05:00
Denis Kenzior
8a5b3f6880 handshake: Do not crash if handshake is destroyed
Commit 4d2176df29 ("handshake: Allow event handler to free handshake")
introduced a re-entrancy guard so that handshake_state objects that are
destroyed as a result of the event do not cause a crash.  It rightly
used a temporary object to store the passed in handshake.  Unfortunately
this caused variable shadowing which resulted in crashes fixed by commit
d22b174a73 ("handshake: use _hs directly in handshake_event").
However, since the temporary was no longer used, this fix itself caused
a crash:

 #0  0x00005555f0ba8b3d in eapol_handle_ptk_1_of_4 (sm=sm@entry=0x5555f2b4a920, ek=0x5555f2b62588, ek@entry=0x16, unencrypted=unencrypted@entry=false) at src/eapol.c:1236
1236				handshake_event(sm->handshake,
(gdb) bt
 #0  0x00005555f0ba8b3d in eapol_handle_ptk_1_of_4 (sm=sm@entry=0x5555f2b4a920, ek=0x5555f2b62588, ek@entry=0x16, unencrypted=unencrypted@entry=false) at src/eapol.c:1236
 #1  0x00005555f0bab118 in eapol_key_handle (unencrypted=<optimized out>, frame=<optimized out>, sm=0x5555f2b4a920) at src/eapol.c:2343
 #2  eapol_rx_packet (proto=<optimized out>, from=<optimized out>, frame=<optimized out>, unencrypted=<optimized out>, user_data=0x5555f2b4a920) at src/eapol.c:2665
 #3  0x00005555f0bac497 in __eapol_rx_packet (ifindex=62, src=src@entry=0x5555f2b62574 "x\212 J\207\267", proto=proto@entry=34958, frame=frame@entry=0x5555f2b62588 "\002\003",
   len=len@entry=121, noencrypt=noencrypt@entry=false) at src/eapol.c:3017
 #4  0x00005555f0b8c617 in netdev_control_port_frame_event (netdev=0x5555f2b64450, msg=0x5555f2b62588) at src/netdev.c:5574
 #5  netdev_unicast_notify (msg=msg@entry=0x5555f2b619a0, user_data=<optimized out>) at src/netdev.c:5613
 #6  0x00007f60084c9a51 in dispatch_unicast_watches (msg=0x5555f2b619a0, id=<optimized out>, genl=0x5555f2b3fc80) at ell/genl.c:954
 #7  process_unicast (nlmsg=0x7fff61abeac0, genl=0x5555f2b3fc80) at ell/genl.c:973
 #8  received_data (io=<optimized out>, user_data=0x5555f2b3fc80) at ell/genl.c:1098
 #9  0x00007f60084c61bd in io_callback (fd=<optimized out>, events=1, user_data=0x5555f2b3fd20) at ell/io.c:120
 #10 0x00007f60084c536d in l_main_iterate (timeout=<optimized out>) at ell/main.c:478
 #11 0x00007f60084c543e in l_main_run () at ell/main.c:525
 #12 l_main_run () at ell/main.c:507
 #13 0x00007f60084c5670 in l_main_run_with_signal (callback=callback@entry=0x5555f0b89150 <signal_handler>, user_data=user_data@entry=0x0) at ell/main.c:647
 #14 0x00005555f0b886a4 in main (argc=<optimized out>, argv=<optimized out>) at src/main.c:532

This happens when the driver does not support rekeying, which causes iwd to
attempt a disconnect and re-connect.  The disconnect action is
taken during the event callback and destroys the underlying eapol state
machine.  Since a temporary isn't used, attempting to dereference
sm->handshake results in a crash.

Fix this by introducing a UNIQUE_ID macro which should prevent shadowing
and using a temporary variable as originally intended.

Fixes: d22b174a73 ("handshake: use _hs directly in handshake_event")
Fixes: 4d2176df29 ("handshake: Allow event handler to free handshake")
Reported-By: Toke Høiland-Jørgensen <toke@toke.dk>
Tested-by: Toke Høiland-Jørgensen <toke@toke.dk>
2022-02-03 09:44:08 -06:00
James Prestwood
94cdbb4669 scan: add scan_freq_set_to_fixed_array
This serializes a scan_freq_set into a uint32_t array.
2021-11-30 12:29:46 -06:00
James Prestwood
9c732cb32d scan: move scan_freq_set* into util
This will allow scan_freq_set utilities to be used in any
modules requiring unit testing
2021-11-30 12:29:06 -06:00
James Prestwood
2613564093 util: surround MAC_STR array access with ()
This allows printing from pointer offsets, for example:

MAC_STR(buf + 10)
2021-09-27 19:32:41 -05:00
Andrew Zaborowski
eb1149ca1f ie: Extract same-subnet check code to util.h 2021-08-31 10:06:47 -05:00
Denis Kenzior
0c0d9e5696 iwd: Use test_bit from ell 2021-03-12 13:49:23 -06:00
Denis Kenzior
f51025e143 util: Remove unused util_bit_field 2021-03-11 22:35:13 -06:00
Denis Kenzior
a941d4169f util: Remove unused util_set_bit 2021-03-11 22:24:05 -06:00
Denis Kenzior
7de5b4adef treewide: replace util_mem_is_zero with l_memeqzero 2021-03-09 15:40:35 -06:00
Andrew Zaborowski
e714e72e05 utils: Add util_netmask_from_prefix 2021-02-26 11:01:03 -06:00
James Prestwood
42605c9e76 util: add util_ip_prefix_tohl
Parses an IP prefix notation string into prefix, start, end, and
netmask. All values are returned in host order.
2020-10-26 16:16:12 -05:00
Daniel DE ALMEIDA BRAGA
211f7dde6e sae: Fix a side channel leak on the password
Use a constant control flow in the derivation loop, avoiding leakage
in the iteration succesfuly converting the password.
Increase number of iterations (20 to 30) to avoid issues with
passwords needing more iterations.
2020-08-03 16:12:50 -05:00
James Prestwood
33251ccd20 util: add util_is_valid_sta_address
Checks that that address is neither broadcast or group
2020-03-18 18:15:16 -05:00
Marcel Holtmann
152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
James Prestwood
76b73a1cf5 util: add util_set_bit
Sets a single bit in a uint8_t * bit field
2019-08-21 17:24:16 -05:00
James Prestwood
894cde987d storage: util: remove unused APIs
Both util_timespec_compare and storage_network_get_mtime
are now unused.
2019-08-21 14:16:08 -05:00
James Prestwood
e2bed192f6 util: knownnetworks: move timespec_compare into util 2019-07-30 14:44:38 -05:00
James Prestwood
abcc9f1647 util: add APIs to get username/domain from identity
mschaputil already had similar functionality, but ERP will need this
as well. These two functions will also handle identities with either
'@' or '\' to separate the user and domain.
2019-04-08 16:26:25 -05:00
Denis Kenzior
5c9e6b255f util: Remove container_of 2019-04-03 11:49:36 -05:00
Marcel Holtmann
554e4f55db build: Fix includes for using with -std=c99 compiler option 2018-11-01 22:37:11 +01:00
Tim Kourt
3781c157db util: Add util_ssid_is_hidden 2018-06-28 11:37:06 -05:00
James Prestwood
ce0d5858da util: added macros to print mac addresses 2018-02-01 10:12:09 -06:00
Andrew Zaborowski
9ef5f68d4b util: Add address type utils 2017-09-22 10:08:04 -05:00
Denis Kenzior
4a9d8278b4 util: Add container_of macro 2017-09-06 11:50:15 -05:00
Denis Kenzior
7ad261fef7 util: Move mem_is_zero to util 2017-02-21 16:45:41 -06:00
Denis Kenzior
0932157e4f util: Add align_len macro 2017-01-31 11:50:06 -06:00
Denis Kenzior
4978c31fd7 util: Remove unused msg_append_attr functions 2017-01-31 11:48:50 -06:00
Denis Kenzior
63b5c60743 util: Add util_string_to_address 2016-08-24 21:31:54 -05:00
Denis Kenzior
92c943998f util: Add util_address_to_string 2016-06-06 18:23:17 -05:00
Denis Kenzior
3877a4e5dd util: Add util_ssid_is_utf8 2015-04-08 13:18:54 -05:00
Tomasz Bursztyka
ab07091f8c util: Move msg_append_attr into util part 2015-03-02 20:44:02 -06:00
Denis Kenzior
e90ca652fd util: Add util_is_bit_set 2015-01-15 23:59:18 -06:00
Denis Kenzior
56f1ccf7f2 util: Add util_bit_field 2015-01-15 23:59:18 -06:00
Patrik Flykt
bf25abf38d util: Add SSID to UTF8 pretty-print function
Use a static buffer for converting an SSID to an approximate string in
UTF8. Replace each char that is not UTF8 compatible with the UTF8
replacement symbol.
2014-12-18 11:06:48 -06:00