Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69bc179b authored by Frank Maker's avatar Frank Maker
Browse files

libnl: BUGFIX to support wpa_supplicant p2p_find

Close socket file descriptor when nl_msg freed
Correct nested attribute container size when closing nest
parent a43546a8
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -87,8 +87,17 @@ struct nlattr *nla_nest_start(struct nl_msg *msg, int attrtype)
/* Finalize nesting of attributes. */
int nla_nest_end(struct nl_msg *msg, struct nlattr *start)
{
	struct nlattr *container;

	/* Adjust nested attribute container size */
	container = (unsigned char *) start - sizeof(struct nlattr);
	container->nla_len = (unsigned char *) \
		nlmsg_tail(nlmsg_hdr(msg)) - (unsigned char *)container;

	/* Fix attribute size */
	start->nla_len = (unsigned char *) \
		nlmsg_tail(nlmsg_hdr(msg)) - (unsigned char *)start;

	return 0;
}

+1 −0
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ struct nl_sock *nl_socket_alloc_cb(struct nl_cb *cb)
void nl_socket_free(struct nl_sock *sk)
{
	nl_cb_put(sk->s_cb);
	close(sk->s_fd);
	free(sk);
}