|
|
- From 5a566e3d01273de38490527fbd378c9a2f671b2c Mon Sep 17 00:00:00 2001
- From: Thierry FOURNIER <thierry.fournier@ozon.io>
- Date: Fri, 23 Dec 2016 17:03:25 +0100
- Subject: [PATCH 19/19] BUILD: lua: build failed on FreeBSD.
-
- s6_addr* fields are not available in the userland on
- BSD systems in general.
-
- bug reported by David Carlier
-
- needs backport to 1.7.x
- (cherry picked from commit de6925eccfaba85f1402c5e5cf700c420792802a)
- ---
- src/hlua_fcn.c | 18 ++++++++++--------
- 1 file changed, 10 insertions(+), 8 deletions(-)
-
- diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
- index 5ac533a..58905d7 100644
- --- a/src/hlua_fcn.c
- +++ b/src/hlua_fcn.c
- @@ -1016,14 +1016,16 @@ int hlua_match_addr(lua_State *L)
- return 1;
- }
- } else {
- - if (((addr1->addr.v6.ip.s6_addr32[0] & addr2->addr.v6.mask.s6_addr32[0]) ==
- - (addr2->addr.v6.ip.s6_addr32[0] & addr1->addr.v6.mask.s6_addr32[0])) &&
- - ((addr1->addr.v6.ip.s6_addr32[1] & addr2->addr.v6.mask.s6_addr32[1]) ==
- - (addr2->addr.v6.ip.s6_addr32[1] & addr1->addr.v6.mask.s6_addr32[1])) &&
- - ((addr1->addr.v6.ip.s6_addr32[2] & addr2->addr.v6.mask.s6_addr32[2]) ==
- - (addr2->addr.v6.ip.s6_addr32[2] & addr1->addr.v6.mask.s6_addr32[2])) &&
- - ((addr1->addr.v6.ip.s6_addr32[3] & addr2->addr.v6.mask.s6_addr32[3]) ==
- - (addr2->addr.v6.ip.s6_addr32[3] & addr1->addr.v6.mask.s6_addr32[3]))) {
- + int i;
- +
- + for (i = 0; i < 16; i += 4) {
- + if ((*(uint32_t *)&addr1->addr.v6.ip.s6_addr[i] &
- + *(uint32_t *)&addr2->addr.v6.mask.s6_addr[i]) !=
- + (*(uint32_t *)&addr2->addr.v6.ip.s6_addr[i] &
- + *(uint32_t *)&addr1->addr.v6.mask.s6_addr[i]))
- + break;
- + }
- + if (i == 16) {
- lua_pushboolean(L, 1);
- return 1;
- }
- --
- 2.10.2
-
|