mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
selftests: mptcp: pm: use simpler send/recv forms
Instead of sendto() and recvfrom() which the NL address that was already provided before. Just simpler and easier to read without the to/from variants. While at it, fix a checkpatch warning by removing multiple assignments. Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://patch.msgid.link/20260508-net-next-mptcp-pm-inc-limits-v1-8-c84e3fdf9b6a@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c9b581e619
commit
ed5372634c
|
|
@ -217,8 +217,6 @@ static int capture_events(int fd, int event_group)
|
|||
/* do a netlink command and, if max > 0, fetch the reply ; nh's size >1024B */
|
||||
static int do_nl_req(int fd, struct nlmsghdr *nh, int len, int max)
|
||||
{
|
||||
struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };
|
||||
socklen_t addr_len;
|
||||
void *data = nh;
|
||||
int rem, ret;
|
||||
int err = 0;
|
||||
|
|
@ -230,15 +228,15 @@ static int do_nl_req(int fd, struct nlmsghdr *nh, int len, int max)
|
|||
}
|
||||
|
||||
nh->nlmsg_len = len;
|
||||
ret = sendto(fd, data, len, 0, (void *)&nladdr, sizeof(nladdr));
|
||||
ret = send(fd, data, len, 0);
|
||||
if (ret != len)
|
||||
error(1, errno, "send netlink: %uB != %uB\n", ret, len);
|
||||
|
||||
addr_len = sizeof(nladdr);
|
||||
rem = ret = recvfrom(fd, data, max, 0, (void *)&nladdr, &addr_len);
|
||||
ret = recv(fd, data, max, 0);
|
||||
if (ret < 0)
|
||||
error(1, errno, "recv netlink: %uB\n", ret);
|
||||
|
||||
rem = ret;
|
||||
/* Beware: the NLMSG_NEXT macro updates the 'rem' argument */
|
||||
for (; NLMSG_OK(nh, rem); nh = NLMSG_NEXT(nh, rem)) {
|
||||
if (nh->nlmsg_type == NLMSG_DONE)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user