mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 23:21:10 +00:00
zebra: fix struct msghdr initializers
struct msghdr field orders are not strictly specified in POSIX. Improve portability by using designated initializer. This fixes build against musl c-library where struct msghdr is POSIX compliant (Linux kernel and glibc definitions are non-conforming). As the result is also more readable, struct iovec initilizers were also converted. Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
16ffb26fbb
commit
c299ed717e
@ -282,9 +282,17 @@ netlink_parse_info (int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
char buf[NL_PKT_BUF_SIZE];
|
char buf[NL_PKT_BUF_SIZE];
|
||||||
struct iovec iov = { buf, sizeof buf };
|
struct iovec iov = {
|
||||||
|
.iov_base = buf,
|
||||||
|
.iov_len = sizeof buf
|
||||||
|
};
|
||||||
struct sockaddr_nl snl;
|
struct sockaddr_nl snl;
|
||||||
struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
|
struct msghdr msg = {
|
||||||
|
.msg_name = (void *) &snl,
|
||||||
|
.msg_namelen = sizeof snl,
|
||||||
|
.msg_iov = &iov,
|
||||||
|
.msg_iovlen = 1
|
||||||
|
};
|
||||||
struct nlmsghdr *h;
|
struct nlmsghdr *h;
|
||||||
|
|
||||||
status = recvmsg (nl->sock, &msg, 0);
|
status = recvmsg (nl->sock, &msg, 0);
|
||||||
@ -1312,8 +1320,16 @@ netlink_talk (struct nlmsghdr *n, struct nlsock *nl)
|
|||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
struct sockaddr_nl snl;
|
struct sockaddr_nl snl;
|
||||||
struct iovec iov = { (void *) n, n->nlmsg_len };
|
struct iovec iov = {
|
||||||
struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
|
.iov_base = (void *) n,
|
||||||
|
.iov_len = n->nlmsg_len
|
||||||
|
};
|
||||||
|
struct msghdr msg = {
|
||||||
|
.msg_name = (void *) &snl,
|
||||||
|
.msg_namelen = sizeof snl,
|
||||||
|
.msg_iov = &iov,
|
||||||
|
.msg_iovlen = 1,
|
||||||
|
};
|
||||||
int save_errno;
|
int save_errno;
|
||||||
|
|
||||||
memset (&snl, 0, sizeof snl);
|
memset (&snl, 0, sizeof snl);
|
||||||
|
Loading…
Reference in New Issue
Block a user