/*
* Kernel locking support.
- * FreeBSD uses mtx in dummynet.c, and rwlocks in ipfw.c
+ * FreeBSD uses mtx in dummynet.c and struct rwlock ip_fw2.c
*
* In linux we use spinlock_bh to implement both.
+ * For 'struct rwlock' we need an #ifdef to change it to spinlock_t
*/
#ifndef DEFINE_SPINLOCK /* this is for linux 2.4 */
/* end of locking support */
+/* in netinet/in.h */
+#define in_nullhost(x) ((x).s_addr == INADDR_ANY)
+
+/* bzero not present on linux, but this should go in glue.h */
+#define bzero(s, n) memset(s, 0, n)
+#define bcmp(p1, p2, n) memcmp(p1, p2, n)
+
/* ethernet stuff */
#define ETHERTYPE_IP 0x0800 /* IP protocol */
#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
u_int32_t qid; /* queue id */
};
-/* radix related */
-
+#if 0 // ndef radix
+/* radix stuff in radix.h and radix.c */
struct radix_node {
caddr_t rn_key; /* object of search */
caddr_t rn_mask; /* netmask, if present */
};
+#endif /* !radix */
/* missing kernel functions */
char *inet_ntoa(struct in_addr ina);
struct sk_buff *skb, int dir, struct ip_fw_ugid *ugp);
/* vnet wrappers, in vnet.h and ip_var.h */
+int ipfw_init(void);
+void ipfw_destroy(void);
+struct ip_fw_args;
+extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa);
+
#define curvnet NULL
#define CURVNET_SET(_v)
#define CURVNET_RESTORE()
#define VNET_PTR(n) (&(n))
#define VNET(n) (n)
-VNET_DECLARE(struct ip_fw_chain, layer3_chain);
+extern int (*ip_dn_ctl_ptr)(struct sockopt *);
+typedef int ip_fw_ctl_t(struct sockopt *);
+extern ip_fw_ctl_t *ip_fw_ctl_ptr;
+
+/* For kernel ipfw_ether and ipfw_bridge. */
+struct ip_fw_args;
+typedef int ip_fw_chk_t(struct ip_fw_args *args);
+extern ip_fw_chk_t *ip_fw_chk_ptr;
-#define V_fw_enable VNET(fw_enable)
-#define V_fw_one_pass VNET(fw_one_pass)
#define V_ip_fw_chk_ptr VNET(ip_fw_chk_ptr)
#define V_ip_fw_ctl_ptr VNET(ip_fw_ctl_ptr)
-#define V_layer3_chain VNET(layer3_chain)
#define V_tcbinfo VNET(tcbinfo)
#define V_udbinfo VNET(udbinfo)