1 [PATCH] avahi-core: make ipv6 support optional on uclibc 0.9.31+
3 uClibc 0.9.31+ doesn't define the IPV6_* defines when IPv6 support isn't
4 enabled, causing the avahi build to break. Detect this configuration, and
5 comment out IPv6 code if so.
7 Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
9 avahi-core/socket.c | 28 +++++++++++++++++++++++-----
10 1 file changed, 23 insertions(+), 5 deletions(-)
12 Index: avahi-0.6.23/avahi-core/socket.c
13 ===================================================================
14 --- avahi-0.6.23.orig/avahi-core/socket.c
15 +++ avahi-0.6.23/avahi-core/socket.c
17 #include <net/if_dl.h>
20 +#include <features.h>
21 +#if defined(__UCLIBC__) && !defined (__UCLIBC_HAS_IPV6__)
28 @@ -75,6 +80,7 @@ static void mdns_mcast_group_ipv4(struct
29 inet_pton(AF_INET, AVAHI_IPV4_MCAST_GROUP, &ret_sa->sin_addr);
33 static void mdns_mcast_group_ipv6(struct sockaddr_in6 *ret_sa) {
36 @@ -83,6 +89,7 @@ static void mdns_mcast_group_ipv6(struct
37 ret_sa->sin6_port = htons(AVAHI_MDNS_PORT);
38 inet_pton(AF_INET6, AVAHI_IPV6_MCAST_GROUP, &ret_sa->sin6_addr);
42 static void ipv4_address_to_sockaddr(struct sockaddr_in *ret_sa, const AvahiIPv4Address *a, uint16_t port) {
44 @@ -95,6 +102,7 @@ static void ipv4_address_to_sockaddr(str
45 memcpy(&ret_sa->sin_addr, a, sizeof(AvahiIPv4Address));
49 static void ipv6_address_to_sockaddr(struct sockaddr_in6 *ret_sa, const AvahiIPv6Address *a, uint16_t port) {
52 @@ -105,6 +113,7 @@ static void ipv6_address_to_sockaddr(str
53 ret_sa->sin6_port = htons(port);
54 memcpy(&ret_sa->sin6_addr, a, sizeof(AvahiIPv6Address));
58 int avahi_mdns_mcast_join_ipv4(int fd, const AvahiIPv4Address *a, int idx, int join) {
59 #ifdef HAVE_STRUCT_IP_MREQN
60 @@ -143,6 +152,7 @@ int avahi_mdns_mcast_join_ipv4(int fd, c
63 int avahi_mdns_mcast_join_ipv6(int fd, const AvahiIPv6Address *a, int idx, int join) {
65 struct ipv6_mreq mreq6;
66 struct sockaddr_in6 sa6;
68 @@ -164,6 +174,9 @@ int avahi_mdns_mcast_join_ipv6(int fd, c
77 static int reuseaddr(int fd) {
78 @@ -372,6 +385,7 @@ fail:
81 int avahi_open_socket_ipv6(int no_reuse) {
83 struct sockaddr_in6 sa, local;
86 @@ -437,7 +451,7 @@ int avahi_open_socket_ipv6(int no_reuse)
95 @@ -567,7 +581,7 @@ int avahi_send_dns_packet_ipv6(
96 const AvahiIPv6Address *src_address,
97 const AvahiIPv6Address *dst_address,
101 struct sockaddr_in6 sa;
104 @@ -620,6 +634,9 @@ int avahi_send_dns_packet_ipv6(
107 return sendmsg_loop(fd, &msg, 0);
113 AvahiDnsPacket *avahi_recv_dns_packet_ipv4(
114 @@ -782,7 +799,7 @@ AvahiDnsPacket *avahi_recv_dns_packet_ip
115 AvahiIPv6Address *ret_dst_address,
116 AvahiIfIndex *ret_iface,
120 AvahiDnsPacket *p = NULL;
123 @@ -889,7 +906,7 @@ AvahiDnsPacket *avahi_recv_dns_packet_ip
126 avahi_dns_packet_free(p);
132 @@ -934,6 +951,7 @@ fail:
135 int avahi_open_unicast_socket_ipv6(void) {
137 struct sockaddr_in6 local;
140 @@ -974,6 +992,6 @@ int avahi_open_unicast_socket_ipv6(void)