[PATCH 4/6] netlink: Add l_netlink_request_sent
Denis Kenzior <[email protected]> Fri, 23 Aug 2024 11:15:48 -0500
| Newsgroups | dev.linux.lists.ell |
|---|---|
| Message-ID | <[email protected]> |
This is similar to l_genl_family_request_sent()
---
ell/ell.sym | 1 +
ell/netlink.c | 18 ++++++++++++++++++
ell/netlink.h | 1 +
3 files changed, 20 insertions(+)
diff --git a/ell/ell.sym b/ell/ell.sym
index 1499081cb25e..cbeb61ff0f46 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -431,6 +431,7 @@ global:
l_netlink_destroy;
l_netlink_send;
l_netlink_cancel;
+ l_netlink_request_sent;
l_netlink_register;
l_netlink_unregister;
l_netlink_set_debug;
diff --git a/ell/netlink.c b/ell/netlink.c
index 0be3009c736f..7e6ef0f760e7 100644
--- a/ell/netlink.c
+++ b/ell/netlink.c
@@ -467,6 +467,24 @@ LIB_EXPORT bool l_netlink_cancel(struct l_netlink *netlink, unsigned int id)
return true;
}
+LIB_EXPORT bool l_netlink_request_sent(struct l_netlink *netlink,
+ unsigned int id)
+{
+ struct command *command;
+ struct nlmsghdr *hdr;
+
+ if (unlikely(!netlink || !id))
+ return false;
+
+ command = l_hashmap_lookup(netlink->command_lookup, L_UINT_TO_PTR(id));
+ if (!command)
+ return false;
+
+ hdr = command->message->hdr;
+ return l_hashmap_lookup(netlink->command_pending,
+ L_UINT_TO_PTR(hdr->nlmsg_seq));
+}
+
static bool add_membership(struct l_netlink *netlink, uint32_t group)
{
int sk, value = group;
diff --git a/ell/netlink.h b/ell/netlink.h
index b51748195ca6..368f38619155 100644
--- a/ell/netlink.h
+++ b/ell/netlink.h
@@ -37,6 +37,7 @@ unsigned int l_netlink_send(struct l_netlink *netlink,
void *user_data,
l_netlink_destroy_func_t destroy);
bool l_netlink_cancel(struct l_netlink *netlink, unsigned int id);
+bool l_netlink_request_sent(struct l_netlink *netlink, unsigned int id);
unsigned int l_netlink_register(struct l_netlink *netlink,
uint32_t group, l_netlink_notify_func_t function,
--
2.45.2