Remove extra newline from a debug print

"Unknown WFA information element ignored" debug message had an extra
newline at the end.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: Add module tests for src/common

Signed-off-by: Jouni Malinen <j@w1.fi>
HS 2.0R2: Fix subscr_remediation_method for RADIUS server

This configuration parameter was not used at all in the RADIUS server
implementation and instead, hard coded 0 was sent.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: HS 2.0 remediation required from SQL user DB

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: P2P invitation with Wi-Fi Display enabled

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: P2P invitation rejected from unknown peer

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Invitation request with mismatching channel requirements

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: P2P Invitation Response protocol tests

This verifies most of the error cases in Invitation Response processing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Hide stdout from Popen() to avoid undesired stdout prints

ap_cipher_tkip_countermeasures_{ap,sta} printed out the MAC addresses in
stdout which resulted in the debug log not starting the PASS/FAIL
information at the beginning of the line. Hide these unnecessary prints
to avoid that.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
OpenSSL: Fix OCSP certificate debug print to use wpa_printf

Instead of using X509_print_fp() to print directly to stdout, print the
certificate dump to a memory BIO and use wpa_printf() to get this into
the debug log. This allows redirection of debug log to work better and
avoids undesired stdout prints when debugging is not enabled.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
P2P: Debug print channel lists for invitation processing

This makes invitation process more consistent with GO Negotiation as far
as the debug log entries are concerned and the resulting log is more
helpful for understanding channel selection.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: More protocol testing coverage for P2P invitation messages

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: P2P Client inviting a device to join a group

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd_cli: Fix segmentation fault with interface command

ctrl_ifname was not being freed and allocated consistently by using
proper functions: os_free() and os_strdup(). This can result in
segmentation fault when these OS specific wrappers use different
implementation (e.g., with CONFIG_WPA_TRACE=y).

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
RADIUS client: Do not try to send message without socket

It is possible for the RADIUS authentication/accounting socket to not be
open even if partial RADIUS server configuration has been done through
the control interface SET commands. Previously, this resulted in send()
attempt using fd=-1 which fails with bad file descriptor. Clean this up
by logging this as a missing configuration instead of trying to send the
message when that is known to fail.

Signed-off-by: Jouni Malinen <j@w1.fi>
RADIUS client: Handle ENETUNREACH similarly to other failure cases

This is one more possible send() error that should trigger RADIUS server
change if multiple servers are configured.

Signed-off-by: Jouni Malinen <j@w1.fi>
RADIUS client: Fix crash issue in radius_client_timer()

While iterating through RADIUS messages in radius_client_timer(), one
message entry may get flushed by "radius_client_retransmit -->
radius_client_handle_send_error --> radius_client_init_auth -->
radius_change_server --> radius_client_flush". This could result in
freed memory being accessed afterwards.

Signed-off-by: Jerry Yang <xyang@sonicwall.com>
RADIUS client: Fix socket close/re-open on server change

Both IPv4 and IPv6 sockets were not closed consistently in the paths
that tried to change RADIUS servers. This could result in leaking
sockets and leaving behind registered eloop events to freed memory on
interface removal.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests: RADIUS server unreachable with error handling

radius_{auth,acct}_unreachable tested some parts of RADIUS client code
error handling. However, they did not test everything since the send()
calls for unreachable port on localhost did not return an error (that
error was reported on receive side). Extend this with similar test cases
using unreachable IP address to get send() error returns covered as
well.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd: Fix configuration of multiple RADIUS servers with SET

The current RADIUS server pointer was updated after each SET command
which broke parsing of multiple RADIUS servers over the control
interface. Fix this by doing the final RADIUS server pointer updates
only once the full configuration is available.

Signed-off-by: Jouni Malinen <j@w1.fi>