netlink: update struct msghdr
The netlink code assumes an order for the members of struct msghdr. This breaks recvmsg and sendmsg with musl libc on mips64. Fix this by using designated initializers instead. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
This commit is contained in:
parent
f7a99acb4e
commit
31e9e10144
1 changed files with 12 additions and 2 deletions
|
@ -125,7 +125,12 @@ nl_get_reply(struct nl_sock *nl)
|
||||||
{
|
{
|
||||||
struct iovec iov = { nl->rx_buffer, NL_RX_SIZE };
|
struct iovec iov = { nl->rx_buffer, NL_RX_SIZE };
|
||||||
struct sockaddr_nl sa;
|
struct sockaddr_nl sa;
|
||||||
struct msghdr m = { (struct sockaddr *) &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
|
struct msghdr m = {
|
||||||
|
.msg_name = &sa,
|
||||||
|
.msg_namelen = sizeof(sa),
|
||||||
|
.msg_iov = &iov,
|
||||||
|
.msg_iovlen = 1,
|
||||||
|
};
|
||||||
int x = recvmsg(nl->fd, &m, 0);
|
int x = recvmsg(nl->fd, &m, 0);
|
||||||
if (x < 0)
|
if (x < 0)
|
||||||
die("nl_get_reply: %m");
|
die("nl_get_reply: %m");
|
||||||
|
@ -1231,7 +1236,12 @@ nl_async_hook(sock *sk, int size UNUSED)
|
||||||
{
|
{
|
||||||
struct iovec iov = { nl_async_rx_buffer, NL_RX_SIZE };
|
struct iovec iov = { nl_async_rx_buffer, NL_RX_SIZE };
|
||||||
struct sockaddr_nl sa;
|
struct sockaddr_nl sa;
|
||||||
struct msghdr m = { (struct sockaddr *) &sa, sizeof(sa), &iov, 1, NULL, 0, 0 };
|
struct msghdr m = {
|
||||||
|
.msg_name = &sa,
|
||||||
|
.msg_namelen = sizeof(sa),
|
||||||
|
.msg_iov = &iov,
|
||||||
|
.msg_iovlen = 1,
|
||||||
|
};
|
||||||
struct nlmsghdr *h;
|
struct nlmsghdr *h;
|
||||||
int x;
|
int x;
|
||||||
uint len;
|
uint len;
|
||||||
|
|
Loading…
Reference in a new issue