open-plc-utils: new package
[buildroot-gz.git] / package / avahi / 0005-optional-ipv6.patch
blob5caf87c87d0b7cd2522317e14031bd920ca32661
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>
8 ---
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
16 @@ -47,6 +47,11 @@
17 #include <net/if_dl.h>
18 #endif
20 +#include <features.h>
21 +#if defined(__UCLIBC__) && !defined (__UCLIBC_HAS_IPV6__)
22 +#define NO_IPV6
23 +#endif
25 #include "dns.h"
26 #include "fdutil.h"
27 #include "socket.h"
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);
32 +#ifndef NO_IPV6
33 static void mdns_mcast_group_ipv6(struct sockaddr_in6 *ret_sa) {
34 assert(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);
40 +#endif
42 static void ipv4_address_to_sockaddr(struct sockaddr_in *ret_sa, const AvahiIPv4Address *a, uint16_t port) {
43 assert(ret_sa);
44 @@ -95,6 +102,7 @@ static void ipv4_address_to_sockaddr(str
45 memcpy(&ret_sa->sin_addr, a, sizeof(AvahiIPv4Address));
48 +#ifndef NO_IPV6
49 static void ipv6_address_to_sockaddr(struct sockaddr_in6 *ret_sa, const AvahiIPv6Address *a, uint16_t port) {
50 assert(ret_sa);
51 assert(a);
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));
56 +#endif
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) {
64 +#ifndef NO_IPV6
65 struct ipv6_mreq mreq6;
66 struct sockaddr_in6 sa6;
68 @@ -164,6 +174,9 @@ int avahi_mdns_mcast_join_ipv6(int fd, c
71 return 0;
72 +#else
73 + return -1;
74 +#endif
77 static int reuseaddr(int fd) {
78 @@ -372,6 +385,7 @@ fail:
81 int avahi_open_socket_ipv6(int no_reuse) {
82 +#ifndef NO_IPV6
83 struct sockaddr_in6 sa, local;
84 int fd = -1, yes, r;
85 int ttl;
86 @@ -437,7 +451,7 @@ int avahi_open_socket_ipv6(int no_reuse)
87 fail:
88 if (fd >= 0)
89 close(fd);
91 +#endif
92 return -1;
95 @@ -567,7 +581,7 @@ int avahi_send_dns_packet_ipv6(
96 const AvahiIPv6Address *src_address,
97 const AvahiIPv6Address *dst_address,
98 uint16_t dst_port) {
100 +#ifndef NO_IPV6
101 struct sockaddr_in6 sa;
102 struct msghdr msg;
103 struct iovec io;
104 @@ -620,6 +634,9 @@ int avahi_send_dns_packet_ipv6(
107 return sendmsg_loop(fd, &msg, 0);
108 +#else
109 + return -1;
110 +#endif
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,
117 uint8_t *ret_ttl) {
119 +#ifndef NO_IPV6
120 AvahiDnsPacket *p = NULL;
121 struct msghdr msg;
122 struct iovec io;
123 @@ -889,7 +906,7 @@ AvahiDnsPacket *avahi_recv_dns_packet_ip
124 fail:
125 if (p)
126 avahi_dns_packet_free(p);
128 +#endif
129 return NULL;
132 @@ -934,6 +951,7 @@ fail:
135 int avahi_open_unicast_socket_ipv6(void) {
136 +#ifndef NO_IPV6
137 struct sockaddr_in6 local;
138 int fd = -1, yes;
140 @@ -974,6 +992,6 @@ int avahi_open_unicast_socket_ipv6(void)
141 fail:
142 if (fd >= 0)
143 close(fd);
145 +#endif
146 return -1;