From: Denis Kenzior <denkenz@gmail.com>
To: iwd@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 2/3] netdev: Update to the new l_netlink_send API
Date: Fri, 26 Jul 2024 17:37:44 -0500 [thread overview]
Message-ID: <20240726223754.159303-2-denkenz@gmail.com> (raw)
In-Reply-To: <20240726223754.159303-1-denkenz@gmail.com>
---
src/netdev.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index 2d70fc38eea9..e27a0019b7ea 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -6093,23 +6093,19 @@ error:
static void netdev_get_link(struct netdev *netdev)
{
- struct ifinfomsg *rtmmsg;
- size_t bufsize;
+ struct ifinfomsg ifi;
+ struct l_netlink_message *nlm =
+ l_netlink_message_new_sized(RTM_GETLINK, 0, sizeof(ifi));
- /* Query interface flags */
- bufsize = NLMSG_ALIGN(sizeof(struct ifinfomsg));
- rtmmsg = l_malloc(bufsize);
- memset(rtmmsg, 0, bufsize);
+ memset(&ifi, 0, sizeof(ifi));
+ ifi.ifi_family = AF_UNSPEC;
+ ifi.ifi_index = netdev->index;
- rtmmsg->ifi_family = AF_UNSPEC;
- rtmmsg->ifi_index = netdev->index;
+ l_netlink_message_add_header(nlm, &ifi, sizeof(ifi));
- netdev->get_link_cmd_id = l_netlink_send(rtnl, RTM_GETLINK, 0, rtmmsg,
- bufsize, netdev_getlink_cb,
+ netdev->get_link_cmd_id = l_netlink_send(rtnl, nlm, netdev_getlink_cb,
netdev, NULL);
L_WARN_ON(netdev->get_link_cmd_id == 0);
-
- l_free(rtmmsg);
}
struct netdev *netdev_create_from_genl(struct l_genl_msg *msg,
--
2.45.2
next prev parent reply other threads:[~2024-07-26 22:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 22:37 [PATCH 1/3] wired: Update to the new l_netlink_send API Denis Kenzior
2024-07-26 22:37 ` Denis Kenzior [this message]
2024-07-26 22:37 ` [PATCH 3/3] monitor: Update to the new ell " Denis Kenzior
2024-07-29 11:41 ` [PATCH 1/3] wired: Update to the new " James Prestwood
2024-07-30 15:53 ` 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=20240726223754.159303-2-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