summaryrefslogtreecommitdiff
path: root/package/avahi
diff options
context:
space:
mode:
Diffstat (limited to 'package/avahi')
-rw-r--r--package/avahi/avahi-optional-ipv6.patch147
1 files changed, 147 insertions, 0 deletions
diff --git a/package/avahi/avahi-optional-ipv6.patch b/package/avahi/avahi-optional-ipv6.patch
new file mode 100644
index 000000000..5caf87c87
--- /dev/null
+++ b/package/avahi/avahi-optional-ipv6.patch
@@ -0,0 +1,147 @@
+[PATCH] avahi-core: make ipv6 support optional on uclibc 0.9.31+
+
+uClibc 0.9.31+ doesn't define the IPV6_* defines when IPv6 support isn't
+enabled, causing the avahi build to break. Detect this configuration, and
+comment out IPv6 code if so.
+
+Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
+---
+ avahi-core/socket.c | 28 +++++++++++++++++++++++-----
+ 1 file changed, 23 insertions(+), 5 deletions(-)
+
+Index: avahi-0.6.23/avahi-core/socket.c
+===================================================================
+--- avahi-0.6.23.orig/avahi-core/socket.c
++++ avahi-0.6.23/avahi-core/socket.c
+@@ -47,6 +47,11 @@
+ #include <net/if_dl.h>
+ #endif
+
++#include <features.h>
++#if defined(__UCLIBC__) && !defined (__UCLIBC_HAS_IPV6__)
++#define NO_IPV6
++#endif
++
+ #include "dns.h"
+ #include "fdutil.h"
+ #include "socket.h"
+@@ -75,6 +80,7 @@ static void mdns_mcast_group_ipv4(struct
+ inet_pton(AF_INET, AVAHI_IPV4_MCAST_GROUP, &ret_sa->sin_addr);
+ }
+
++#ifndef NO_IPV6
+ static void mdns_mcast_group_ipv6(struct sockaddr_in6 *ret_sa) {
+ assert(ret_sa);
+
+@@ -83,6 +89,7 @@ static void mdns_mcast_group_ipv6(struct
+ ret_sa->sin6_port = htons(AVAHI_MDNS_PORT);
+ inet_pton(AF_INET6, AVAHI_IPV6_MCAST_GROUP, &ret_sa->sin6_addr);
+ }
++#endif
+
+ static void ipv4_address_to_sockaddr(struct sockaddr_in *ret_sa, const AvahiIPv4Address *a, uint16_t port) {
+ assert(ret_sa);
+@@ -95,6 +102,7 @@ static void ipv4_address_to_sockaddr(str
+ memcpy(&ret_sa->sin_addr, a, sizeof(AvahiIPv4Address));
+ }
+
++#ifndef NO_IPV6
+ static void ipv6_address_to_sockaddr(struct sockaddr_in6 *ret_sa, const AvahiIPv6Address *a, uint16_t port) {
+ assert(ret_sa);
+ assert(a);
+@@ -105,6 +113,7 @@ static void ipv6_address_to_sockaddr(str
+ ret_sa->sin6_port = htons(port);
+ memcpy(&ret_sa->sin6_addr, a, sizeof(AvahiIPv6Address));
+ }
++#endif
+
+ int avahi_mdns_mcast_join_ipv4(int fd, const AvahiIPv4Address *a, int idx, int join) {
+ #ifdef HAVE_STRUCT_IP_MREQN
+@@ -143,6 +152,7 @@ int avahi_mdns_mcast_join_ipv4(int fd, c
+ }
+
+ int avahi_mdns_mcast_join_ipv6(int fd, const AvahiIPv6Address *a, int idx, int join) {
++#ifndef NO_IPV6
+ struct ipv6_mreq mreq6;
+ struct sockaddr_in6 sa6;
+
+@@ -164,6 +174,9 @@ int avahi_mdns_mcast_join_ipv6(int fd, c
+ }
+
+ return 0;
++#else
++ return -1;
++#endif
+ }
+
+ static int reuseaddr(int fd) {
+@@ -372,6 +385,7 @@ fail:
+ }
+
+ int avahi_open_socket_ipv6(int no_reuse) {
++#ifndef NO_IPV6
+ struct sockaddr_in6 sa, local;
+ int fd = -1, yes, r;
+ int ttl;
+@@ -437,7 +451,7 @@ int avahi_open_socket_ipv6(int no_reuse)
+ fail:
+ if (fd >= 0)
+ close(fd);
+-
++#endif
+ return -1;
+ }
+
+@@ -567,7 +581,7 @@ int avahi_send_dns_packet_ipv6(
+ const AvahiIPv6Address *src_address,
+ const AvahiIPv6Address *dst_address,
+ uint16_t dst_port) {
+-
++#ifndef NO_IPV6
+ struct sockaddr_in6 sa;
+ struct msghdr msg;
+ struct iovec io;
+@@ -620,6 +634,9 @@ int avahi_send_dns_packet_ipv6(
+ }
+
+ return sendmsg_loop(fd, &msg, 0);
++#else
++ return -1;
++#endif
+ }
+
+ AvahiDnsPacket *avahi_recv_dns_packet_ipv4(
+@@ -782,7 +799,7 @@ AvahiDnsPacket *avahi_recv_dns_packet_ip
+ AvahiIPv6Address *ret_dst_address,
+ AvahiIfIndex *ret_iface,
+ uint8_t *ret_ttl) {
+-
++#ifndef NO_IPV6
+ AvahiDnsPacket *p = NULL;
+ struct msghdr msg;
+ struct iovec io;
+@@ -889,7 +906,7 @@ AvahiDnsPacket *avahi_recv_dns_packet_ip
+ fail:
+ if (p)
+ avahi_dns_packet_free(p);
+-
++#endif
+ return NULL;
+ }
+
+@@ -934,6 +951,7 @@ fail:
+ }
+
+ int avahi_open_unicast_socket_ipv6(void) {
++#ifndef NO_IPV6
+ struct sockaddr_in6 local;
+ int fd = -1, yes;
+
+@@ -974,6 +992,6 @@ int avahi_open_unicast_socket_ipv6(void)
+ fail:
+ if (fd >= 0)
+ close(fd);
+-
++#endif
+ return -1;
+ }