I was not too sure of the best approach here. The body of the function is unchanged. I built it once w/o the #if.
I confirmed even trunk is mean to support 1.4 from configure.in But if someone prefers to fix it a different way, have at it. On Sat, Mar 24, 2018 at 10:52 AM, <[email protected]> wrote: > Author: covener > Date: Sat Mar 24 14:52:31 2018 > New Revision: 1827654 > > URL: http://svn.apache.org/viewvc?rev=1827654&view=rev > Log: > copy apr_sockaddr_is_wildcard to maintain 1.4.x support. > > > > Modified: > httpd/httpd/trunk/modules/metadata/mod_remoteip.c > > Modified: httpd/httpd/trunk/modules/metadata/mod_remoteip.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_remoteip.c?rev=1827654&r1=1827653&r2=1827654&view=diff > ============================================================================== > --- httpd/httpd/trunk/modules/metadata/mod_remoteip.c (original) > +++ httpd/httpd/trunk/modules/metadata/mod_remoteip.c Sat Mar 24 14:52:31 2018 > @@ -31,6 +31,7 @@ > #define APR_WANT_BYTEFUNC > #include "apr_want.h" > #include "apr_network_io.h" > +#include "apr_version.h" > > module AP_MODULE_DECLARE_DATA remoteip_module; > > @@ -314,6 +315,40 @@ static int remoteip_sockaddr_equal(apr_s > return (addr1->port == addr2->port && apr_sockaddr_equal(addr1, addr2)); > } > > +#if !APR_VERSION_AT_LEAST(1,5,0) > +#define apr_sockaddr_is_wildcard sockaddr_is_wildcard > +/* XXX: temp build fix from apr 1.5.x */ > +static int sockaddr_is_wildcard(const apr_sockaddr_t *addr) > +{ > + static const char inaddr_any[ > +#if APR_HAVE_IPV6 > + sizeof(struct in6_addr) > +#else > + sizeof(struct in_addr) > +#endif > + ] = {0}; > + > + if (addr->ipaddr_ptr /* IP address initialized */ > + && addr->ipaddr_len <= sizeof inaddr_any) { /* else bug elsewhere? */ > + if (!memcmp(inaddr_any, addr->ipaddr_ptr, addr->ipaddr_len)) { > + return 1; > + } > +#if APR_HAVE_IPV6 > + if (addr->family == AF_INET6 > + && IN6_IS_ADDR_V4MAPPED((struct in6_addr *)addr->ipaddr_ptr)) { > + struct in_addr *v4 = (struct in_addr *)&((apr_uint32_t > *)addr->ipaddr_ptr)[3]; > + > + if (!memcmp(inaddr_any, v4, sizeof *v4)) { > + return 1; > + } > + } > +#endif > + } > + return 0; > +} > +#endif > + > + > /** Similar to remoteip_sockaddr_equal, except that it handles wildcard > addresses > * and ports too. > */ > > -- Eric Covener [email protected]
