]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
9 years agotests: ProxyARP with DGAF disabled and multicast-to-unicast conversion
Jouni Malinen [Fri, 28 Nov 2014 17:50:24 +0000 (19:50 +0200)] 
tests: ProxyARP with DGAF disabled and multicast-to-unicast conversion

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Do not limit NDISC snoop packet size to 150
Jouni Malinen [Fri, 28 Nov 2014 20:39:55 +0000 (22:39 +0200)] 
proxyarp: Do not limit NDISC snoop packet size to 150

The RA, NS, and NA packets may be longer, so do not arbitrarily limit
the packet socket capture size to 150 bytes in the socket filter.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Validate IPv4 header total length value in dhcp_snoop
Jouni Malinen [Fri, 28 Nov 2014 20:31:38 +0000 (22:31 +0200)] 
proxyarp: Validate IPv4 header total length value in dhcp_snoop

This field needs to be validated in addition to validating the total
length of the received frame to avoid reading beyond the frame buffer.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Relax frame length limit for RA and NA
Jouni Malinen [Fri, 28 Nov 2014 17:44:58 +0000 (19:44 +0200)] 
proxyarp: Relax frame length limit for RA and NA

Only the NS frames should be checked to be long enough to cover all the
fields used in the NS data structure. This allows shorter RA and NA
frames to be processed for multicast-to-unicast rules.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Fix x_snoop multicast-to-unicast debug print
Jouni Malinen [Fri, 28 Nov 2014 17:43:58 +0000 (19:43 +0200)] 
proxyarp: Fix x_snoop multicast-to-unicast debug print

l2_packet_send() returns >= 0 on success, i.e., non-zero value does not
mean failure. Fix this debug print to show up only on negative return
values.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Add debug log entry on multicast-to-unicast conversion
Jouni Malinen [Fri, 28 Nov 2014 17:27:07 +0000 (19:27 +0200)] 
proxyarp: Add debug log entry on multicast-to-unicast conversion

This makes it easier to debug operations. The debug message is marked
EXCESSIVE, though, to avoid filling the logs with too much information
in default debugging cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd DATA_TEST_FRAME for testing Data frame processing on AP side
Jouni Malinen [Fri, 28 Nov 2014 17:26:11 +0000 (19:26 +0200)] 
Add DATA_TEST_FRAME for testing Data frame processing on AP side

The new hostapd control interface command can be used in automated
testing to verify how AP processes Data frames with arbitrary contents.
This is enabled only in builds with CONFIG_TESTING_OPTIONS=y.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Try multicast-to-unicast conversion only for authorized STAs
Jouni Malinen [Fri, 28 Nov 2014 16:36:40 +0000 (18:36 +0200)] 
proxyarp: Try multicast-to-unicast conversion only for authorized STAs

There is no point in trying to send the unicast converted version to a
STA that is not in authorized state since the driver would be expected
to drop normal TX Data frames in such state.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Convert proxyarp tests to use DATA_TEST_FRAME
Jouni Malinen [Thu, 27 Nov 2014 21:53:22 +0000 (23:53 +0200)] 
tests: Convert proxyarp tests to use DATA_TEST_FRAME

This is more robust and extensible than configuring IPv6 addresses on
the interfaces and trying to use ping6 or some other external tools to
generate suitable IPv6 frames.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd DATA_TEST_FRAME for testing Data frame processing
Jouni Malinen [Thu, 27 Nov 2014 21:51:46 +0000 (23:51 +0200)] 
Add DATA_TEST_FRAME for testing Data frame processing

The new wpa_supplicant control interface command can be used in
automated testing to verify how AP processes Data frames with arbitrary
contents. This is enabled only in builds with CONFIG_TESTING_OPTIONS=y.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Make p2p_messages tests more robust under load
Jouni Malinen [Thu, 27 Nov 2014 19:44:01 +0000 (21:44 +0200)] 
tests: Make p2p_messages tests more robust under load

The 50 ms wait time for Action frame response was not sufficient when
the tests are run under heavy load (e.g., multiple VMs in parallel).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Make p2p_msg_invitation_req_to_go more robust
Jouni Malinen [Thu, 27 Nov 2014 19:22:31 +0000 (21:22 +0200)] 
tests: Make p2p_msg_invitation_req_to_go more robust

Wait for GO to start before sending invitation frames in the protocol
test. Without this, it was possible to hit the 5 second timeout on
management frame RX under load.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Make go_neg_with_bss_connected more robust
Jouni Malinen [Thu, 27 Nov 2014 19:06:18 +0000 (21:06 +0200)] 
tests: Make go_neg_with_bss_connected more robust

