#define V_ipfw_timeout VNET(ipfw_timeout)
static uma_zone_t ipfw_dyn_rule_zone;
-#if defined( __linux__ ) || defined( _WIN32 )
+#ifndef __FreeBSD__
DEFINE_SPINLOCK(ipfw_dyn_mtx);
#else
static struct mtx ipfw_dyn_mtx; /* mutex guarding dynamic rules */
#define V_dyn_max VNET(dyn_max)
#ifdef SYSCTL_NODE
+
+SYSBEGIN(f2)
+
SYSCTL_DECL(_net_inet_ip_fw);
SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, dyn_buckets,
CTLFLAG_RW, &VNET_NAME(dyn_buckets), 0,
SYSCTL_VNET_INT(_net_inet_ip_fw, OID_AUTO, dyn_keepalive,
CTLFLAG_RW, &VNET_NAME(dyn_keepalive), 0,
"Enable keepalives for dyn. rules");
+
+SYSEND
+
#endif /* SYSCTL_NODE */
V_ipfw_dyn_v[i] = q;
}
if (pkt->proto == IPPROTO_TCP) { /* update state according to flags */
- u_char flags = pkt->flags & (TH_FIN|TH_SYN|TH_RST);
+ u_char flags = pkt->_flags & (TH_FIN|TH_SYN|TH_RST);
#define BOTH_SYN (TH_SYN | (TH_SYN << 8))
#define BOTH_FIN (TH_FIN | (TH_FIN << 8))
ipfw_send_pkt(struct mbuf *replyto, struct ipfw_flow_id *id, u_int32_t seq,
u_int32_t ack, int flags)
{
-#ifdef __linux__ // XXX to be revised
+#ifndef __FreeBSD__
return NULL;
#else
struct mbuf *m;
h->ip_hl = sizeof(*h) >> 2;
h->ip_tos = IPTOS_LOWDELAY;
h->ip_off = 0;
- h->ip_len = htons(len);
+ /* ip_len must be in host format for ip_output */
+ h->ip_len = len;
h->ip_ttl = V_ip_defttl;
h->ip_sum = 0;
break;
}
return (m);
-#endif /* !__linux__ */
+#endif /* __FreeBSD__ */
}
/*
* This procedure is only used to handle keepalives. It is invoked
* every dyn_keepalive_period
*/
-static void
+ /* dummynet() and ipfw_tick() can't be static in windows */
+void
ipfw_tick(void * vnetx)
{
struct mbuf *m0, *m, *mnext, **mtailp;