mrib.c: don't use cpu_to_be32 outside of function
authorEneas U de Queiroz <cote2004-github@yahoo.com>
Fri, 14 Dec 2018 17:13:41 +0000 (15:13 -0200)
committerHans Dedecker <dedeckeh@gmail.com>
Sun, 16 Dec 2018 09:36:49 +0000 (10:36 +0100)
cpu_to_be32 is not a constant, so it can't be used outside of a
function.

Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
src/mrib.c

index 476768bc0df5dbb318217e05aa4c2966a6d6129a..bdb4493ced179d96148ac563a065bc269f52ef93 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <endian.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
@@ -54,7 +55,13 @@ struct mrib_iface {
        struct uloop_timeout timer;
 };
 
-static uint32_t ipv4_rtr_alert = cpu_to_be32(0x94040000);
+/* we can't use cpu_to_be32 outside a function */
+#if __BYTE_ORDER == __BIG_ENDIAN
+static uint32_t ipv4_rtr_alert = 0x94040000;
+#else
+static uint32_t ipv4_rtr_alert = 0x00000494;
+#endif
+
 static struct {
        struct ip6_hbh hdr;
        struct ip6_opt_router rt;