It was possible for this test case to fail due to PBC overlap that was
detected based on previous test case having used PBC. Make that false
positive less likely to happen by explicitly clearing the scan cache on
the devices.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Make ap_wps_reg_config_tkip failure log more helpful
Jouni Malinen [Thu, 27 Nov 2014 18:33:35 +0000 (20:33 +0200)] 
tests: Make ap_wps_reg_config_tkip failure log more helpful

The "Not fully connected" report did not clearly identify what went
wrong, so make this more verbose in hope of being able to determine what
happened should this test case fail again.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Increase WPS connection timeout to make tests more robust
Jouni Malinen [Thu, 27 Nov 2014 18:30:07 +0000 (20:30 +0200)] 
tests: Increase WPS connection timeout to make tests more robust

It was possible to hit the 10 second timeout in some test cases under
heavy load (e.g., with large number of VMs running tests in parallel).
These timeouts are not really indicating any real error, so make them
less likely to show up in reports by increasing the connection timeout
to 30 seconds.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Ignore status responses without =
Johannes Berg [Thu, 27 Nov 2014 17:42:54 +0000 (18:42 +0100)] 
tests: Ignore status responses without =

There are valid status (and possibly status-driver) responses
that don't have a name=value format, ignore those in the test
framework parser.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agotests: Optimize run-tests.py --prefill-tests startup time
Jouni Malinen [Thu, 27 Nov 2014 18:08:15 +0000 (20:08 +0200)] 
tests: Optimize run-tests.py --prefill-tests startup time

It took significant part of the startup latency to prefill the database
with test cases due to the SQL COMMIT operation between each added row.
Move COMMIT to outside the loop to speed startup significantly.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoClear RSN preauth and PMKSA cache state on FLUSH command
Jouni Malinen [Thu, 27 Nov 2014 17:56:15 +0000 (19:56 +0200)] 
Clear RSN preauth and PMKSA cache state on FLUSH command

There is no need for this state to maintained when the wpa_supplicant
FLUSH ctrl_iface command is used to request flushing of all state.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Follow test sequence from run-tests.py command line
Jouni Malinen [Thu, 27 Nov 2014 17:48:41 +0000 (19:48 +0200)] 
tests: Follow test sequence from run-tests.py command line

It can be useful to specify an exact order of test cases and also to
allow the same test case to be run multiple times when the list of tests
is provided on the command line.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoWMM AC: Fix memory leak on deinit without disassoc event
Jouni Malinen [Thu, 27 Nov 2014 17:00:02 +0000 (19:00 +0200)] 
WMM AC: Fix memory leak on deinit without disassoc event

It was possible for wmm_ac_deinit() not getting called when an interface
was removed in a sequence where disassociation was not reported and
wmm_ac_notify_disassoc() did not get called. This resulted in leaking
whatever memory was allocated for WMM AC parameters. Fix that by calling
wmm_ac_notify_disassoc() from wpa_supplicant_cleanup().

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Create new radios for MCC tests
Johannes Berg [Thu, 27 Nov 2014 16:05:20 +0000 (17:05 +0100)] 
tests: Create new radios for MCC tests

For tests that require a radio with multi-channel concurrency,
create a new one on the fly that does have more than 1 channel.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agotests: Use tshark -Y instead of tshark -R
Johannes Berg [Thu, 27 Nov 2014 15:13:57 +0000 (16:13 +0100)] 
tests: Use tshark -Y instead of tshark -R

Newer versions of tshark don't like the -R (read filter) argument
for filtering and just show a deprecation warning. Use -Y (display
filter) instead, which hopefully also works on older versions.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agoP2P: Reinvite with social operation channel if no common channels
Rashmi Ramanna [Wed, 26 Nov 2014 15:53:55 +0000 (21:23 +0530)] 
P2P: Reinvite with social operation channel if no common channels

If invitation to reinvoke a persistent group from the GO fails with the
peer indicating that there are no common channels, there is no defined
means for the peer to indicate which channel could have worked. Since
this type of issue with available channels changing over time can
happen, try to work around this by retrying invitation using one of the
social channels as the operating channel unless a specific operating
channel was forced for the group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoClear scan_req to NORMAL_SCAN_REQ for connection attempt
Jouni Malinen [Thu, 27 Nov 2014 15:41:02 +0000 (17:41 +0200)] 
Clear scan_req to NORMAL_SCAN_REQ for connection attempt

This is needed to fix some sequencies where a real scan in ap_scan=2
case would be issued even when the connection case would expect direct
connection without a scan.

This fixed an issue shown in hwsim test case autoscan_exponential
followed by ibss_open_fixed_bssid.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Change iftype to station on leaving mesh
Jouni Malinen [Thu, 27 Nov 2014 14:39:14 +0000 (16:39 +0200)] 
nl80211: Change iftype to station on leaving mesh

