From: Denis Kenzior <denkenz@gmail.com>
To: iwd@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 1/5] monitor: Remove unused code path
Date: Wed, 27 Dec 2023 00:09:46 -0600 [thread overview]
Message-ID: <20231227060954.103572-1-denkenz@gmail.com> (raw)
nlmon_print_genl invokes genl_ctrl when a generic netlink control
message is encountered. genl_ctrl() tries to filter nl80211 family
appearance messages and setup nlmon->id with the extracted family id.
However, the id is already provided inside main.c by using nlmon_open,
and no control messages are processed by nlmon in 'capture' mode (-r
command line argument not passed) since all genl messages go through
nlmon_message() path instead.
---
monitor/nlmon.c | 36 +++---------------------------------
1 file changed, 3 insertions(+), 33 deletions(-)
diff --git a/monitor/nlmon.c b/monitor/nlmon.c
index ed40264bacd6..7f8ecdaa1996 100644
--- a/monitor/nlmon.c
+++ b/monitor/nlmon.c
@@ -7359,35 +7359,6 @@ void nlmon_destroy(struct nlmon *nlmon)
l_free(nlmon);
}
-static void genl_ctrl(struct nlmon *nlmon, const void *data, uint32_t len)
-{
- const struct genlmsghdr *genlmsg = data;
- const struct nlattr *nla;
- char name[GENL_NAMSIZ];
- uint16_t id = 0;
-
- if (genlmsg->cmd != CTRL_CMD_NEWFAMILY)
- return;
-
- for (nla = data + GENL_HDRLEN; NLA_OK(nla, len);
- nla = NLA_NEXT(nla, len)) {
- switch (nla->nla_type & NLA_TYPE_MASK) {
- case CTRL_ATTR_FAMILY_ID:
- id = *((uint16_t *) NLA_DATA(nla));
- break;
- case CTRL_ATTR_FAMILY_NAME:
- strncpy(name, NLA_DATA(nla), GENL_NAMSIZ - 1);
- break;
- }
- }
-
- if (id == 0)
- return;
-
- if (!strcmp(name, NL80211_GENL_NAME))
- nlmon->id = id;
-}
-
static const char *scope_to_string(uint8_t scope)
{
switch (scope) {
@@ -8208,10 +8179,9 @@ void nlmon_print_genl(struct nlmon *nlmon, const struct timeval *tv,
for (nlmsg = data; NLMSG_OK(nlmsg, size);
nlmsg = NLMSG_NEXT(nlmsg, size)) {
if (nlmsg->nlmsg_type == GENL_ID_CTRL)
- genl_ctrl(nlmon, NLMSG_DATA(nlmsg),
- NLMSG_PAYLOAD(nlmsg, 0));
- else
- nlmon_message(nlmon, tv, NULL, nlmsg);
+ continue;
+
+ nlmon_message(nlmon, tv, NULL, nlmsg);
}
}
--
2.43.0
next reply other threads:[~2023-12-27 6:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-27 6:09 Denis Kenzior [this message]
2023-12-27 6:09 ` [PATCH 2/5] monitor: Remove unused PACKET_AUXDATA handling Denis Kenzior
2023-12-27 6:09 ` [PATCH 3/5] monitor: Use nlmon_print_* inside nlmon_receive Denis Kenzior
2023-12-27 6:09 ` [PATCH 4/5] monitor: Move iwmon reading logic into main.c Denis Kenzior
2023-12-27 6:09 ` [PATCH 5/5] RFC: Initial iwtrace utility Denis Kenzior
2024-01-02 13:30 ` James Prestwood
2024-01-02 17:01 ` [PATCH 1/5] monitor: Remove unused code path Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231227060954.103572-1-denkenz@gmail.com \
--to=denkenz@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox