integrated
[ipfw.git] / dummynet2 / missing.h
index bf72a95..b48981e 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 /*
- * $Id: missing.h 5817 2010-03-23 09:50:56Z svn_panicucci $
+ * $Id: missing.h 11275 2012-06-10 17:27:40Z marta $
  *
  * Header for kernel variables and functions that are not available in
  * userland.
 #ifndef _MISSING_H_
 #define _MISSING_H_
 
+/* sysctl.h and module.h are included before cdefs.h 
+ * because of cdefs.h defines __unused */
+
+#include <linux/sysctl.h>
+#include <linux/module.h>
 #include <sys/cdefs.h>
+#include <linux/moduleparam.h>
 
 /* portability features, to be set before the rest: */
 #define HAVE_NET_IPLEN         /* iplen/ipoff in net format */
@@ -53,6 +59,7 @@
 #include <sys/socket.h>                /* bsd-compat.c */
 #include <netinet/in.h>                /* bsd-compat.c */
 #include <netinet/ip.h>                /* local version */
+#define INADDR_TO_IFP(a, b) b = NULL
 
 #else  /* __linux__ */
 
@@ -211,7 +218,7 @@ extern struct timeval boottime;
 
 /* The time_uptime a FreeBSD variable increased each second */
 #ifdef __linux__
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,37) /* revise boundaries */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,37) /* revise boundaries */
 #define time_uptime get_seconds()
 #else /* OpenWRT */
 #define time_uptime CURRENT_TIME
@@ -343,13 +350,17 @@ struct net_device {
 int in_cksum(struct mbuf *m, int len);
 #define divert_cookie(mtag) 0
 #define divert_info(mtag) 0
-#define INADDR_TO_IFP(a, b) b = NULL
 #define pf_find_mtag(a) NULL
 #define pf_get_mtag(a) NULL
 #ifndef _WIN32
 #define AF_LINK AF_ASH /* ? our sys/socket.h */
 #endif
 
+/* search local the ip addresses, used for the "me" keyword */
+#include <linux/inetdevice.h>
+#define INADDR_TO_IFP(ip, b)   \
+       b = ip_dev_find((struct net *)&init_net, ip.s_addr)
+
 /* we don't pullup, either success or free and fail */
 #define m_pullup(m, x)                                 \
        ((m)->m_len >= x ? (m) : (FREE_PKT(m), NULL))
@@ -476,12 +487,13 @@ struct sock *inet_lookup(
 struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif);
 #endif /* Linux < 2.6 */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17) &&     \
+       LINUX_VERSION_CODE > KERNEL_VERSION(2,6,16)     /* XXX NOT sure, in 2.6.9 give an error */
 #define module_param_named(_name, _var, _ty, _perm)    \
        //module_param(_name, _ty, 0644)
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
 typedef unsigned long uintptr_t;
 
 #ifdef __i386__
@@ -597,6 +609,9 @@ extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa);
 #define VNET_PTR(n)             (&(n))
 #define VNET(n)                 (n)
 
+VNET_DECLARE(int, ip_defttl);
+#define V_ip_defttl    VNET(ip_defttl);
+
 int ipfw_check_hook(void *arg, struct mbuf **m0, struct ifnet *ifp,
        int dir, struct inpcb *inp);