2015-06-12 16:53 GMT+02:00 Willy Tarreau <[email protected]>:
> Hi Joris,
>
> On Fri, Jun 12, 2015 at 04:45:04PM +0200, joris dedieu wrote:
>> > $ git grep -n localtimezone
>> > include/common/standard.h:827:char localtimezone[6];
>> > src/haproxy.c:588:      strftime(localtimezone, 6, "%z", &curtime);
>> > src/standard.c:2340:    memcpy(dst, localtimezone, 5); // timezone
>>
>> Done and unfortunately it stills segfaulting. But despite Level3 high
>> quality route filtering near lunchtime, I think, I'm not too far. Has
>> you suggested I looked at nm output  and found things that make me
>> think on struct proxy size.
>>
>> I found that there was a link with _COMMON_COMPAT_H defined or not and
>> finally with CONFIG_HAP_TRANSPARENT.
>> Commenting lines 101 to 108 on include/common/compat.h without other
>> modifications stop segfaulting. I will try to continue this way.
>
> Ah, excellent finding. Indeed :
>
>    - struct proxy references struct conn_src
>    - struct conn_src's size depends on CONFIG_HAP_TRANSPARENT.
>    - CONFIG_HAP_TRANSPARENT is set in compat.h when certain #defines
>      are found.
>
> The conditions to set it are defined in compat.h :
>
> #if defined(IP_FREEBIND)       \
>  || defined(IP_BINDANY)        \
>  || defined(IPV6_BINDANY)      \
>  || defined(SO_BINDANY)        \
>  || defined(IP_TRANSPARENT)    \
>  || defined(IPV6_TRANSPARENT)
> #define CONFIG_HAP_TRANSPARENT
> #endif
>
> I know that we don't have the same on FreeBSD and Linux, and it's very
> likely that the right one depends on certain includes on FreeBSD which
> are not set in compat.h, so that depending on what file includes compat.h,
> your define is set or not.
>
> I would not be surprized that adding this line to compat.h solves the
> problem :
>
>   #include <netinet/in.h>

It was this one. So I finally add

*  limits.h for things like LONG_MIN or MAX_HOSTNAME_LEN to have the
correct definition
*  netinet/in.h so that struct conn_src have the right size


diff --git a/include/common/compat.h b/include/common/compat.h
index ecbc3b1..07dd01d 100644
--- a/include/common/compat.h
+++ b/include/common/compat.h
@@ -22,11 +22,13 @@
 #ifndef _COMMON_COMPAT_H
 #define _COMMON_COMPAT_H

+#include <limits.h>
 /* This is needed on Linux for Netfilter includes */
 #include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>

 #ifndef BITS_PER_INT
 #define BITS_PER_INT    (8*sizeof(int))

Thanks for the help
Nice week-end
Joris

>
> If it's not this one, please copy the same as in standard.h.
> Once you find it, feel free to propose a patch and I'll merge it.
>
> Regards,
> Willy
>

Reply via email to