summaryrefslogtreecommitdiffstats
path: root/contrib/apr/network_io/unix/sockaddr.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2014-08-12 01:40:11 +0000
committerpeter <peter@FreeBSD.org>2014-08-12 01:40:11 +0000
commit72d63a715ab3bb85109696154deb9b90d0495852 (patch)
treece225c894795f3e26aadf9170baf8fd0556c18d2 /contrib/apr/network_io/unix/sockaddr.c
parentd307c6d3b7fc94a241aab28f56b9e92a10d98bee (diff)
downloadFreeBSD-src-72d63a715ab3bb85109696154deb9b90d0495852.zip
FreeBSD-src-72d63a715ab3bb85109696154deb9b90d0495852.tar.gz
MFC r266728,266731,266735,266736,268135,268960,269833
Update apr 1.4.8 -> 1.5.1 Update apr-util 1.5.2 -> 1.5.3 Update serf 1.3.4 -> 1.3.7 Update svnlite 1.8.8 -> 1.8.10 Deal with svnlite.1 manpage.
Diffstat (limited to 'contrib/apr/network_io/unix/sockaddr.c')
-rw-r--r--contrib/apr/network_io/unix/sockaddr.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/apr/network_io/unix/sockaddr.c b/contrib/apr/network_io/unix/sockaddr.c
index 9253a27..0dd1a2d 100644
--- a/contrib/apr/network_io/unix/sockaddr.c
+++ b/contrib/apr/network_io/unix/sockaddr.c
@@ -839,6 +839,35 @@ APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
return 0; /* not equal */
}
+APR_DECLARE(int) apr_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;
+}
+
static apr_status_t parse_network(apr_ipsubnet_t *ipsub, const char *network)
{
/* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */
OpenPOWER on IntegriCloud