kumquat-buildroot/package/libglib2/0001-optional-ipv6.patch
Peter Korsgaard 298cd8eaa2 package/*: rename patches according to the new policy
Autogenerated from rename-patch.py (http://patchwork.ozlabs.org/patch/403345)

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2015-02-03 14:52:56 +01:00

196 lines
5.1 KiB
Diff

[PATCH]: fix build on uClibc without IPv6 support
Updated to glib 2.36 by Thomas Petazzoni.
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
gio/ginetaddress.c | 9 +++++++++
1 file changed, 9 insertions(+)
Index: b/gio/ginetaddress.c
===================================================================
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -21,6 +21,7 @@
* Samuel Cormier-Iijima <sciyoshi@gmail.com>
*/
+#include <features.h>
#include <config.h>
#include <string.h>
@@ -423,7 +424,11 @@
return NULL;
}
+#if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__)
+#define G_INET_ADDRESS_FAMILY_IS_VALID(family) ((family) == AF_INET)
+#else
#define G_INET_ADDRESS_FAMILY_IS_VALID(family) ((family) == AF_INET || (family) == AF_INET6)
+#endif
/**
* g_inet_address_new_from_bytes:
@@ -472,8 +477,10 @@
return g_inet_address_new_from_bytes (addr, family);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else
return g_inet_address_new_from_bytes (in6addr_loopback.s6_addr, family);
+#endif
}
/**
@@ -499,8 +506,10 @@
return g_inet_address_new_from_bytes (addr, family);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else
return g_inet_address_new_from_bytes (in6addr_any.s6_addr, family);
+#endif
}
Index: b/gio/gsocket.c
===================================================================
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -425,7 +425,9 @@
switch (family)
{
case G_SOCKET_FAMILY_IPV4:
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
case G_SOCKET_FAMILY_IPV6:
+#endif
socket->priv->family = address.ss_family;
switch (socket->priv->type)
{
@@ -1321,11 +1323,13 @@
g_socket_get_option (socket, IPPROTO_IP, IP_TTL,
&value, &error);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else if (socket->priv->family == G_SOCKET_FAMILY_IPV6)
{
g_socket_get_option (socket, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
&value, &error);
}
+#endif
else
g_return_val_if_reached (0);
@@ -1362,6 +1366,7 @@
g_socket_set_option (socket, IPPROTO_IP, IP_TTL,
ttl, &error);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else if (socket->priv->family == G_SOCKET_FAMILY_IPV6)
{
g_socket_set_option (socket, IPPROTO_IP, IP_TTL,
@@ -1369,6 +1374,7 @@
g_socket_set_option (socket, IPPROTO_IPV6, IPV6_UNICAST_HOPS,
ttl, &error);
}
+#endif
else
g_return_if_reached ();
@@ -1470,11 +1476,13 @@
g_socket_get_option (socket, IPPROTO_IP, IP_MULTICAST_LOOP,
&value, &error);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else if (socket->priv->family == G_SOCKET_FAMILY_IPV6)
{
g_socket_get_option (socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
&value, &error);
}
+#endif
else
g_return_val_if_reached (FALSE);
@@ -1515,6 +1523,7 @@
g_socket_set_option (socket, IPPROTO_IP, IP_MULTICAST_LOOP,
loopback, &error);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else if (socket->priv->family == G_SOCKET_FAMILY_IPV6)
{
g_socket_set_option (socket, IPPROTO_IP, IP_MULTICAST_LOOP,
@@ -1522,6 +1531,7 @@
g_socket_set_option (socket, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
loopback, &error);
}
+#endif
else
g_return_if_reached ();
@@ -1559,11 +1569,13 @@
g_socket_get_option (socket, IPPROTO_IP, IP_MULTICAST_TTL,
&value, &error);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else if (socket->priv->family == G_SOCKET_FAMILY_IPV6)
{
g_socket_get_option (socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
&value, &error);
}
+#endif
else
g_return_val_if_reached (FALSE);
@@ -1601,6 +1613,7 @@
g_socket_set_option (socket, IPPROTO_IP, IP_MULTICAST_TTL,
ttl, &error);
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else if (socket->priv->family == G_SOCKET_FAMILY_IPV6)
{
g_socket_set_option (socket, IPPROTO_IP, IP_MULTICAST_TTL,
@@ -1608,6 +1621,7 @@
g_socket_set_option (socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
ttl, &error);
}
+#endif
else
g_return_if_reached ();
@@ -1965,6 +1979,7 @@
result = setsockopt (socket->priv->fd, IPPROTO_IP, optname,
&mc_req, sizeof (mc_req));
}
+#if !(defined(__UCLIBC__) && !defined(__UCLIBC_HAS_IPV6__))
else if (g_inet_address_get_family (group) == G_SOCKET_FAMILY_IPV6)
{
struct ipv6_mreq mc_req_ipv6;
@@ -1982,6 +1997,7 @@
result = setsockopt (socket->priv->fd, IPPROTO_IPV6, optname,
&mc_req_ipv6, sizeof (mc_req_ipv6));
}
+#endif
else
g_return_val_if_reached (FALSE);
@@ -2089,8 +2105,8 @@
case G_SOCKET_FAMILY_IPV4:
return TRUE;
- case G_SOCKET_FAMILY_IPV6:
#if defined (IPPROTO_IPV6) && defined (IPV6_V6ONLY)
+ case G_SOCKET_FAMILY_IPV6:
{
gint v6_only;
@@ -2101,8 +2117,6 @@
return !v6_only;
}
-#else
- return FALSE;
#endif
default: