@@ -360,25 +360,28 @@ ngx_event_connect_set_transparent(ngx_peer_connection_t *pc, ngx_socket_t s)
360360
361361 case AF_INET :
362362
363- #if defined(IP_TRANSPARENT )
364-
365- if (setsockopt (s , IPPROTO_IP , IP_TRANSPARENT ,
366- (const void * ) & value , sizeof (int )) == -1 )
367- {
368- ngx_log_error (NGX_LOG_ALERT , pc -> log , ngx_socket_errno ,
369- "setsockopt(IP_TRANSPARENT) failed" );
370- return NGX_ERROR ;
371- }
372-
373- #elif defined(IP_BINDANY )
374-
375- if (setsockopt (s , IPPROTO_IP , IP_BINDANY ,
376- (const void * ) & value , sizeof (int )) == -1 )
363+ #if defined(NGX_HAVE_FSTACK )
364+ /****
365+ FreeBSD define IP_BINDANY in freebsd/netinet/in.h
366+ Fstack should only support IP_BINDANY.
367+ ****/
368+ #define IP_BINDANY 24
369+ if (setsockopt (s , IPPROTO_IP , IP_BINDANY ,
370+ (const void * ) & value , sizeof (int )) == -1 )
377371 {
378372 ngx_log_error (NGX_LOG_ALERT , pc -> log , ngx_socket_errno ,
379- "setsockopt(IP_BINDANY) failed" );
373+ "setsockopt(IP_BINDANY) failed" );
380374 return NGX_ERROR ;
381375 }
376+
377+ #elif defined(IP_TRANSPARENT )
378+ if (setsockopt (s , IPPROTO_IP , IP_TRANSPARENT ,
379+ (const void * ) & value , sizeof (int )) == -1 )
380+ {
381+ ngx_log_error (NGX_LOG_ALERT , pc -> log , ngx_socket_errno ,
382+ "setsockopt(IP_TRANSPARENT) failed" );
383+ return NGX_ERROR ;
384+ }
382385
383386#endif
384387
0 commit comments