100-mrib.c-don-t-use-cpu_to_be32-outside-of-function.patch 968 B

1234567891011121314151617181920212223242526272829303132333435
  1. From 721064f2eb1dabe5bda63dcaff249b73ab891e6c Mon Sep 17 00:00:00 2001
  2. From: Eneas U de Queiroz <[email protected]>
  3. Date: Fri, 14 Dec 2018 15:13:41 -0200
  4. Subject: [PATCH] mrib.c: don't use cpu_to_be32 outside of function
  5. cpu_to_be32 is not a constant, so it can't be used outside of a
  6. function.
  7. Signed-off-by: Eneas U de Queiroz <[email protected]>
  8. --- a/src/mrib.c
  9. +++ b/src/mrib.c
  10. @@ -21,6 +21,7 @@
  11. #include <stdio.h>
  12. #include <string.h>
  13. #include <stdlib.h>
  14. +#include <endian.h>
  15. #include <sys/socket.h>
  16. #include <sys/ioctl.h>
  17. #include <unistd.h>
  18. @@ -54,7 +55,13 @@ struct mrib_iface {
  19. struct uloop_timeout timer;
  20. };
  21. -static uint32_t ipv4_rtr_alert = cpu_to_be32(0x94040000);
  22. +/* we can't use cpu_to_be32 outside a function */
  23. +#if __BYTE_ORDER == __BIG_ENDIAN
  24. +static uint32_t ipv4_rtr_alert = 0x94040000;
  25. +#else
  26. +static uint32_t ipv4_rtr_alert = 0x00000494;
  27. +#endif
  28. +
  29. static struct {
  30. struct ip6_hbh hdr;
  31. struct ip6_opt_router rt;