summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/net/route.h4
-rw-r--r--include/netinet/in.h17
-rw-r--r--libc/inet/getaddrinfo.c4
-rw-r--r--libc/inet/ifaddrs.c10
-rw-r--r--libc/inet/rpc/sa_len.c4
5 files changed, 37 insertions, 2 deletions
diff --git a/include/net/route.h b/include/net/route.h
index da5c810c7..ea6c9b941 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -55,6 +55,7 @@ struct rtentry
#define rt_mss rt_mtu
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
struct in6_rtmsg
{
struct in6_addr rtmsg_dst;
@@ -68,6 +69,7 @@ struct in6_rtmsg
u_int32_t rtmsg_flags;
int rtmsg_ifindex;
};
+#endif
#define RTF_UP 0x0001 /* Route usable. */
@@ -129,6 +131,7 @@ struct in6_rtmsg
#define RT_CLASS_MAX 255
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
#define RTMSG_ACK NLMSG_ACK
#define RTMSG_OVERRUN NLMSG_OVERRUN
@@ -141,5 +144,6 @@ struct in6_rtmsg
#define RTMSG_CONTROL 0x40
#define RTMSG_AR_FAILED 0x51 /* Address Resolution failed. */
+#endif
#endif /* net/route.h */
diff --git a/include/netinet/in.h b/include/netinet/in.h
index 6327001ee..235194bbe 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -194,6 +194,7 @@ struct in_addr
#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
/* IPv6 address */
struct in6_addr
{
@@ -218,8 +219,10 @@ libc_hidden_proto(in6addr_loopback)
#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
-#define INET_ADDRSTRLEN 16
#define INET6_ADDRSTRLEN 46
+#endif
+
+#define INET_ADDRSTRLEN 16
#if 1 /*def __UCLIBC_HAS_IPV4__*/
@@ -238,6 +241,7 @@ struct sockaddr_in
};
#endif
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
/* Ditto, for IPv6. */
struct sockaddr_in6
{
@@ -247,6 +251,7 @@ struct sockaddr_in6
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* IPv6 scope-id */
};
+#endif
#if defined __USE_MISC || defined __USE_GNU
@@ -274,6 +279,7 @@ struct ip_mreq_source
#endif
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
/* Likewise, for IPv6. */
struct ipv6_mreq
{
@@ -283,6 +289,7 @@ struct ipv6_mreq
/* local interface */
unsigned int ipv6mr_interface;
};
+#endif
#if defined __USE_MISC || defined __USE_GNU
@@ -403,6 +410,7 @@ libc_hidden_proto(htons)
# endif
#endif
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
#define IN6_IS_ADDR_UNSPECIFIED(a) \
(((__const uint32_t *) (a))[0] == 0 \
&& ((__const uint32_t *) (a))[1] == 0 \
@@ -441,6 +449,7 @@ libc_hidden_proto(htons)
&& (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \
&& (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
&& (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
+#endif
#if defined __USE_MISC || defined __USE_GNU
/* Bind socket to a privileged IP port. */
@@ -455,6 +464,7 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
#endif
+#if defined __UCLIBC_HAS_IPV6__ || !defined __UCLIBC_STRICT_HEADERS__
#define IN6_IS_ADDR_MC_NODELOCAL(a) \
(IN6_IS_ADDR_MULTICAST(a) \
&& ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
@@ -476,13 +486,14 @@ extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
&& ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
-#if defined __USE_GNU && defined __UCLIBC_HAS_IPV6__
+#ifdef __USE_GNU
/* IPv6 packet information. */
struct in6_pktinfo
{
struct in6_addr ipi6_addr; /* src/dst IPv6 address */
unsigned int ipi6_ifindex; /* send/recv interface index */
};
+#endif
/* IPv6 MTU information. */
struct ip6_mtuinfo
@@ -493,6 +504,7 @@ struct ip6_mtuinfo
#endif
#if 0 /*def __USE_GNU*/
+#ifdef __UCLIBC_HAS_IPV6__
/* Obsolete hop-by-hop and Destination Options Processing (RFC 2292). */
extern int inet6_option_space (int __nbytes)
__THROW __attribute_deprecated__;
@@ -540,6 +552,7 @@ extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW;
extern int inet6_rth_segments (__const void *__bp) __THROW;
extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index)
__THROW;
+#endif
/* Multicast source filter support. */
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index cdfdb72cf..b3435a8b2 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -639,9 +639,13 @@ gaih_inet(const char *name, const struct gaih_service *service,
tmpbuflen *= 2;
tmpbuf = alloca(tmpbuflen);
rc = gethostbyaddr_r(at2->addr,
+#ifdef __UCLIBC_HAS_IPV6__
((at2->family == AF_INET6)
? sizeof(struct in6_addr)
: sizeof(struct in_addr)),
+#else
+ sizeof(struct in_addr),
+#endif
at2->family,
&th, tmpbuf, tmpbuflen,
&h, &herrno);
diff --git a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c
index 3b8b674c2..39729ef47 100644
--- a/libc/inet/ifaddrs.c
+++ b/libc/inet/ifaddrs.c
@@ -59,7 +59,9 @@ struct ifaddrs_storage
struct sockaddr sa;
struct sockaddr_ll sl;
struct sockaddr_in s4;
+#ifdef __UCLIBC_HAS_IPV6__
struct sockaddr_in6 s6;
+#endif
} addr, netmask, broadaddr;
char name[IF_NAMESIZE + 1];
};
@@ -621,6 +623,7 @@ getifaddrs (struct ifaddrs **ifap)
rta_data, rta_payload);
break;
+#ifdef __UCLIBC_HAS_IPV6__
case AF_INET6:
/* Size must match that of an address for IPv6. */
if (rta_payload == 16)
@@ -633,6 +636,7 @@ getifaddrs (struct ifaddrs **ifap)
= ifam->ifa_index;
}
break;
+#endif
default:
if (rta_payload <= sizeof (ifas[ifa_index].addr))
@@ -668,6 +672,7 @@ getifaddrs (struct ifaddrs **ifap)
rta_data, rta_payload);
break;
+#ifdef __UCLIBC_HAS_IPV6__
case AF_INET6:
/* Size must match that of an address for IPv6. */
if (rta_payload == 16)
@@ -680,6 +685,7 @@ getifaddrs (struct ifaddrs **ifap)
ifam->ifa_index;
}
break;
+#endif
default:
if (rta_payload <= sizeof (ifas[ifa_index].addr))
@@ -709,6 +715,7 @@ getifaddrs (struct ifaddrs **ifap)
rta_data, rta_payload);
break;
+#ifdef __UCLIBC_HAS_IPV6__
case AF_INET6:
/* Size must match that of an address for IPv6. */
if (rta_payload == 16)
@@ -721,6 +728,7 @@ getifaddrs (struct ifaddrs **ifap)
= ifam->ifa_index;
}
break;
+#endif
default:
if (rta_payload <= sizeof (ifas[ifa_index].addr))
@@ -777,10 +785,12 @@ getifaddrs (struct ifaddrs **ifap)
max_prefixlen = 32;
break;
+#ifdef __UCLIBC_HAS_IPV6__
case AF_INET6:
cp = (char *) &ifas[ifa_index].netmask.s6.sin6_addr;
max_prefixlen = 128;
break;
+#endif
}
ifas[ifa_index].ifa.ifa_netmask->sa_family
diff --git a/libc/inet/rpc/sa_len.c b/libc/inet/rpc/sa_len.c
index 3b37eba44..5f258db1f 100644
--- a/libc/inet/rpc/sa_len.c
+++ b/libc/inet/rpc/sa_len.c
@@ -52,10 +52,14 @@ int __libc_sa_len (sa_family_t af)
#endif
case AF_INET:
return sizeof (struct sockaddr_in);
+#ifdef __UCLIBC_HAS_IPV6__
case AF_INET6:
return sizeof (struct sockaddr_in6);
+#endif
+#if 0
case AF_IPX:
return sizeof (struct sockaddr_ipx);
+#endif
case AF_LOCAL:
return sizeof (struct sockaddr_un);
}