summaryrefslogtreecommitdiff
path: root/sysdep/unix/unix.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2015-02-21 11:39:45 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2015-02-21 11:39:45 +0100
commit7730553b7eeb33d21e5597f110334ca584ad532d (patch)
treec80bf6d48fc91bafd7f0aefc859a033d3b472c89 /sysdep/unix/unix.h
parent0da562a7cb25ed2b8724248ad6f841b1831a09c3 (diff)
parentec2194fa7a20a2768ca0027b5f3c024f0a251866 (diff)
Merge remote-tracking branch 'origin/soft-int'
Diffstat (limited to 'sysdep/unix/unix.h')
-rw-r--r--sysdep/unix/unix.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/sysdep/unix/unix.h b/sysdep/unix/unix.h
index 518713bc..3cee96b4 100644
--- a/sysdep/unix/unix.h
+++ b/sysdep/unix/unix.h
@@ -47,19 +47,9 @@ typedef struct sockaddr_bird {
#ifdef IPV6
#define BIRD_AF AF_INET6
-#define _MI6(x1,x2,x3,x4) _MI(x1, x2, x3, x4)
-#define ipa_is_link_local(x) ipa_has_link_scope(x)
#define ipa_from_sa(x) ipa_from_sa6(x)
-#define ipa_from_u32(x) _MI6(0,0,0xffff,x)
-#define ipa_to_u32(x) _I3(x)
#else
#define BIRD_AF AF_INET
-#define _I0(X) 0
-#define _I1(X) 0
-#define _I2(X) 0
-#define _I3(X) 0
-#define _MI6(x1,x2,x3,x4) IPA_NONE
-#define ipa_is_link_local(x) 0
#define ipa_from_sa(x) ipa_from_sa4(x)
#endif
@@ -75,7 +65,7 @@ static inline ip_addr ipa_from_in4(struct in_addr a)
{ return ipa_from_u32(ntohl(a.s_addr)); }
static inline ip_addr ipa_from_in6(struct in6_addr a)
-{ return _MI6(ntohl(a.s6_addr32[0]), ntohl(a.s6_addr32[1]), ntohl(a.s6_addr32[2]), ntohl(a.s6_addr32[3])); }
+{ return ipa_build6(ntohl(a.s6_addr32[0]), ntohl(a.s6_addr32[1]), ntohl(a.s6_addr32[2]), ntohl(a.s6_addr32[3])); }
static inline ip_addr ipa_from_sa4(sockaddr *sa)
{ return ipa_from_in4(((struct sockaddr_in *) sa)->sin_addr); }
@@ -86,8 +76,14 @@ static inline ip_addr ipa_from_sa6(sockaddr *sa)
static inline struct in_addr ipa_to_in4(ip_addr a)
{ return (struct in_addr) { htonl(ipa_to_u32(a)) }; }
+#ifdef IPV6
static inline struct in6_addr ipa_to_in6(ip_addr a)
{ return (struct in6_addr) { .s6_addr32 = { htonl(_I0(a)), htonl(_I1(a)), htonl(_I2(a)), htonl(_I3(a)) } }; }
+#else
+/* Temporary dummy */
+static inline struct in6_addr ipa_to_in6(ip_addr a)
+{ return (struct in6_addr) { .s6_addr32 = { 0, 0, 0, 0 } }; }
+#endif
void sockaddr_fill(sockaddr *sa, int af, ip_addr a, struct iface *ifa, uint port);
int sockaddr_read(sockaddr *sa, int af, ip_addr *a, struct iface **ifa, uint *port);