Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement access point discovery operations for Linux using netlink #85

Merged
merged 34 commits into from
Dec 30, 2023
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b343a57
Add scaffolding for netlink-based ap discovery operations.
abeltrano Dec 27, 2023
6a50d27
Add libmnl dependency.
abeltrano Dec 28, 2023
8972dd9
Add scope_exit impl.
abeltrano Dec 28, 2023
bbf2322
Add netlink socket establishment.
abeltrano Dec 28, 2023
e0ada5e
Fix libmnl target.
abeltrano Dec 28, 2023
d5c326a
Add initial tests for AccessPointDiscoveryAgentOperationsNetlink.
abeltrano Dec 28, 2023
8b3cde1
Add creation+destroy tests.
abeltrano Dec 28, 2023
427d7d8
Add ProbeAsync impl structure.
abeltrano Dec 28, 2023
59fea0f
Add ProbeAsync basic tests.
abeltrano Dec 28, 2023
ca21f50
Remove linmnl, add libnl.
abeltrano Dec 28, 2023
0321cae
Fix libnl target.
abeltrano Dec 29, 2023
2129db4
Add libnl helper library with raii wrappers.
abeltrano Dec 29, 2023
5de16fc
Document netlink wrappers.
abeltrano Dec 29, 2023
950494f
Add function to allocate new nl_socket.
abeltrano Dec 29, 2023
e65c449
Switch to libnl for async message processing.
abeltrano Dec 29, 2023
9cfb198
Use raii wrappers.
abeltrano Dec 29, 2023
f57daa9
Implement much of the netlink message processing loop.
abeltrano Dec 29, 2023
2af63a0
Make NetlinkSocket non-copyable.
abeltrano Dec 29, 2023
163cc9d
Make NetlinkMessage non-copyable.
abeltrano Dec 29, 2023
e82d899
Add ability to release ownership of NetlinkSocket.
abeltrano Dec 29, 2023
cf344af
Add netlink socket header for convenience.
abeltrano Dec 29, 2023
bfcc1f5
Allow 2nd-tier move of NetlinkSocket in lambda.
abeltrano Dec 29, 2023
e877de0
Add logging output to apmanager test.
abeltrano Dec 29, 2023
0358562
Avoid use of NetlinkMessage wrapper for processing.
abeltrano Dec 29, 2023
dd3f557
FIx presets.
abeltrano Dec 29, 2023
6fdb5b1
Fix bug processing epoll_wait() result.
abeltrano Dec 29, 2023
1b6277d
Add apmonitor test/utility program.
abeltrano Dec 29, 2023
560dea9
Force verbose makefile generation.
abeltrano Dec 29, 2023
b1fc0ce
Update impl to return nl message processing status.
abeltrano Dec 29, 2023
e2a6ed6
Remove libmnl changes from Dockerfile.
abeltrano Dec 29, 2023
25bdf6b
Add libnl-genl and libnl-route libraries.
abeltrano Dec 30, 2023
788de86
Add better cmake cache variable comment.
abeltrano Dec 30, 2023
f7e1639
Remove cmake property helper.
abeltrano Dec 30, 2023
12b8c72
Remove old target.
abeltrano Dec 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Document netlink wrappers.
abeltrano committed Dec 29, 2023
commit 5de16fc6e1e97506c4b4dfa3a87cb8df84a944ff
Original file line number Diff line number Diff line change
@@ -6,13 +6,44 @@

namespace Microsoft::Net::Netlink
{
/**
* @brief Heler for managing a netlink message, struct nl_msg. This class is not
* thread-safe.
*/
struct NetlinkMessage
{
/**
* @brief The netlink message owned by this object.
*/
struct nl_msg *Message{ nullptr };

/**
* @brief Construct a new NetlinkMessage object that does not own a netlink
* message object.
*/
NetlinkMessage() = default;

/**
* @brief Construct a new NetlinkMessage object that manages a pre-existing
* struct nl_msg object. Note that once construction is complete, this
* object owns the message and will free it when it is destroyed.
*
* @param message The netlink message to manage.
*/
NetlinkMessage(struct nl_msg *message);

/**
* @brief Destroy the NetlinkMessage object, freeing the managed netlink
* message if it exists.
*/
~NetlinkMessage();

/**
* @brief Implicit conversion operator to struct nl_msg *, allowing this
* class to be used in netlink API calls.
*
* @return struct nl_msg * The netlink message managed by this object.
*/
operator struct nl_msg *() const noexcept;
};
} // namespace Microsoft::Net::Netlink
Original file line number Diff line number Diff line change
@@ -6,13 +6,51 @@

namespace Microsoft::Net::Netlink
{
/**
* @brief Helper for managing a netlink socket, struct nl_sock. This class is
* not thread-safe.
*/
struct NetlinkSocket
{
/**
* @brief The netlink socket owned by this object.
*/
struct nl_sock *Socket{ nullptr };

/**
* @brief Allocate a new struct nl_sock, and wrap it in a NetlinkSocket.
*
* @return NetlinkSocket
*/
static NetlinkSocket Allocate();

/**
* @brief Construct a default NetlinkSocket object that does not own a
* netlink socket object.
*/
NetlinkSocket() = default;

/**
* @brief Construct a new NetlinkSocket that manages a pre-existing struct
* nl_sock object. Note that once construction is complete, this object owns
* the socket and will free it when it is destroyed.
*
* @param socket The netlink socket to manage.
*/
NetlinkSocket(struct nl_sock *socket);

/**
* @brief Destroy the NetlinkSocket object, freeing the managed netlink
* socket if it exists.
*/
~NetlinkSocket();

/**
* @brief Implicit conversion operator to struct nl_sock *, allowing this
* class to be used in netlink API calls.
*
* @return struct nl_sock * The netlink socket managed by this object.
*/
operator struct nl_sock *() const noexcept;
};
} // namespace Microsoft::Net::Netlink