030-ip-fix-problem-on-mips64-n64-big-endian-musl-systems.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From: Szabolcs Nagy <nsz@port70.net>
  2. Date: Sun, 24 Apr 2016 17:39:02 +0200
  3. Subject: [PATCH] ip: fix problem on mips64 n64 big endian musl systems
  4. Use designated initializers for struct msghdr.
  5. The struct layout is non-portable and musl libc does not match what busybox expects.
  6. Signed-off-by: Szabolcs Nagy <nsz@port70.net>
  7. Tested-by: Waldemar Brodkorb <wbx@openadk.org>
  8. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
  9. ---
  10. --- a/networking/libiproute/libnetlink.c
  11. +++ b/networking/libiproute/libnetlink.c
  12. @@ -71,11 +71,15 @@ int FAST_FUNC rtnl_dump_request(struct r
  13. struct nlmsghdr nlh;
  14. struct sockaddr_nl nladdr;
  15. struct iovec iov[2] = { { &nlh, sizeof(nlh) }, { req, len } };
  16. + /* Use designated initializers, struct layout is non-portable */
  17. struct msghdr msg = {
  18. - (void*)&nladdr, sizeof(nladdr),
  19. - iov, 2,
  20. - NULL, 0,
  21. - 0
  22. + .msg_name = (void*)&nladdr,
  23. + .msg_namelen = sizeof(nladdr),
  24. + .msg_iov = iov,
  25. + .msg_iovlen = 2,
  26. + .msg_control = NULL,
  27. + .msg_controllen = 0,
  28. + .msg_flags = 0
  29. };
  30. memset(&nladdr, 0, sizeof(nladdr));
  31. @@ -104,12 +108,15 @@ static int rtnl_dump_filter(struct rtnl_
  32. while (1) {
  33. int status;
  34. struct nlmsghdr *h;
  35. -
  36. + /* Use designated initializers, struct layout is non-portable */
  37. struct msghdr msg = {
  38. - (void*)&nladdr, sizeof(nladdr),
  39. - &iov, 1,
  40. - NULL, 0,
  41. - 0
  42. + .msg_name = (void*)&nladdr,
  43. + .msg_namelen = sizeof(nladdr),
  44. + .msg_iov = &iov,
  45. + .msg_iovlen = 1,
  46. + .msg_control = NULL,
  47. + .msg_controllen = 0,
  48. + .msg_flags = 0
  49. };
  50. status = recvmsg(rth->fd, &msg, 0);
  51. @@ -211,11 +218,15 @@ int FAST_FUNC rtnl_talk(struct rtnl_hand
  52. struct sockaddr_nl nladdr;
  53. struct iovec iov = { (void*)n, n->nlmsg_len };
  54. char *buf = xmalloc(8*1024); /* avoid big stack buffer */
  55. + /* Use designated initializers, struct layout is non-portable */
  56. struct msghdr msg = {
  57. - (void*)&nladdr, sizeof(nladdr),
  58. - &iov, 1,
  59. - NULL, 0,
  60. - 0
  61. + .msg_name = (void*)&nladdr,
  62. + .msg_namelen = sizeof(nladdr),
  63. + .msg_iov = &iov,
  64. + .msg_iovlen = 1,
  65. + .msg_control = NULL,
  66. + .msg_controllen = 0,
  67. + .msg_flags = 0
  68. };
  69. memset(&nladdr, 0, sizeof(nladdr));