121 Commits

Author SHA1 Message Date
Tucker Polomik
d9123093e3 Merge branch 'fixup/remove-dead-code' into 'master'
Get rid of unused code.

See merge request prpl-foundation/prplmesh/stationsniffer!38
2023-11-30 21:31:01 +00:00
Tucker Polomik
6c0abd4656 station.{h|cpp}: remove is_potentially_mobile
Unused, never used, never going to be used.

Prefer to check for the locally administered bit being 1 and the unicast
bit being 0 in a MAC to determine if it's randomized.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-11-30 14:27:08 -07:00
Tucker Polomik
a1139ea609 Merge branch 'fixup/makefile-variable-flags' into 'master'
Makefile: append CXXFLAGS instead of overwriting

See merge request prpl-foundation/prplmesh/stationsniffer!35
2023-10-26 17:44:13 +00:00
Tucker Polomik
ff726fe10c tools: Makefile: append CXXFLAGS instead of overwriting
Also allow the compiler to be overridden by the compilation environment.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-10-26 11:39:56 -06:00
Tucker Polomik
64e348fdde Makefile: append CXXFLAGS instead of overwriting
Also allow the compiler to be overridden by the compilation environment.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-10-26 11:39:16 -06:00
Tucker Polomik
87194d338b Merge branch 'dev/add-docs' into 'master'
add doc dir

See merge request prpl-foundation/prplmesh/stationsniffer!34
2023-09-26 17:52:02 +00:00
Tucker Polomik
8b0c99d0c2 add doc dir
msg-format.txt describes the data structures and data flow of
station-sniffer's client/server architecture.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-09-26 11:48:49 -06:00
Tucker Polomik
81c8100063 Merge branch 'fix/remove-unused-message-types' into 'master'
treewide: remove unused message types

See merge request prpl-foundation/prplmesh/stationsniffer!33
2023-09-26 17:25:36 +00:00
Tucker Polomik
f03c8e4d40 treewide: extend MSG_GET_DISASSOCIATED_STATIONS utils and docs
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-09-25 09:10:49 -06:00
Tucker Polomik
21cfdb9a6a treewide: remove unused message types
Removes MSG_CHANGE_KEEPALIVE_TIMEOUT_MS and
MSG_CHANGE_PACKET_PERIODICITY_MS, two messages which were originally
provisioned for dynamic tuning and debugging, but have gone totally
unused.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-09-25 09:07:00 -06:00
Tucker Polomik
1597456d6b Merge branch 'fixup/tools/uds-client' into 'master'
tools: uds_client.c: add fill_mac to reduce repeated code

See merge request prpl-foundation/prplmesh/stationsniffer!32
2023-08-22 20:55:47 +00:00
Tucker Polomik
8c7ebd1900 tools: uds_client.c: add fill_mac
Helper function to place a MAC address into a binary buffer.

Removes duplicated code.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-08-22 14:47:31 -06:00
Tucker Polomik
180b1aedab Merge branch 'fixup/readme' into 'master'
Update README

See merge request prpl-foundation/prplmesh/stationsniffer!31
2023-08-16 16:48:57 +00:00
Tucker Polomik
6e46172a9a README: update hyperlink to binary protocol definition header
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-08-16 10:46:20 -06:00
Tucker Polomik
1ac47f6986 README: add libnl dependency
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-08-16 10:46:13 -06:00
Tucker Polomik
fe9fedd2bd Merge branch 'fixup/undefined-behavior' into 'master'
socket_server.cpp: add new UDS clients outside of iteration

See merge request prpl-foundation/prplmesh/stationsniffer!29
2023-07-27 23:19:35 +00:00
Tucker Polomik
965b4e0776 socket_server.cpp: add new UDS clients outside of iteration
Calling push_back() [or any member that may cause reallocation on an STL
data structure] while iterating the data structure via a range-based
for-loop may lead to undefined behavior.

Since range-based for-loops depend on the .begin() and .end() iterators
of iterable data structures, a reallocation will cause the end()
iterator to move, leaving the previous reference used for terminating
the for-loop incorrect.

