* SUCH DAMAGE.
*/
/*
- * $Id: glue.h 5822 2010-03-23 10:39:56Z svn_magno $
+ * $Id: glue.h 11277 2012-06-10 17:44:15Z marta $
*
* glue code to adapt the FreeBSD version to linux and windows,
* userland and kernel.
#ifndef _GLUE_H
#define _GLUE_H
+
/*
* common definitions to allow portability
*/
#include <sys/ioctl.h>
#include <time.h>
#include <errno.h>
-#include <netinet/ether.h>
+#ifdef __linux__
+#include <netinet/ether.h> /* linux only 20111031 */
+#endif
#else /* KERNEL_MODULE, kernel headers */
#ifdef __linux__
+
#include <linux/version.h>
#define ifnet net_device /* remap */
#endif
/* on 2.6.22, msg.h requires spinlock_types.h */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) && \
+/* XXX spinlock_type.h was introduced in 2.6.14 */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13) && \
LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
#include <linux/spinlock_types.h>
#endif
/* on freebsd sys/socket.h pf specific */
#define NET_RT_IFLIST 3 /* survey interface list */
+#if defined(__linux__) || defined(__CYGWIN32__)
/* on freebsd net/if.h XXX used */
struct if_data {
/* ... */
int profhz; /* profiling clock frequency */
};
+/* no sin_len in sockaddr, we only remap in userland */
+#define sin_len sin_zero[0]
+
+#endif /* Linux/Win */
+
/*
* linux does not have a reentrant version of qsort,
* so we the FreeBSD stdlib version.
int sysctlbyname(const char *name, void *oldp, size_t *oldlenp,
void *newp, size_t newlen);
-/* no sin_len in sockaddr, we only remap in userland */
-#define sin_len sin_zero[0]
#else /* KERNEL_MODULE */
#include <linux/in6.h>
#endif
-/* skb_dst() was introduced from linux 2.6.31 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31) // or 2.4.x
-#define skb_dst(_dummy) skb->dst
+/* skb_dst() and skb_dst_set() was introduced from linux 2.6.31 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
+void skb_dst_set(struct sk_buff *skb, struct dst_entry *dst);
+struct dst_entry *skb_dst(const struct sk_buff *skb);
+#endif
+
+/* The struct flowi changed */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38) // check boundaries
+#define flow_daddr fl.u.ip4
+#else
+#define flow_daddr fl.nl_u.ip4_u
#endif
#endif /* __linux__ */
+/*
+ * Do not load prio_heap.h header because of conflicting names
+ * with our heap functions defined in include/netinet/ipfw/dn_heap.h
+ */
+#define _LINUX_PRIO_HEAP_H
+/*
+ * The following define prevent the ipv6.h header to be loaded.
+ * Starting from the 2.6.38 kernel the ipv6.h file, which is included
+ * by include/net/inetpeer.h in turn included by net/route.h
+ * include the system tcp.h file while we want to include
+ * our include/net/tcp.h instead.
+ */
+#ifndef _NET_IPV6_H
+#define _NET_IPV6_H
+static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
+{
+ memcpy(a1, a2, sizeof(struct in6_addr));
+}
+#endif /* _NET_IPV6_H */
+
#endif /* KERNEL_MODULE */
/*