This is needed to make following operations behave as expected since
mesh iftypes may prevent various operations (e.g., registering Probe
Request frame RX). Use same design as leave_ibss does to handle this
consistently.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agomesh: Send peering close message before leaving mesh
Jouni Malinen [Thu, 27 Nov 2014 15:02:12 +0000 (17:02 +0200)] 
mesh: Send peering close message before leaving mesh

This is needed to allow proper Action frame transmission to work without
having to claim these to be offchannel operations.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Clear ignore_if_down_event if interface is up
Jouni Malinen [Thu, 27 Nov 2014 12:59:28 +0000 (14:59 +0200)] 
nl80211: Clear ignore_if_down_event if interface is up

It was possible for the ignore_if_down_event flag to remain set in some
cases where interface mode change required the interface to be set down
temporarily. If that happened, the following rfkill interface down could
have been ignored and device could have been left trying to scan or
connect (which would all fail due to the interface beign down). Clean
this up by clearing the ignore_if_down_event flag on the interface down
event regardless of whether the interface is up at the time this event
is processed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Replace last remaining hwsim_test uses with DATA_TEST
Jouni Malinen [Thu, 27 Nov 2014 12:04:51 +0000 (14:04 +0200)] 
tests: Replace last remaining hwsim_test uses with DATA_TEST

External tool is not needed anymore to run the data connectivity tests
since hostapd test mode now allows the possible bridge or VLAN interface
to be specified.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agohostapd: Allow DATA_TEST_CONFIG to configure ifname
Jouni Malinen [Thu, 27 Nov 2014 12:02:18 +0000 (14:02 +0200)] 
hostapd: Allow DATA_TEST_CONFIG to configure ifname

This allows the device-based data connectivity tests to be extended for
bridge and VLAN interface cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: ProxyARP
Jouni Malinen [Tue, 25 Nov 2014 20:12:23 +0000 (22:12 +0200)] 
tests: ProxyARP

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Fix br_ifindex storing when hostapd creates the bridge
Jouni Malinen [Tue, 25 Nov 2014 23:14:41 +0000 (01:14 +0200)] 
nl80211: Fix br_ifindex storing when hostapd creates the bridge