To avoid this, mark new clients that have 'rung' our server socket for
addition after iterating the current poll FD set.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-27 17:07:49 -06:00
Tucker Polomik
2d5a184ca4 Merge branch 'fixup/unused-code-tools' into 'master'
tools: uds_client.c: delete unused code

See merge request prpl-foundation/prplmesh/stationsniffer!28
2023-07-27 23:01:06 +00:00
Tucker Polomik
90cbaa32e8 tools: test.py: remove unused code
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-27 16:37:02 -06:00
Tucker Polomik
0c51d3be0a tools: uds_client.c: fix Mac build
Seems gcc pulls strlen/memcpy in from stdio.h?

Need string.h for other platforms.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-27 16:33:56 -06:00
Tucker Polomik
0da016b76b tools: uds_client.c: delete unused code
Also fix a pointer cast problem (int8_t* to uint8_t* narrowing)

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-27 16:33:16 -06:00
Tucker Polomik
ad4ce8ad66 Merge branch 'fix/prune-dead-code' into 'master'
main: remove unused code

See merge request prpl-foundation/prplmesh/stationsniffer!27
2023-07-26 22:40:25 +00:00
Tucker Polomik
5a9035e49c README: update to reflect CL argument changes
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-26 16:37:25 -06:00
Tucker Polomik
d9232a83ea main: remove unused code
Update command line argument parsing and help message to reflect
packet_wait_time parameter no longer existing.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-26 16:36:49 -06:00
Tucker Polomik
fab579f0e1 Merge branch 'dev/mcs-ss-rate-parsing' into 'master'
parse, track data rate, nss, mcs index

See merge request prpl-foundation/prplmesh/stationsniffer!26
2023-07-18 21:00:55 +00:00
Tucker Polomik
abf1d7d7b8 station.{h,cpp}: add getter for antenna noise
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-18 14:54:44 -06:00
Tucker Polomik
1a4d0f8685 radiotap_{fields,parse}: add bandwidth and ant noise
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-18 14:53:54 -06:00
Tucker Polomik
d343668d8f station.{h|cpp}: add VHT metadata getter
Also trims trailing whitespace from station.h

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-18 14:53:51 -06:00
Tucker Polomik
d292e203a4 radiotap_parse/radiotap_fields: add VHT metadata
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-07-18 14:42:01 -06:00
Tucker Polomik
dbd877508b Merge branch 'hotfix/remove-stale-code' into 'master'
treewide: remove unused code

See merge request prpl-foundation/prplmesh/stationsniffer!23
2023-06-15 21:11:46 +00:00
Tucker Polomik
db7da38729 treewide: remove unused code
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-06-15 15:08:32 -06:00
Tucker Polomik
086874843f Merge branch 'feature/ci-build-check' into 'master'
gitlab-ci: add build stage

See merge request prpl-foundation/prplmesh/stationsniffer!25
2023-06-15 21:08:10 +00:00
Tucker Polomik
a7469568c4 gitlab-ci: add build stage
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-06-15 14:56:23 -06:00
Tucker Polomik
3431101306 Merge branch 'feat/track-sta-association' into 'master'
track station association state

See merge request prpl-foundation/prplmesh/stationsniffer!22
2023-06-09 21:50:48 +00:00
Tucker Polomik
fef0ce1226 station_manager_unittests: add disassociated station tests
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-06-09 15:48:22 -06:00
Tucker Polomik
c81243ebbd Add station association state tracking
Exposes new message type that allows a Unix client to ask if a given STA
MAC has disassociated from any BSS on the band that station-sniffer is
sniffing on.

We simply parse every packet and check if it's a management frame, and
if so:
    1. check it's subtype
    2. if disassociation, enqueue a message for clients

This allows other client applications a new way to ask about station
association state where it otherwise may not be valid (for example, a
station is not known to hostapd on a destination access point after a
virtual BSS roam occurs).

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-06-09 15:37:14 -06:00
Tucker Polomik
3febfa16c7 Merge branch 'feat/add-unit-tests' into 'master'
integrate Googletest and write unit tests for `station-sniffer`

