You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.6 KiB

  1. From dbb2cac9139954bd18813e88bfcb622ad3e93c54 Mon Sep 17 00:00:00 2001
  2. From: Stijn Tintel <stijn@linux-ipv6.be>
  3. Date: Tue, 10 May 2016 04:26:31 +0300
  4. Subject: [PATCH] vrrp: update struct msghdr
  5. The vrrp netlink code assumes an order for the members of struct msghdr.
  6. This breaks recvmsg and sendmsg with musl libc on mips64. Fix this by
  7. using designated initializers instead.
  8. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
  9. ---
  10. keepalived/vrrp/vrrp_netlink.c | 15 ++++++++++++---
  11. 1 file changed, 12 insertions(+), 3 deletions(-)
  12. diff --git a/keepalived/vrrp/vrrp_netlink.c b/keepalived/vrrp/vrrp_netlink.c
  13. index b19e2e7..2c2fd59 100644
  14. --- a/keepalived/vrrp/vrrp_netlink.c
  15. +++ b/keepalived/vrrp/vrrp_netlink.c
  16. @@ -416,8 +416,12 @@ netlink_parse_info(int (*filter) (struct sockaddr_nl *, struct nlmsghdr *),
  17. char buf[4096];
  18. struct iovec iov = { buf, sizeof buf };
  19. struct sockaddr_nl snl;
  20. - struct msghdr msg =
  21. - { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
  22. + struct msghdr msg = {
  23. + .msg_name = &snl,
  24. + .msg_namelen = sizeof(snl),
  25. + .msg_iov = &iov,
  26. + .msg_iovlen = 1,
  27. + };
  28. struct nlmsghdr *h;
  29. status = recvmsg(nl->fd, &msg, 0);
  30. @@ -538,7 +542,12 @@ netlink_talk(nl_handle_t *nl, struct nlmsghdr *n)
  31. int ret, flags;
  32. struct sockaddr_nl snl;
  33. struct iovec iov = { (void *) n, n->nlmsg_len };
  34. - struct msghdr msg = { (void *) &snl, sizeof snl, &iov, 1, NULL, 0, 0 };
  35. + struct msghdr msg = {
  36. + .msg_name = &snl,
  37. + .msg_namelen = sizeof(snl),
  38. + .msg_iov = &iov,
  39. + .msg_iovlen = 1,
  40. + };
  41. memset(&snl, 0, sizeof snl);
  42. snl.nl_family = AF_NETLINK;
  43. --
  44. 2.10.2