[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/LWIP PATCH 2/4] Add missing definitions for supporting Ruby



Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 include/net/if.h     | 36 +++++++++++++++++++++++++++++++
 include/netinet/in.h | 51 ++++++++++++++++++++++++++++++++++++++++++++
 include/sys/socket.h | 10 ++++++++-
 3 files changed, 96 insertions(+), 1 deletion(-)

diff --git a/include/net/if.h b/include/net/if.h
index 9bb3c87..1eb11d8 100644
--- a/include/net/if.h
+++ b/include/net/if.h
@@ -1,3 +1,39 @@
 #include <compat/posix/net/if.h>
 
 char *if_indextoname (unsigned int, char *);
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define IFF_UP 0x1
+#define IFF_BROADCAST 0x2
+#define IFF_DEBUG 0x4
+#define IFF_LOOPBACK 0x8
+#define IFF_POINTOPOINT 0x10
+#define IFF_NOTRAILERS 0x20
+#define IFF_RUNNING 0x40
+#define IFF_NOARP 0x80
+#define IFF_PROMISC 0x100
+#define IFF_ALLMULTI 0x200
+#define IFF_MASTER 0x400
+#define IFF_SLAVE 0x800
+#define IFF_MULTICAST 0x1000
+#define IFF_PORTSEL 0x2000
+#define IFF_AUTOMEDIA 0x4000
+#define IFF_DYNAMIC 0x8000
+#define IFF_LOWER_UP 0x10000
+#define IFF_DORMANT 0x20000
+#define IFF_ECHO 0x40000
+#define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST| \
+        IFF_ECHO|IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT)
+
+struct ifconf {
+       int ifc_len;
+       union {
+               char *ifcu_buf;
+               struct ifreq *ifcu_req;
+       } ifc_ifcu;
+};
+#define ifc_buf         ifc_ifcu.ifcu_buf
+#define ifc_req         ifc_ifcu.ifcu_req
+
+#endif /* defined(_GNU_SOURCE) || defined(_BSD_SOURCE) */
diff --git a/include/netinet/in.h b/include/netinet/in.h
index 505a20a..18ee075 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -17,4 +17,55 @@
 #include_next <netinet/in.h>
 #endif
 
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint32_t *) (a))[3] == 0)
+
+#define IN6_IS_ADDR_LOOPBACK(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && \
+         ((uint8_t *) (a))[12] == 0 && ((uint8_t *) (a))[13] == 0 && \
+         ((uint8_t *) (a))[14] == 0 && ((uint8_t *) (a))[15] == 1 )
+
+#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 
0x80)
+
+#define IN6_IS_ADDR_SITELOCAL(a) \
+        ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 
0xc0)
+
+#define IN6_IS_ADDR_V4MAPPED(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint8_t *) (a))[8] == 0 && ((uint8_t *) (a))[9] == 0 && \
+         ((uint8_t *) (a))[10] == 0xff && ((uint8_t *) (a))[11] == 0xff)
+
+#define IN6_IS_ADDR_V4COMPAT(a) \
+        (((uint32_t *) (a))[0] == 0 && ((uint32_t *) (a))[1] == 0 && \
+         ((uint32_t *) (a))[2] == 0 && ((uint8_t *) (a))[15] > 1)
+
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x1))
+
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x5))
+
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x8))
+
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+        (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe))
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+struct ip_mreqn {
+       struct in_addr imr_multiaddr;
+       struct in_addr imr_address;
+       int imr_ifindex;
+};
+#endif /* defined(_GNU_SOURCE) || defined(_BSD_SOURCE) */
+
 #endif /* _NETINET_IN_H_ */
diff --git a/include/sys/socket.h b/include/sys/socket.h
index f23ad32..3024e17 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -56,8 +56,16 @@
 #define SOMAXCONN 128
 #endif
 
+#ifndef PF_LOCAL
+#define PF_LOCAL 1
+#endif
+
+#ifndef PF_UNIX
+#define PF_UNIX PF_LOCAL
+#endif
+
 #ifndef AF_LOCAL
-#define AF_LOCAL 1 /* Not supported/stub */
+#define AF_LOCAL PF_LOCAL /* Not supported/stub */
 #endif
 
 #ifndef AF_UNIX
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.