See merge request prpl-foundation/prplmesh/stationsniffer!21
2023-06-09 21:35:14 +00:00
Tucker Polomik
3c8d2b54e6 README: add pipeline status badge
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-05-19 16:14:54 -06:00
Tucker Polomik
cf21ef05dd gitlab-ci: add unit_tests stage
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-05-19 16:11:16 -06:00
Tucker Polomik
edbace5b6d station_manager: fix broadcast capture bug
If a broadcast MAC address was registered as a staiton of interest to
the station manager, and a non-broadcast MAC address was subsequently
registered, the station manager would stop capturing broadcast traffic
(i.e. every packet that it can hear in the radio's current band).

This is a bug that was revealed by adding unit tests -- the manager
instance should continue to capture broadcast traffic until the
broadcast MAC is explicitly removed from it's MAC table.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-05-19 14:13:37 -06:00
Tucker Polomik
d7470d8615 add tests/ dir
Adds 'station_manager_unittests.cpp' and a Makefile for building
GTest/GMock

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-05-19 14:12:42 -06:00
Tucker Polomik
90b84fee3a git-submodules: add googletest
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-05-19 14:12:10 -06:00
Tucker Polomik
7a57e5e19f Merge branch 'fix/pollfd-mem-issues' into 'master'
socket_server.{cpp|h}: remove manual memory management of pollfd

See merge request prpl-foundation/prplmesh/stationsniffer!19
2023-05-05 19:11:05 +00:00
Tucker Polomik
48f2a4241e socket_server.{cpp|h}: remove manual memory management of pollfd
Just use a vector of pollfd instead.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-05-05 13:06:55 -06:00
Tucker Polomik
916aa4f443 Merge branch 'feature/add-bw-to-wma-msg' into 'master'
messages/message_handler: add bandwidth to the WMA payload

See merge request prpl-foundation/prplmesh/stationsniffer!18
2023-05-05 18:34:48 +00:00
Tucker Polomik
13cfef56f5 messages/message_handler: add bandwidth to the WMA payload
Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-05-04 09:17:16 -06:00
Tucker Polomik
ca6318046d Merge branch 'fix/rssi-sluggishness' into 'master'
main: call pcap_set_immediate_mode(handle, 1)

See merge request prpl-foundation/prplmesh/stationsniffer!17
2023-04-11 20:05:53 +00:00
Tucker Polomik
a266ff74b8 main: call pcap_set_immediate_mode(handle, 1)
Newer versions (>1.5.0) of libpcap do not set immediate mode on live
capture interfaces by default.

As a result, we would see a station physically move far from an AP but
the reported signal strength would sometimes take up to 60 seconds to
'catch up' due to packets being queued for processing.

Now, with immediate mode enabled, every packet is taken from the kernel
and given to registered pcap callbacks as the packet arrives.

Also removes a spammy debug log.

Signed-off-by: Tucker Polomik <t.polomik@cablelabs.com>
2023-04-10 16:49:04 -06:00
Tucker Polomik
fa582e973e Merge branch 'hotfix/interate-the-interfaces-to-get-the-bandwidth' into 'master'
Get the bandwidth information based on the wiphy instead of the MAC

See merge request prpl-foundation/prplmesh/stationsniffer!16
2023-04-06 17:39:23 +00:00
Raphaël Mélotte
98585e00ac main: check for bandwidth information periodically
It's entirely possible that when station-sniffer starts up, no beacon
information is available, but that it becomes available later on.  An
example of such a situation is when a prplMesh agent has a wireless
backhaul interface defined, but is not onboarded yet. In such a case,
the APs of the device will only start beaconing once the agent is
onboarded to the controller. Until then no beacon information will be
available.

To avoid the need to restart station-sniffer in such a case, start a
new thread to check for bandwidth information periodically if it was
not available initially. Once the agent onboards, the bandwidth
information will become available.

Note that we also slightly change what was done in commit
0625732af3 so that we stop running if
the pcap thread stops, but not if the bandwidth thread stops (in case
it happens to be the one we're joining).

Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
2023-03-30 17:33:33 +02:00