[pulseaudio-discuss] ticket #79 - disable IPv6 support
Iain Hibbert
plunky at rya-online.net
Wed Feb 11 03:12:48 PST 2009
On Tue, 10 Feb 2009, Jim Carter wrote:
> On Sat, 7 Feb 2009, Iain Hibbert wrote:
>
> > I found a need to disable IPv6 support and found that this was discussed
> > in ticket #79 but closed with "send a patch if you want it" comment but
> > nobody seems to have done so.
> >
> > I have prepared a patch to allow this, see "pa.diff" attached. If INET6 is
> > defined, IPv6 support is built, otherwise not. This can be controlled by
> > "CPPFLAGS=-DINET6" in environment passed to configure script.
> >
> > It would likely be better to have the configure script to handle this with
> > -disable-ipv6/-enable-ipv6....
>
> My autoconf.fu is nonexistent so I can't help on this. However, the IETF
> Mafia would prefer if all software supported IPv6 by default, suggesting
> that if possible the polarity should be SUPPRESS_IPv6 if you really, truly
> have to.
I can change it that way without a doubt - however, having the double
negative conditionals in C code is not that clear.. so,
I have worked on this, and new complete patch is attached - added
HAVE_IPV6 to the config.h file and the configure script enables it by
default, providing a '-disable-ipv6' option to turn it off if required. I
didn't make an actual 'test for IPv6' as its complex and likely better to
have it enabled (also, that caused no problems before now)
What should I do with this, is it sufficient to leave it in the mailing
list, should I attach it to the (closed) ticket or create a new one?
> I'm just getting started in this area, but as I understand it, getaddrinfo
> (3) silently bypasses IPv6 on a host with no IPv6 capability; or if the
> destination lacks an AAAA record it will provide either native IPv4 address
> structures or IPv4-in-IPv6 mapped addresses depending on caller flags or on
> whether it looks like the packet will go out on an IPv6-only interface.
The problem I found is not that the code does the right thing, but that
the code won't link because of missing symbols (in6addr_loopback and
in6addr_any are the usual suspects)
> About subscriptions: it's easy to join the list, stay on until your thread
> runs down, then unsubscribe. Alternatively, watch the list archive to pick
> up replies.
Yes I was doing that anyway, as my post presumably had to be moderated
which took a couple of days.
thanks,
iain
(patch is against 0.9.14 archive)
-------------- next part --------------
diff -ur orig/pulseaudio-0.9.14/config.h.in pulseaudio-0.9.14/config.h.in
--- orig/pulseaudio-0.9.14/config.h.in 2009-01-12 23:45:57.000000000 +0000
+++ pulseaudio-0.9.14/config.h.in 2009-02-11 11:01:37.000000000 +0000
@@ -131,6 +131,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define this to enable IPv6 connection support */
+#undef HAVE_IPV6
+
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
diff -ur orig/pulseaudio-0.9.14/configure.ac pulseaudio-0.9.14/configure.ac
--- orig/pulseaudio-0.9.14/configure.ac 2009-01-12 23:44:27.000000000 +0000
+++ pulseaudio-0.9.14/configure.ac 2009-02-11 11:01:45.000000000 +0000
@@ -1000,6 +1000,26 @@
AC_SUBST(HAVE_POLKIT)
AM_CONDITIONAL([HAVE_POLKIT], [test "x$HAVE_POLKIT" = x1])
+### IPv6 connection support (optional) ###
+
+AC_ARG_ENABLE([ipv6],
+ AS_HELP_STRING([--disable-ipv6],[Disable optional IPv6 support]),
+ [
+ case "${enableval}" in
+ yes) ipv6=yes ;;
+ no) ipv6=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --disable-ipv6) ;;
+ esac
+ ],
+ [ipv6=auto])
+
+if test "x${ipv6}" != xno ; then
+ AC_DEFINE([HAVE_IPV6], [1], [Define this to enable IPv6 connection support])
+ HAVE_IPV6=1
+else
+ HAVE_IPV6=0
+fi
+
### Build and Install man pages ###
AC_ARG_ENABLE(manpages,
AS_HELP_STRING([--disable-manpages],[Disable building and installation of man pages]),
@@ -1201,6 +1221,11 @@
ENABLE_POLKIT=yes
fi
+ENABLE_IPV6=no
+if test "x${HAVE_IPV6}" = "x1" ; then
+ ENABLE_IPV6=yes
+fi
+
ENABLE_PER_USER_ESOUND_SOCKET=no
if test "x$per_user_esound_socket" = "x1" ; then
ENABLE_PER_USER_ESOUND_SOCKET=yes
@@ -1232,6 +1257,7 @@
Enable TCP Wrappers: ${ENABLE_TCPWRAP}
Enable libsamplerate: ${ENABLE_LIBSAMPLERATE}
Enable PolicyKit: ${ENABLE_POLKIT}
+ Enable IPv6: ${ENABLE_IPV6}
System User: ${PA_SYSTEM_USER}
System Group: ${PA_SYSTEM_GROUP}
Realtime Group: ${PA_REALTIME_GROUP}
diff -ur orig/pulseaudio-0.9.14/src/modules/rtp/module-rtp-recv.c pulseaudio-0.9.14/src/modules/rtp/module-rtp-recv.c
--- orig/pulseaudio-0.9.14/src/modules/rtp/module-rtp-recv.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/modules/rtp/module-rtp-recv.c 2009-02-11 11:01:57.000000000 +0000
@@ -373,11 +373,13 @@
memset(&mr4, 0, sizeof(mr4));
mr4.imr_multiaddr = ((const struct sockaddr_in*) sa)->sin_addr;
r = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mr4, sizeof(mr4));
+#ifdef HAVE_IPV6
} else {
struct ipv6_mreq mr6;
memset(&mr6, 0, sizeof(mr6));
mr6.ipv6mr_multiaddr = ((const struct sockaddr_in6*) sa)->sin6_addr;
r = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mr6, sizeof(mr6));
+#endif
}
if (r < 0) {
@@ -608,7 +610,9 @@
struct userdata *u;
pa_modargs *ma = NULL;
struct sockaddr_in sa4;
+#ifdef HAVE_IPV6
struct sockaddr_in6 sa6;
+#endif
struct sockaddr *sa;
socklen_t salen;
const char *sap_address;
@@ -624,16 +628,18 @@
sap_address = pa_modargs_get_value(ma, "sap_address", DEFAULT_SAP_ADDRESS);
- if (inet_pton(AF_INET6, sap_address, &sa6.sin6_addr) > 0) {
- sa6.sin6_family = AF_INET6;
- sa6.sin6_port = htons(SAP_PORT);
- sa = (struct sockaddr*) &sa6;
- salen = sizeof(sa6);
- } else if (inet_pton(AF_INET, sap_address, &sa4.sin_addr) > 0) {
+ if (inet_pton(AF_INET, sap_address, &sa4.sin_addr) > 0) {
sa4.sin_family = AF_INET;
sa4.sin_port = htons(SAP_PORT);
sa = (struct sockaddr*) &sa4;
salen = sizeof(sa4);
+#ifdef HAVE_IPV6
+ } else if (inet_pton(AF_INET6, sap_address, &sa6.sin6_addr) > 0) {
+ sa6.sin6_family = AF_INET6;
+ sa6.sin6_port = htons(SAP_PORT);
+ sa = (struct sockaddr*) &sa6;
+ salen = sizeof(sa6);
+#endif
} else {
pa_log("Invalid SAP address '%s'", sap_address);
goto fail;
diff -ur orig/pulseaudio-0.9.14/src/modules/rtp/module-rtp-send.c pulseaudio-0.9.14/src/modules/rtp/module-rtp-send.c
--- orig/pulseaudio-0.9.14/src/modules/rtp/module-rtp-send.c 2009-01-12 23:11:38.000000000 +0000
+++ pulseaudio-0.9.14/src/modules/rtp/module-rtp-send.c 2009-02-11 11:02:02.000000000 +0000
@@ -177,7 +177,9 @@
pa_sample_spec ss;
pa_channel_map cm;
struct sockaddr_in sa4, sap_sa4;
+#ifdef HAVE_IPV6
struct sockaddr_in6 sa6, sap_sa6;
+#endif
struct sockaddr_storage sa_dst;
pa_source_output *o = NULL;
uint8_t payload;
@@ -247,16 +249,18 @@
dest = pa_modargs_get_value(ma, "destination", DEFAULT_DESTINATION);
- if (inet_pton(AF_INET6, dest, &sa6.sin6_addr) > 0) {
- sa6.sin6_family = af = AF_INET6;
- sa6.sin6_port = htons((uint16_t) port);
- sap_sa6 = sa6;
- sap_sa6.sin6_port = htons(SAP_PORT);
- } else if (inet_pton(AF_INET, dest, &sa4.sin_addr) > 0) {
+ if (inet_pton(AF_INET, dest, &sa4.sin_addr) > 0) {
sa4.sin_family = af = AF_INET;
sa4.sin_port = htons((uint16_t) port);
sap_sa4 = sa4;
sap_sa4.sin_port = htons(SAP_PORT);
+#ifdef HAVE_IPV6
+ } else if (inet_pton(AF_INET6, dest, &sa6.sin6_addr) > 0) {
+ sa6.sin6_family = af = AF_INET6;
+ sa6.sin6_port = htons((uint16_t) port);
+ sap_sa6 = sa6;
+ sap_sa6.sin6_port = htons(SAP_PORT);
+#endif
} else {
pa_log("Invalid destination '%s'", dest);
goto fail;
@@ -267,9 +271,14 @@
goto fail;
}
- if (connect(fd, af == AF_INET ? (struct sockaddr*) &sa4 : (struct sockaddr*) &sa6, (socklen_t) (af == AF_INET ? sizeof(sa4) : sizeof(sa6))) < 0) {
+ if (af == AF_INET && connect(fd, (struct sockaddr*) &sa4, sizeof(sa4)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
+#ifdef HAVE_IPV6
+ } else if (connect(fd, (struct sockaddr*) &sa6, sizeof(sa6)) < 0) {
+ pa_log("connect() failed: %s", pa_cstrerror(errno));
+ goto fail;
+#endif
}
if ((sap_fd = socket(af, SOCK_DGRAM, 0)) < 0) {
@@ -277,9 +286,14 @@
goto fail;
}
- if (connect(sap_fd, af == AF_INET ? (struct sockaddr*) &sap_sa4 : (struct sockaddr*) &sap_sa6, (socklen_t) (af == AF_INET ? sizeof(sap_sa4) : sizeof(sap_sa6))) < 0) {
+ if (af == AF_INET && connect(sap_fd, (struct sockaddr*) &sap_sa4, sizeof(sap_sa4)) < 0) {
+ pa_log("connect() failed: %s", pa_cstrerror(errno));
+ goto fail;
+#ifdef HAVE_IPV6
+ } else if (connect(sap_fd, (struct sockaddr*) &sap_sa6, sizeof(sap_sa6)) < 0) {
pa_log("connect() failed: %s", pa_cstrerror(errno));
goto fail;
+#endif
}
j = !!loop;
@@ -357,10 +371,19 @@
n = pa_sprintf_malloc("PulseAudio RTP Stream on %s", pa_get_fqdn(hn, sizeof(hn)));
- p = pa_sdp_build(af,
- af == AF_INET ? (void*) &((struct sockaddr_in*) &sa_dst)->sin_addr : (void*) &((struct sockaddr_in6*) &sa_dst)->sin6_addr,
- af == AF_INET ? (void*) &sa4.sin_addr : (void*) &sa6.sin6_addr,
+ if (af == AF_INET) {
+ p = pa_sdp_build(af,
+ (void*) &((struct sockaddr_in*) &sa_dst)->sin_addr,
+ (void*) &sa4.sin_addr,
n, (uint16_t) port, payload, &ss);
+#ifdef HAVE_IPV6
+ } else {
+ p = pa_sdp_build(af,
+ (void*) &((struct sockaddr_in6*) &sa_dst)->sin6_addr,
+ (void*) &sa6.sin6_addr,
+ n, (uint16_t) port, payload, &ss);
+#endif
+ }
pa_xfree(n);
diff -ur orig/pulseaudio-0.9.14/src/modules/rtp/sap.c pulseaudio-0.9.14/src/modules/rtp/sap.c
--- orig/pulseaudio-0.9.14/src/modules/rtp/sap.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/modules/rtp/sap.c 2009-02-11 11:01:49.000000000 +0000
@@ -83,18 +83,31 @@
return -1;
}
+#ifdef HAVE_IPV6
pa_assert(sa->sa_family == AF_INET || sa->sa_family == AF_INET6);
+#else
+ pa_assert(sa->sa_family == AF_INET);
+#endif
header = htonl(((uint32_t) 1 << 29) |
+#ifdef HAVE_IPV6
(sa->sa_family == AF_INET6 ? (uint32_t) 1 << 28 : 0) |
+#endif
(goodbye ? (uint32_t) 1 << 26 : 0) |
(c->msg_id_hash));
iov[0].iov_base = &header;
iov[0].iov_len = sizeof(header);
- iov[1].iov_base = sa->sa_family == AF_INET ? (void*) &((struct sockaddr_in*) sa)->sin_addr : (void*) &((struct sockaddr_in6*) sa)->sin6_addr;
- iov[1].iov_len = sa->sa_family == AF_INET ? 4U : 16U;
+ if (sa->sa_family == AF_INET) {
+ iov[1].iov_base = (void*) &((struct sockaddr_in*) sa)->sin_addr;
+ iov[1].iov_len = 4U;
+#ifdef HAVE_IPV6
+ } else {
+ iov[1].iov_base = (void*) &((struct sockaddr_in6*) sa)->sin6_addr;
+ iov[1].iov_len = 16U;
+#endif
+ }
iov[2].iov_base = (char*) MIME_TYPE;
iov[2].iov_len = sizeof(MIME_TYPE);
diff -ur orig/pulseaudio-0.9.14/src/modules/rtp/sdp.c pulseaudio-0.9.14/src/modules/rtp/sdp.c
--- orig/pulseaudio-0.9.14/src/modules/rtp/sdp.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/modules/rtp/sdp.c 2009-02-11 11:01:52.000000000 +0000
@@ -48,7 +48,12 @@
pa_assert(src);
pa_assert(dst);
+
+#ifdef HAVE_IPV6
pa_assert(af == AF_INET || af == AF_INET6);
+#else
+ pa_assert(af == AF_INET);
+#endif
pa_assert_se(f = pa_rtp_format_to_string(ss->format));
@@ -162,6 +167,7 @@
((struct sockaddr_in*) &i->sa)->sin_family = AF_INET;
((struct sockaddr_in*) &i->sa)->sin_port = 0;
i->salen = sizeof(struct sockaddr_in);
+#ifdef HAVE_IPV6
} else if (pa_startswith(t, "c=IN IP6 ")) {
char a[64];
size_t k;
@@ -179,6 +185,7 @@
((struct sockaddr_in6*) &i->sa)->sin6_family = AF_INET6;
((struct sockaddr_in6*) &i->sa)->sin6_port = 0;
i->salen = sizeof(struct sockaddr_in6);
+#endif
} else if (pa_startswith(t, "m=audio ")) {
if (i->payload > 127) {
diff -ur orig/pulseaudio-0.9.14/src/pulsecore/inet_ntop.c pulseaudio-0.9.14/src/pulsecore/inet_ntop.c
--- orig/pulseaudio-0.9.14/src/pulsecore/inet_ntop.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/pulsecore/inet_ntop.c 2009-02-11 11:02:23.000000000 +0000
@@ -38,7 +38,9 @@
const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) {
struct in_addr *in = (struct in_addr*)src;
+#ifdef HAVE_IPV6
struct in6_addr *in6 = (struct in6_addr*)src;
+#endif
assert(src && dst);
@@ -57,6 +59,7 @@
(int)(in->s_addr >> 24) & 0xff);
#endif
break;
+#ifdef HAVE_IPV6
case AF_INET6:
pa_snprintf(dst, cnt, "%x:%x:%x:%x:%x:%x:%x:%x",
in6->s6_addr[ 0] << 8 | in6->s6_addr[ 1],
@@ -68,6 +71,7 @@
in6->s6_addr[12] << 8 | in6->s6_addr[13],
in6->s6_addr[14] << 8 | in6->s6_addr[15]);
break;
+#endif
default:
errno = EAFNOSUPPORT;
return NULL;
diff -ur orig/pulseaudio-0.9.14/src/pulsecore/inet_pton.c pulseaudio-0.9.14/src/pulsecore/inet_pton.c
--- orig/pulseaudio-0.9.14/src/pulsecore/inet_pton.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/pulsecore/inet_pton.c 2009-02-11 11:02:26.000000000 +0000
@@ -38,7 +38,9 @@
int inet_pton(int af, const char *src, void *dst) {
struct in_addr *in = (struct in_addr*)dst;
+#ifdef HAVE_IPV6
struct in6_addr *in6 = (struct in6_addr*)dst;
+#endif
assert(src && dst);
@@ -48,8 +50,10 @@
if (in->s_addr == INADDR_NONE)
return 0;
break;
+#ifdef HAVE_IPV6
case AF_INET6:
/* FIXME */
+#endif
default:
errno = EAFNOSUPPORT;
return -1;
diff -ur orig/pulseaudio-0.9.14/src/pulsecore/ipacl.c pulseaudio-0.9.14/src/pulsecore/ipacl.c
--- orig/pulseaudio-0.9.14/src/pulsecore/ipacl.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/pulsecore/ipacl.c 2009-02-11 11:02:14.000000000 +0000
@@ -109,6 +109,7 @@
if (e.bits < 32 && (uint32_t) (ntohl(e.address_ipv4.s_addr) << e.bits) != 0)
pa_log_warn("Host part of ACL entry '%s/%u' is not zero!", a, e.bits);
+#ifdef HAVE_IPV6
} else if (inet_pton(AF_INET6, a, &e.address_ipv6) > 0) {
e.bits = bits == (uint32_t) -1 ? 128 : (int) bits;
@@ -138,6 +139,7 @@
if (t)
pa_log_warn("Host part of ACL entry '%s/%u' is not zero!", a, e.bits);
}
+#endif
} else {
pa_log_warn("Failed to parse address: %s", a);
@@ -183,14 +185,20 @@
if (getpeername(fd, (struct sockaddr*) &sa, &salen) < 0)
return -1;
+#ifdef HAVE_IPV6
if (sa.ss_family != AF_INET && sa.ss_family != AF_INET6)
+#else
+ if (sa.ss_family != AF_INET)
+#endif
return -1;
if (sa.ss_family == AF_INET && salen != sizeof(struct sockaddr_in))
return -1;
+#ifdef HAVE_IPV6
if (sa.ss_family == AF_INET6 && salen != sizeof(struct sockaddr_in6))
return -1;
+#endif
for (e = acl->entries; e; e = e->next) {
@@ -203,6 +211,7 @@
if (e->bits == 0 || /* this needs special handling because >> takes the right-hand side modulo 32 */
(ntohl(sai->sin_addr.s_addr ^ e->address_ipv4.s_addr) >> (32 - e->bits)) == 0)
return 1;
+#ifdef HAVE_IPV6
} else if (e->family == AF_INET6) {
int i, bits ;
struct sockaddr_in6 *sai = (struct sockaddr_in6*) &sa;
@@ -230,6 +239,7 @@
if (bits == 0)
return 1;
}
+#endif
}
}
diff -ur orig/pulseaudio-0.9.14/src/pulsecore/socket-client.c pulseaudio-0.9.14/src/pulsecore/socket-client.c
--- orig/pulseaudio-0.9.14/src/pulsecore/socket-client.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/pulsecore/socket-client.c 2009-02-11 11:02:19.000000000 +0000
@@ -278,7 +278,11 @@
pa_make_fd_cloexec(c->fd);
+#ifdef HAVE_IPV6
if (sa->sa_family == AF_INET || sa->sa_family == AF_INET6)
+#else
+ if (sa->sa_family == AF_INET)
+#endif
pa_make_tcp_socket_low_delay(c->fd);
else
pa_make_socket_low_delay(c->fd);
@@ -353,6 +357,7 @@
c->userdata = userdata;
}
+#ifdef HAVE_IPV6
pa_socket_client* pa_socket_client_new_ipv6(pa_mainloop_api *m, uint8_t address[16], uint16_t port) {
struct sockaddr_in6 sa;
@@ -367,6 +372,7 @@
return pa_socket_client_new_sockaddr(m, (struct sockaddr*) &sa, sizeof(sa));
}
+#endif
#ifdef HAVE_LIBASYNCNS
@@ -470,7 +476,15 @@
pa_snprintf(port, sizeof(port), "%u", (unsigned) a.port);
memset(&hints, 0, sizeof(hints));
- hints.ai_family = a.type == PA_PARSED_ADDRESS_TCP4 ? PF_INET : (a.type == PA_PARSED_ADDRESS_TCP6 ? PF_INET6 : PF_UNSPEC);
+ if (a.type == PA_PARSED_ADDRESS_TCP4)
+ hints.ai_family = PF_INET;
+#ifdef HAVE_IPV6
+ else if (a.type == PA_PARSED_ADDRESS_TCP6)
+ hints.ai_family = PF_INET6;
+#endif
+ else
+ hints.ai_family = PF_UNSPEC;
+
hints.ai_socktype = SOCK_STREAM;
#if defined(HAVE_LIBASYNCNS)
@@ -509,11 +523,13 @@
struct hostent *host = NULL;
struct sockaddr_in s;
+#ifdef HAVE_IPV6
/* FIXME: PF_INET6 support */
if (hints.ai_family == PF_INET6) {
pa_log_error("IPv6 is not supported on Windows");
goto finish;
}
+#endif
host = gethostbyname(a.path_or_host);
if (!host) {
diff -ur orig/pulseaudio-0.9.14/src/pulsecore/socket-server.c pulseaudio-0.9.14/src/pulsecore/socket-server.c
--- orig/pulseaudio-0.9.14/src/pulsecore/socket-server.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/pulsecore/socket-server.c 2009-02-11 11:02:10.000000000 +0000
@@ -289,6 +289,7 @@
return NULL;
}
+#ifdef HAVE_IPV6
pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port, const char *tcpwrap_service) {
pa_socket_server *ss;
int fd = -1;
@@ -347,6 +348,7 @@
return NULL;
}
+#endif
pa_socket_server* pa_socket_server_new_ipv4_loopback(pa_mainloop_api *m, uint16_t port, const char *tcpwrap_service) {
pa_assert(m);
@@ -389,6 +391,7 @@
return NULL;
}
+#ifdef HAVE_IPV6
pa_socket_server* pa_socket_server_new_ipv6_string(pa_mainloop_api *m, const char *name, uint16_t port, const char *tcpwrap_service) {
struct in6_addr ipv6;
@@ -401,6 +404,7 @@
return NULL;
}
+#endif
static void socket_server_free(pa_socket_server*s) {
pa_assert(s);
@@ -441,6 +445,7 @@
pa_assert(l > 0);
switch (s->type) {
+#ifdef HAVE_IPV6
case SOCKET_SERVER_IPV6: {
struct sockaddr_in6 sa;
socklen_t sa_len = sizeof(sa);
@@ -476,6 +481,7 @@
return c;
}
+#endif
case SOCKET_SERVER_IPV4: {
struct sockaddr_in sa;
diff -ur orig/pulseaudio-0.9.14/src/pulsecore/socket-util.c pulseaudio-0.9.14/src/pulsecore/socket-util.c
--- orig/pulseaudio-0.9.14/src/pulsecore/socket-util.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/pulsecore/socket-util.c 2009-02-11 11:02:31.000000000 +0000
@@ -93,7 +93,9 @@
union {
struct sockaddr sa;
struct sockaddr_in in;
+#ifdef HAVE_IPV6
struct sockaddr_in6 in6;
+#endif
#ifdef HAVE_SYS_UN_H
struct sockaddr_un un;
#endif
@@ -112,6 +114,7 @@
ip & 0xFF,
ntohs(sa.in.sin_port));
return;
+#ifdef HAVE_IPV6
} else if (sa.sa.sa_family == AF_INET6) {
char buf[INET6_ADDRSTRLEN];
const char *res;
@@ -121,6 +124,7 @@
pa_snprintf(c, l, "TCP/IP client from [%s]:%u", buf, ntohs(sa.in6.sin6_port));
return;
}
+#endif
#ifdef HAVE_SYS_UN_H
} else if (sa.sa.sa_family == AF_UNIX) {
pa_snprintf(c, l, "UNIX socket client");
@@ -294,8 +298,10 @@
case AF_INET:
return ((const struct sockaddr_in*) sa)->sin_addr.s_addr == INADDR_LOOPBACK;
+#ifdef HAVE_IPV6
case AF_INET6:
return memcmp(&((const struct sockaddr_in6*) sa)->sin6_addr, &in6addr_loopback, sizeof(struct in6_addr)) == 0;
+#endif
default:
return FALSE;
@@ -307,7 +313,9 @@
union {
struct sockaddr sa;
struct sockaddr_in in;
+#ifdef HAVE_IPV6
struct sockaddr_in6 in6;
+#endif
#ifdef HAVE_SYS_UN_H
struct sockaddr_un un;
#endif
diff -ur orig/pulseaudio-0.9.14/src/tests/ipacl-test.c pulseaudio-0.9.14/src/tests/ipacl-test.c
--- orig/pulseaudio-0.9.14/src/tests/ipacl-test.c 2009-01-12 23:10:34.000000000 +0000
+++ pulseaudio-0.9.14/src/tests/ipacl-test.c 2009-02-11 11:02:05.000000000 +0000
@@ -30,7 +30,9 @@
int main(int argc, char *argv[]) {
struct sockaddr_in sa;
+#ifdef HAVE_IPV6
struct sockaddr_in6 sa6;
+#endif
int fd;
int r;
pa_ip_acl *acl;
@@ -87,6 +89,7 @@
close(fd);
+#ifdef HAVE_IPV6
fd = socket(PF_INET6, SOCK_STREAM, 0);
assert(fd >= 0);
@@ -129,6 +132,7 @@
pa_ip_acl_free(acl);
close(fd);
+#endif
return 0;
}
More information about the pulseaudio-discuss
mailing list