omcproxy: fix compilation on little-endian CPUs
[openwrt/staging/blogic.git] / package / network / services / omcproxy / patches / 100-mrib.c-don-t-use-cpu_to_be32-outside-of-function.patch
1 From 721064f2eb1dabe5bda63dcaff249b73ab891e6c Mon Sep 17 00:00:00 2001
2 From: Eneas U de Queiroz <cote2004-github@yahoo.com>
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
6 cpu_to_be32 is not a constant, so it can't be used outside of a
7 function.
8
9 Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
10
11 --- a/src/mrib.c
12 +++ b/src/mrib.c
13 @@ -21,6 +21,7 @@
14 #include <stdio.h>
15 #include <string.h>
16 #include <stdlib.h>
17 +#include <endian.h>
18 #include <sys/socket.h>
19 #include <sys/ioctl.h>
20 #include <unistd.h>
21 @@ -54,7 +55,13 @@ struct mrib_iface {
22 struct uloop_timeout timer;
23 };
24
25 -static uint32_t ipv4_rtr_alert = cpu_to_be32(0x94040000);
26 +/* we can't use cpu_to_be32 outside a function */
27 +#if __BYTE_ORDER == __BIG_ENDIAN
28 +static uint32_t ipv4_rtr_alert = 0x94040000;
29 +#else
30 +static uint32_t ipv4_rtr_alert = 0x00000494;
31 +#endif
32 +
33 static struct {
34 struct ip6_hbh hdr;
35 struct ip6_opt_router rt;