Commit 6c6678e7a456d4af58a2bf24ec8f15fb8b8b24ef ('nl80211: Make
br_ifindex available in i802_bss') did not cover the case where
i802_check_bridge() ends up creating the bridge interface. That left
bss->br_ifindex zero and prevented neighbor addition. Extend that
functionality to update br_ifindex once the bridge netdev has been
added.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Print learned IPv6 address in debug log
Jouni Malinen [Tue, 25 Nov 2014 23:06:56 +0000 (01:06 +0200)] 
proxyarp: Print learned IPv6 address in debug log

This makes it easier to debug issues related to IPv6 address snooping.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoproxyarp: Fix DHCP and ND message structures
Jouni Malinen [Tue, 25 Nov 2014 23:05:24 +0000 (01:05 +0200)] 
proxyarp: Fix DHCP and ND message structures

These need to be marked packed to avoid issues with compilers
potentially adding padding between the fields (e.g., gcc on 64-bit
seemed to make struct icmpv6_ndmsg two octets too long which broke IPv6
address discovery).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoDo not re-open Android control sockets
Neelansh Mittal [Tue, 25 Nov 2014 10:11:28 +0000 (15:41 +0530)] 
Do not re-open Android control sockets

On Android, the control socket being used may be the socket that is
created when wpa_supplicant is started as a /init.*.rc service. Such a
socket is maintained as a key-value pair in Android's environment.
Closing this control socket would leave wpa_supplicant in a bad state.
When wpa_supplicant re-opens the ctrl_iface socket, it will query the
Android's environment, and will be returned with the same socket
descriptor that has already been closed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAndroid: Add Hotspot 2.0 into hostapd makefile
Jouni Malinen [Tue, 25 Nov 2014 15:06:54 +0000 (17:06 +0200)] 
Android: Add Hotspot 2.0 into hostapd makefile

This makes the Android.mk for hostapd match the Makefile changes for
optional Hotspot 2.0 support.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoproxyarp: Use C library header files and CONFIG_IPV6
Jouni Malinen [Tue, 25 Nov 2014 14:58:21 +0000 (16:58 +0200)] 
proxyarp: Use C library header files and CONFIG_IPV6

This replaces the use of Linux kernel header files (linux/ip.h,
linux/udp.h, linux/ipv6.h, and linux/icmpv6.h) with equivalent header
files from C library. In addition, ndisc_snoop.c is now built
conditionally on CONFIG_IPV6=y so that it is easier to handle hostapd
builds with toolchains that do not support IPv6 even if Hotspot 2.0 is
enabled in the build.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSAE: Fix Anti-Clogging Token request frame format
Masashi Honma [Tue, 25 Nov 2014 02:04:41 +0000 (11:04 +0900)] 
SAE: Fix Anti-Clogging Token request frame format

This commit inserts Finite Cyclic Group to Anti-Clogging Token request
frame because IEEE Std 802.11-2012, Table 8-29 says "Finite Cyclic Group
is present if Status is zero or 76".

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
9 years agomesh: Fix SAE anti-clogging functionality for mesh
Masashi Honma [Tue, 25 Nov 2014 02:04:40 +0000 (11:04 +0900)] 
mesh: Fix SAE anti-clogging functionality for mesh

The mesh anti-clogging functionality is implemented partially. This
patch fixes to parse anti-clogging request frame and use anti-clogging
token.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
9 years agotests: Clear sae_groups to default value in forgotten cases
Jouni Malinen [Tue, 25 Nov 2014 13:19:19 +0000 (15:19 +0200)] 
tests: Clear sae_groups to default value in forgotten cases

It was possible for some of the SAE test cases (e.g., ap_ft_sae) to fail
if they were run after the sae_groups test case that left the SAE group
configuration to a value that is not enabled by default. Fix this by
clearing sae_groups setting in the couple of test cases that were not
yet doing this.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: WPA2-PSK with RADIUS for passphrase
Jouni Malinen [Mon, 24 Nov 2014 23:28:34 +0000 (01:28 +0200)] 
tests: WPA2-PSK with RADIUS for passphrase

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSME: Fix a sign-compare warning
Jouni Malinen [Mon, 24 Nov 2014 23:07:16 +0000 (01:07 +0200)] 
SME: Fix a sign-compare warning

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: WNM BSS TM Req with non-global operating class table
Jouni Malinen [Mon, 24 Nov 2014 08:58:33 +0000 (10:58 +0200)] 
tests: WNM BSS TM Req with non-global operating class table

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Use country code, if available, to help in channel mapping
Jouni Malinen [Mon, 24 Nov 2014 08:57:38 +0000 (10:57 +0200)] 
WNM: Use country code, if available, to help in channel mapping

The country code from the current AP needs to be used in
ieee80211_chan_to_freq() to support cases where non-global operating
class table is used.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPA: Use more explicit WPA/RSN selector count validation
Jouni Malinen [Sun, 23 Nov 2014 19:08:13 +0000 (21:08 +0200)] 
WPA: Use more explicit WPA/RSN selector count validation

Some static analyzers had problems understanding "left < count * len"
(CID 62855, CID 62856), so convert this to equivalent "count > left /
len" (len here is fixed to 4, so this can be done efficiently).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPS: Add explicit message length limit of 50000 bytes
Jouni Malinen [Sun, 23 Nov 2014 18:57:34 +0000 (20:57 +0200)] 
WPS: Add explicit message length limit of 50000 bytes

Previously, this was implicitly limited by the 16-bit length field to
65535. This resulted in unhelpful static analyzer warnings (CID 62868).
Add an explicit (but pretty arbitrary) limit of 50000 bytes to avoid
this. The actual WSC messages are significantly shorter in practice, but
there is no specific protocol limit, so 50000 is as good as any limit to
use here.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoPeerKey: Clean up EAPOL-Key Key Data processing on AP
Jouni Malinen [Sun, 23 Nov 2014 18:51:26 +0000 (20:51 +0200)] 
PeerKey: Clean up EAPOL-Key Key Data processing on AP

This extends the earlier PeerKey station side design to be used on the
AP side as well by passing pointer and already validated length from the
caller rather than parsing the length again from the frame buffer. This
avoids false warnings from static analyzer (CID 62870, CID 62871,
CID 62872).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-IKEv2: Make proposal_len validation clearer
Jouni Malinen [Sun, 23 Nov 2014 18:39:52 +0000 (20:39 +0200)] 
EAP-IKEv2: Make proposal_len validation clearer

Some static analyzers seem to have issues understanding "pos +
proposal_len > end" style validation, so convert this to "proposal_len >
end - pos" to make this more obvious to be bounds checking for
proposal_len. (CID 62874)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST: Make PAC file A_ID parser easier to analyze
Jouni Malinen [Sun, 23 Nov 2014 18:36:17 +0000 (20:36 +0200)] 
EAP-FAST: Make PAC file A_ID parser easier to analyze

Some static analyzers seem to have issues with "pos + len > end"
validation (CID 62875), so convert this to "len > end - pos" to make it
more obvious that len is validated against its bounds.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST: Clean up binary PAC file parser validation steps
Jouni Malinen [Sun, 23 Nov 2014 18:31:08 +0000 (20:31 +0200)] 
EAP-FAST: Clean up binary PAC file parser validation steps

This was too difficult for some static analyzers (CID 62876). In
addition, the pac_info_len assignment should really have explicitly
validated that there is room for the two octet length field instead of
trusting the following validation step to handle both this and the
actual pac_info_len bounds checking.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoradiotap: Initialize all members in ieee80211_radiotap_iterator_init()
Jouni Malinen [Sun, 23 Nov 2014 18:23:35 +0000 (20:23 +0200)] 
radiotap: Initialize all members in ieee80211_radiotap_iterator_init()

_next_ns_data could look like it would be used uninitialized in
ieee80211_radiotap_iterator_next() to static analyzers. Avoid
unnecessary reports by explicitly initializing all variables in struct
ieee80211_radiotap_iterator. (CID 62878)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoGAS: Clean up Query Response length validation
Jouni Malinen [Sun, 23 Nov 2014 18:13:09 +0000 (20:13 +0200)] 
GAS: Clean up Query Response length validation

Previous version was correct, but apparently too complex for some static
analyzers. (CID 68119)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHS 2.0: Clarify OSU Server URI length validation
Jouni Malinen [Sun, 23 Nov 2014 18:04:29 +0000 (20:04 +0200)] 
HS 2.0: Clarify OSU Server URI length validation

The previous version was valid, but apparently too complex for some
static analyzers. Use a local variable for uri_len and explicitly
compare it against the remaining buffer length. (CID 68121)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHS 2.0: More explicit hs20_osu_icon_fetch() length validation
Jouni Malinen [Sun, 23 Nov 2014 16:55:06 +0000 (18:55 +0200)] 
HS 2.0: More explicit hs20_osu_icon_fetch() length validation

The previous version was fine, but too much for some static analyzers to
understand as proper bounds checking. (CID 68122)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Make p2p_parse_p2p_ie() validation steps easier to analyze
Jouni Malinen [Sun, 23 Nov 2014 16:51:16 +0000 (18:51 +0200)] 
P2P: Make p2p_parse_p2p_ie() validation steps easier to analyze

Validation was fine, but a bit too complex for some static analyzers to
understand. (CID 68125)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoUse more explicit num_pmkid validation in RSN IE parsing
Jouni Malinen [Sun, 23 Nov 2014 16:43:59 +0000 (18:43 +0200)] 
Use more explicit num_pmkid validation in RSN IE parsing

Static analyzers may not have understood the bounds checking on
data->num_pmkid. Use a local, temporary variable and validate that that
value is within length limits before assining this to data->num_pmkid to
make this clearer. (CID 62857, CID 68126)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoPCSC: Use clearer file TLV length validation step
Jouni Malinen [Sun, 23 Nov 2014 16:32:04 +0000 (18:32 +0200)] 
PCSC: Use clearer file TLV length validation step

This makes it easier for static analyzer to confirm that the length
field bounds are checked. WPA_GET_BE16() is also used instead of
explicit byte-swapping operations in this file. (CID 68129)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Use a clearer validation step for key_len_total
Jouni Malinen [Sun, 23 Nov 2014 16:04:02 +0000 (18:04 +0200)] 
WNM: Use a clearer validation step for key_len_total

The previous one based on pointer arithmetic was apparently too much for
some static analyzers (CID 68130).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoTLS client: Check DH parameters using a local variable
Jouni Malinen [Sun, 23 Nov 2014 15:48:34 +0000 (17:48 +0200)] 
TLS client: Check DH parameters using a local variable

Use a temporary, local variable to check the DH parameters received from
the server before assigning the length to the struct tlsv1_client
variables. This will hopefully make it easier for static analyzers to
figure out that there is bounds checking for the value. (CID 72699)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoInterworking: Clearer ANQP element length validation
Jouni Malinen [Sun, 23 Nov 2014 15:13:47 +0000 (17:13 +0200)] 
Interworking: Clearer ANQP element length validation

The upper bound for the element length was already verified, but that
was not apparently noticed by a static analyzer (CID 68128).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRADIUS client: Print a clear debug log entry if socket is not available
Jouni Malinen [Sun, 23 Nov 2014 15:06:24 +0000 (17:06 +0200)] 
RADIUS client: Print a clear debug log entry if socket is not available

It could have been possible to select a socket that is not open
(sel_sock == -1) and try to use that in socket operations. This would
fail with potentially confusing error messages. Make this clearer by
printing a clear debug log entry on socket not being available.
(CID 72696)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoIKEv2: Use a bit clearer payload header validation step
Jouni Malinen [Sun, 23 Nov 2014 14:37:16 +0000 (16:37 +0200)] 
IKEv2: Use a bit clearer payload header validation step

It looks like the "pos + plen > end" case was not clear enough for a
static analyzer to figure out that plen was being verified to not go
beyond the buffer. (CID 72687)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Print debug message if Action frame sending fails
Jouni Malinen [Sun, 23 Nov 2014 14:13:50 +0000 (16:13 +0200)] 
WNM: Print debug message if Action frame sending fails

This makes wpa_drv_send_action() return value checking more consistent
(CID 75390).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: NEIGHBOR_REP_REQUEST failure cases
Jouni Malinen [Sat, 22 Nov 2014 19:49:45 +0000 (21:49 +0200)] 
tests: NEIGHBOR_REP_REQUEST failure cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agowpa_supplicant: Handle link measurement requests
Andrei Otcheretianski [Wed, 5 Nov 2014 08:42:56 +0000 (03:42 -0500)] 
wpa_supplicant: Handle link measurement requests

Send link measurement response when a request is received. Advertise
only RCPI, computing it from the RSSI of the request. The TX power field
is left to be filled by the driver. All other fields are not published.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
9 years agonl80211: Register Link Measurement Request Action frame
Andrei Otcheretianski [Wed, 5 Nov 2014 08:42:55 +0000 (03:42 -0500)] 
nl80211: Register Link Measurement Request Action frame

Add link measurement request to registration of Action frames to be
handled by wpa_supplicant if the driver supports TX power value
insertation.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
9 years agowpa_cli: Add optional ssid to neighbor report request
Assaf Krauss [Wed, 5 Nov 2014 08:42:54 +0000 (03:42 -0500)] 
wpa_cli: Add optional ssid to neighbor report request

Add optional 'ssid' parameter to command "neighbor_rep_request".

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Add an option to specify SSID in neighbor report requests
Assaf Krauss [Wed, 5 Nov 2014 08:42:53 +0000 (03:42 -0500)] 
wpa_supplicant: Add an option to specify SSID in neighbor report requests

Allow supplying an SSID for the SSID IE. If not supplied, no SSID IE is
sent, and the request implies the current SSID.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_cli: Add neighbor_rep_request command
Assaf Krauss [Wed, 5 Nov 2014 08:42:52 +0000 (03:42 -0500)] 
wpa_cli: Add neighbor_rep_request command

Add neighbor_rep_request command to send a Neighbor Report Request
to the associated AP.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Add NEIGHBOR_REP_REQUEST command to the control interface
Assaf Krauss [Wed, 5 Nov 2014 08:42:51 +0000 (03:42 -0500)] 
wpa_supplicant: Add NEIGHBOR_REP_REQUEST command to the control interface

Add NEIGHBOR_REP_REQUEST command to the wpa_supplicant ctrl_iface.
This command triggers the sending of a Neighbor Report Request to the
associated AP.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Add support for Neighbor Report
Assaf Krauss [Wed, 5 Nov 2014 08:42:50 +0000 (03:42 -0500)] 
wpa_supplicant: Add support for Neighbor Report

Add the ability to send a Neighbor Report Request (part of
RRM). Requester is then notified once the report arrives.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agonl80211: Register Neighbor Report Response Action frame
Assaf Krauss [Wed, 5 Nov 2014 08:42:49 +0000 (03:42 -0500)] 
nl80211: Register Neighbor Report Response Action frame

Add Neighbor Report Response Action frame to registration of Action
frames to be handled by wpa_supplicant.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agoSME: Add RRM support to association request
Assaf Krauss [Wed, 5 Nov 2014 08:42:48 +0000 (03:42 -0500)] 
SME: Add RRM support to association request

In case the AP we are associating with advertises support for RRM,
advertise our own RRM support in the (Re)Association Request frame. This
is done by adding an RRM Capabilities IE. The underlying driver is
expected to further add a Power Capabilities IE to the request, and set
the Radio Measurement flag in the Capability Info field. At this point
the RRM Capabilities IE advertises no measurement support.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agowpa_supplicant: Store driver's RRM capabilities
Assaf Krauss [Wed, 5 Nov 2014 08:42:47 +0000 (03:42 -0500)] 
wpa_supplicant: Store driver's RRM capabilities

Store the RRM capability flags reported by the underlying driver.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agonl80211: Populate RRM flags in nl80211 driver
Assaf Krauss [Wed, 5 Nov 2014 08:42:46 +0000 (03:42 -0500)] 
nl80211: Populate RRM flags in nl80211 driver

Set the RRM capability flags, based on the capabilities reported
by the underlying driver.

In addition, upon connection, notify the underlying driver regarding
RRM support.

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agodriver: Add RRM-related definitions to driver interface
Assaf Krauss [Wed, 5 Nov 2014 08:42:45 +0000 (03:42 -0500)] 
driver: Add RRM-related definitions to driver interface

Add definitions for RRM (Radio Resource Measurement) support:
1. Flags that specify the RRM capabilities of the underlying driver
2. Flag for RRM in Capability Info field in Management frames
3. Indication in association parameters regarding an RRM connection

Signed-off-by: Assaf Krauss <assaf.krauss@intel.com>
9 years agotests: BSS Transition Management
Jouni Malinen [Sat, 22 Nov 2014 11:38:29 +0000 (13:38 +0200)] 
tests: BSS Transition Management

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Use recent scan results on BSS transition request
Jouni Malinen [Sat, 22 Nov 2014 18:12:12 +0000 (20:12 +0200)] 
WNM: Use recent scan results on BSS transition request

If the last scans are recent (for now, less than ten seconds old), use
them instead of triggering a new scan when a BSS Transition Management
Request frame is received. As a fallback, allow a new scan to be
triggered if no matches were found.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Optimize BSS transition management scans
Jouni Malinen [Sat, 22 Nov 2014 17:50:16 +0000 (19:50 +0200)] 
WNM: Optimize BSS transition management scans

When the list of preferred transition candidates is received, use the
identified channels to optimize the following scan so that no time is
wasted on other channels.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd generic operating class and channel to frequency function
Jouni Malinen [Sat, 22 Nov 2014 17:48:08 +0000 (19:48 +0200)] 
Add generic operating class and channel to frequency function

ieee80211_chan_to_freq() is a generic function that replaces and extends
the previous P2P-specific p2p_channel_to_freq(). The new function
supports both the global operating class table as well as the additional
US, EU, JP, and CN operating class tables.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Fix a typo in function name
Jouni Malinen [Sat, 22 Nov 2014 16:30:16 +0000 (18:30 +0200)] 
tests: Fix a typo in function name

except_ack() was supposed to be verifying that the frame was ACK'ed,
i.e., it was really supposed to be called expect_ack().

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Fix wnm_bss_tm_req status code expectation
Jouni Malinen [Sat, 22 Nov 2014 16:28:22 +0000 (18:28 +0200)] 
tests: Fix wnm_bss_tm_req status code expectation

The implementation of WNM BSS transition management was extended to be
able to return a reject status code based on whether a matching entry is
found. The test case wnm_bss_tm_req was trying to enforce a different
status code to be used here based on old implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Move transition candidate list processing to normal scan
Jouni Malinen [Sat, 22 Nov 2014 16:04:21 +0000 (18:04 +0200)] 
WNM: Move transition candidate list processing to normal scan

This makes it easier to optimize transition request processing.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Fix TM candidate freeing if multiple requests are processed
Jouni Malinen [Sat, 22 Nov 2014 15:28:04 +0000 (17:28 +0200)] 
WNM: Fix TM candidate freeing if multiple requests are processed

The previously cached candidate list needs to be free properly through a
call to wnm_deallocate_memory() to ensure all subelements gets freed.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Allow BSS transition request in same ESS even if RSSI is worse
Jouni Malinen [Sat, 22 Nov 2014 15:01:26 +0000 (17:01 +0200)] 
WNM: Allow BSS transition request in same ESS even if RSSI is worse

This allows an AP to steer us to another BSS within the ESS even if that
results in reduced signal strength as long as the signal strength with
the target BSS is expected to provide some connectivity.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Mark wnm_scan_response() static
Jouni Malinen [Sat, 22 Nov 2014 14:37:40 +0000 (16:37 +0200)] 
WNM: Mark wnm_scan_response() static

This function is not used outside wnm_sta.c.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Order BSS transmission candidate entries based on preference
Jouni Malinen [Sat, 22 Nov 2014 14:33:57 +0000 (16:33 +0200)] 
WNM: Order BSS transmission candidate entries based on preference

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Simplify how candidate subelements are stored
Jouni Malinen [Sat, 22 Nov 2014 13:37:27 +0000 (15:37 +0200)] 
WNM: Simplify how candidate subelements are stored

There is no need to use a separately allocated data structures for this.
A bitfield indicating which information is present and variables within
struct neighbor_report are simpler to use and more efficient.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Calculate valid-until time for transition candidate list
Jouni Malinen [Sat, 22 Nov 2014 11:54:08 +0000 (13:54 +0200)] 
WNM: Calculate valid-until time for transition candidate list

This is of more use than the raw validity interval (number of beacon
intervals) that was recorded previously.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Convert BSSID Info into a u32
Jouni Malinen [Sat, 22 Nov 2014 11:43:17 +0000 (13:43 +0200)] 
WNM: Convert BSSID Info into a u32

This is more convenient to use than u8 array.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWNM: Debug print WNM BSS Transition Candidate List
Jouni Malinen [Sat, 22 Nov 2014 11:38:11 +0000 (13:38 +0200)] 
WNM: Debug print WNM BSS Transition Candidate List

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd BSS-TM-RESP ctrl_iface event
Jouni Malinen [Sat, 22 Nov 2014 10:02:09 +0000 (12:02 +0200)] 
Add BSS-TM-RESP ctrl_iface event

This event allows external monitors to track STA response to BSS
Transition Management Request.

BSS-TM-RESP <STA addr> status_code=<#> bss_termination_delay=<#>
[target_bssid=<BSSID>]

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd BSS_TM_REQ command to send BSS Transition Management Request
Jouni Malinen [Sat, 22 Nov 2014 09:31:03 +0000 (11:31 +0200)] 
Add BSS_TM_REQ command to send BSS Transition Management Request

hostapd control interface can now be used to request transmission of a
BSS Transition Management Request frame to a specified station.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Authenticator processing for various EAPOL-Key key info values
Jouni Malinen [Fri, 21 Nov 2014 22:49:25 +0000 (00:49 +0200)] 
tests: Authenticator processing for various EAPOL-Key key info values

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: WPA EAPOL 4-way handshake protocol testing
Jouni Malinen [Fri, 21 Nov 2014 22:34:20 +0000 (00:34 +0200)] 
tests: WPA EAPOL 4-way handshake protocol testing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: WPA2 EAPOL-Key with incorrect type
Jouni Malinen [Fri, 21 Nov 2014 22:16:41 +0000 (00:16 +0200)] 
tests: WPA2 EAPOL-Key with incorrect type

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd names for assigned QCA nl80211 vendor subcmds
Jouni Malinen [Fri, 21 Nov 2014 19:46:01 +0000 (21:46 +0200)] 
Add names for assigned QCA nl80211 vendor subcmds

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Authenticator 4-way handshake protocol testing
Jouni Malinen [Fri, 21 Nov 2014 18:06:33 +0000 (20:06 +0200)] 
tests: Authenticator 4-way handshake protocol testing

This implements minimal RSN 4-way handshake Supplicant in Python and
uses that to test hostapd Authenticator implementation in various
possible protocol sequencies.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAP: Extend EAPOL-Key msg 1/4 retry workaround for changing SNonce
Jouni Malinen [Fri, 21 Nov 2014 15:02:00 +0000 (17:02 +0200)] 
AP: Extend EAPOL-Key msg 1/4 retry workaround for changing SNonce

If the 4-way handshake ends up having to retransmit the EAPOL-Key
message 1/4 due to a timeout on waiting for the response, it is possible
for the Supplicant to change SNonce between the first and second
EAPOL-Key message 2/4. This is not really desirable due to extra
complexities it causes on the Authenticator side, but some deployed
stations are doing this.

This message sequence looks like this:
AP->STA: EAPOL-Key 1/4 (replay counter 1, ANonce)
AP->STA: EAPOL-Key 1/4 (replay counter 2, ANonce)
STA->AP: EAPOL-Key 2/4 (replay counter 1, SNonce 1)
AP->STA: EAPOL-Key 3/4 (replay counter 3, ANonce)
STA->AP: EAPOL-Key 2/4 (replay counter 2, SNonce 2)
followed by either:
STA->AP: EAPOL-Key 4/4 (replay counter 3 using PTK from SNonce 1)
or:
AP->STA: EAPOL-Key 3/4 (replay counter 4, ANonce)
STA->AP: EAPOL-Key 4/4 (replay counter 4, using PTK from SNonce 2)

Previously, Authenticator implementation was able to handle the cases
where SNonce 1 and SNonce 2 were identifical (i.e., Supplicant did not
update SNonce which is the wpa_supplicant behavior) and where PTK
derived using SNonce 2 was used in EAPOL-Key 4/4. However, the case of
using PTK from SNonce 1 was rejected ("WPA: received EAPOL-Key 4/4
Pairwise with unexpected replay counter" since EAPOL-Key 3/4 TX and
following second EAPOL-Key 2/4 invalidated the Replay Counter that was
used previously with the first SNonce).

This commit extends the AP/Authenticator workaround to keep both SNonce
values in memory if two EAPOL-Key 2/4 messages are received with
different SNonce values. The following EAPOL-Key 4/4 message is then
accepted whether the MIC has been calculated with the latest SNonce (the
previously existing behavior) or with the earlier SNonce (the new
extension). This makes 4-way handshake more robust with stations that
update SNonce for each transmitted EAPOL-Key 2/4 message in cases where
EAPOL-Key message 1/4 needs to be retransmitted.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoPrint EAPOL-Key Replay Counter in Authenticator debug log
Jouni Malinen [Fri, 21 Nov 2014 13:35:19 +0000 (15:35 +0200)] 
Print EAPOL-Key Replay Counter in Authenticator debug log

This makes it easier to debug issues relared to EAPOL-Key
retransmissions.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoReserve QCA vendor specific nl80211 commands 53
Jouni Malinen [Thu, 20 Nov 2014 18:36:59 +0000 (20:36 +0200)] 
Reserve QCA vendor specific nl80211 commands 53

These is reserved for QCA use.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>