aboutsummaryrefslogtreecommitdiffstats
path: root/package/libglib2/libglib2-0001-optional-ipv6.patch
blob: cbab1f1df8197166b879d8b7aedff8be1042dee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
[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: