|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _MISSING_H_ |
|
|
#define _MISSING_H_ |
|
|
|
|
|
#define KLD_MODULE |
|
|
|
|
|
|
|
|
void panic(const char *fmt, ...); |
|
|
|
|
|
#define KASSERT(exp,msg) do { \ |
|
|
if (__predict_false(!(exp))) \ |
|
|
panic msg; \ |
|
|
} while (0) |
|
|
|
|
|
#ifndef __predict_false |
|
|
#define __predict_false(x) (x) |
|
|
#endif |
|
|
|
|
|
|
|
|
#ifdef _KERNEL |
|
|
#define NEED_KERNEL |
|
|
#undef _KERNEL |
|
|
#endif |
|
|
|
|
|
#include <stdio.h> |
|
|
#include <sys/socket.h> |
|
|
#include <string.h> |
|
|
#include <stdlib.h> |
|
|
#ifdef NEED_KERNEL |
|
|
#define _KERNEL |
|
|
#include <sys/cdefs.h> |
|
|
#include <sys/param.h> |
|
|
|
|
|
#define __user |
|
|
#define __init |
|
|
#define __exit |
|
|
|
|
|
|
|
|
#define WITHOUT_BPF |
|
|
|
|
|
#define MALLOC_DECLARE(x) struct __hack |
|
|
|
|
|
extern void *kern_malloc(int); |
|
|
extern void kern_free(void *); |
|
|
#define malloc(_size, type, flags) kern_malloc(_size) |
|
|
#define free(_var, type) kern_free(_var) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <netinet/in.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define LOG_ERR 0x100 |
|
|
#define LOG_INFO 0x200 |
|
|
#ifndef LOG_SECURITY |
|
|
#define LOG_SECURITY 0x400 |
|
|
#endif |
|
|
|
|
|
#define log(_level, fmt, arg...) do { \ |
|
|
int __attribute__((unused)) _querty = _level; \ |
|
|
printf("kernel: " fmt, ##arg); } while (0) |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DEFINE_SPINLOCK |
|
|
#if defined(__APPLE__) |
|
|
#define DEFINE_SPINLOCK(x) struct mtx x; |
|
|
#else |
|
|
#define DEFINE_SPINLOCK(x) spinlock_t x |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef _KERNEL |
|
|
|
|
|
#include <pthread.h> |
|
|
#ifdef NEED_KERNEL |
|
|
#define _KERNEL |
|
|
#endif |
|
|
struct mtx { |
|
|
pthread_mutex_t p0; |
|
|
}; |
|
|
struct rwlock { |
|
|
pthread_mutex_t p0; |
|
|
}; |
|
|
struct rmlock { |
|
|
pthread_mutex_t p0; |
|
|
}; |
|
|
extern pthread_mutex_t dummynet_mtx_p; |
|
|
extern pthread_mutex_t ipfw_dyn_mtx_p; |
|
|
extern pthread_mutex_t pfil_global_lock_p; |
|
|
|
|
|
#define mtx_assert(a, b) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define mtx_init(m, a,b,c) do { \ |
|
|
(void)m; pthread_mutex_init(&((m)->p0), NULL); } while (0) |
|
|
#define MTX_SYSINIT(a, m, c, d) |
|
|
#define mtx_lock(m) pthread_mutex_lock(m.p0) |
|
|
#define mtx_unlock(m) pthread_mutex_unlock(m.p0) |
|
|
#define mtx_destroy(m) pthread_mutex_destroy(m.p0) |
|
|
#if 1 |
|
|
|
|
|
|
|
|
#if 1 |
|
|
#define rw_assert(a, b) |
|
|
#define rw_destroy(_l) |
|
|
#define rw_init(_l, msg) |
|
|
#define rw_rlock(_l) mtx_lock(_l) |
|
|
#define rw_runlock(_l) mtx_unlock(_l) |
|
|
#define rw_wlock(_l) mtx_lock(_l) |
|
|
#define rw_wunlock(_l) mtx_unlock(_l) |
|
|
#define rw_init_flags(_l, s, v) |
|
|
#endif |
|
|
|
|
|
#define rm_init(_l, msg) |
|
|
#define rm_rlock(_l, _t) ((void)_t, mtx_lock(_l)) |
|
|
#define rm_runlock(_l, _t) mtx_unlock(_l) |
|
|
#define rm_wlock(_l) mtx_lock(_l) |
|
|
#define rm_wunlock(_l) mtx_unlock(_l) |
|
|
#define rm_destroy(_l) |
|
|
#define rm_assert(_l, _w) |
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct ipfw_rule_ref { |
|
|
uint32_t slot; |
|
|
uint32_t rulenum; |
|
|
uint32_t rule_id; |
|
|
uint32_t chain_id; |
|
|
uint32_t info; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum { |
|
|
IPFW_INFO_MASK = 0x0000ffff, |
|
|
IPFW_INFO_OUT = 0x00000000, |
|
|
IPFW_INFO_IN = 0x00800000, |
|
|
IPFW_ONEPASS = 0x40000000, |
|
|
IPFW_IS_MASK = 0x30000000, |
|
|
IPFW_IS_DIVERT = 0x20000000, |
|
|
IPFW_IS_DUMMYNET =0x10000000, |
|
|
IPFW_IS_PIPE = 0x08000000, |
|
|
}; |
|
|
|
|
|
|
|
|
#define in_nullhost(x) ((x).s_addr == INADDR_ANY) |
|
|
|
|
|
|
|
|
#ifndef __FreeBSD_version |
|
|
#define __FreeBSD_version 500035 |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
struct malloc_type { |
|
|
}; |
|
|
|
|
|
#define MALLOC_DEFINE(type, shortdesc, longdesc) \ |
|
|
struct malloc_type type[1]; void *md_dummy_ ## type = type |
|
|
|
|
|
#define CTASSERT(x) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern int hz; |
|
|
extern long tick; |
|
|
extern int bootverbose; |
|
|
extern struct timeval boottime; |
|
|
|
|
|
|
|
|
extern time_t time_uptime; |
|
|
|
|
|
extern int max_linkhdr; |
|
|
extern int ip_defttl; |
|
|
extern u_long in_ifaddrhmask; |
|
|
extern struct in_ifaddrhashhead *in_ifaddrhashtbl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <arpa/inet.h> |
|
|
|
|
|
struct mbuf; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void reinject_drop(struct mbuf* m); |
|
|
|
|
|
#include <sys/socket.h> |
|
|
|
|
|
#ifdef _KERNEL |
|
|
#define IF_NAMESIZE 16 |
|
|
#ifndef IFNAMSIZ |
|
|
#define IFNAMSIZ IF_NAMESIZE |
|
|
#endif |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define TH_FIN 0x01 |
|
|
#define TH_SYN 0x02 |
|
|
#define TH_RST 0x04 |
|
|
#define TH_ACK 0x10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define IPTOS_DSCP_CS0 0x00 |
|
|
#define IPTOS_DSCP_CS1 0x20 |
|
|
#define IPTOS_DSCP_AF11 0x28 |
|
|
#define IPTOS_DSCP_AF12 0x30 |
|
|
#define IPTOS_DSCP_AF13 0x38 |
|
|
#define IPTOS_DSCP_CS2 0x40 |
|
|
#define IPTOS_DSCP_AF21 0x48 |
|
|
#define IPTOS_DSCP_AF22 0x50 |
|
|
#define IPTOS_DSCP_AF23 0x58 |
|
|
#define IPTOS_DSCP_CS3 0x60 |
|
|
#define IPTOS_DSCP_AF31 0x68 |
|
|
#define IPTOS_DSCP_AF32 0x70 |
|
|
#define IPTOS_DSCP_AF33 0x78 |
|
|
#define IPTOS_DSCP_CS4 0x80 |
|
|
#define IPTOS_DSCP_AF41 0x88 |
|
|
#define IPTOS_DSCP_AF42 0x90 |
|
|
#define IPTOS_DSCP_AF43 0x98 |
|
|
#define IPTOS_DSCP_CS5 0xa0 |
|
|
#define IPTOS_DSCP_EF 0xb8 |
|
|
#define IPTOS_DSCP_CS6 0xc0 |
|
|
#define IPTOS_DSCP_CS7 0xe0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define IPTOS_ECN_NOTECT 0x00 |
|
|
#define IPTOS_ECN_ECT1 0x01 |
|
|
#define IPTOS_ECN_ECT0 0x02 |
|
|
#define IPTOS_ECN_CE 0x03 |
|
|
#define IPTOS_ECN_MASK 0x03 |
|
|
|
|
|
|
|
|
|
|
|
#define RTF_CLONING 0x100 |
|
|
|
|
|
#define IPPROTO_OSPFIGP 89 |
|
|
#define IPPROTO_CARP 112 |
|
|
#define CARP_VERSION 2 |
|
|
#define CARP_ADVERTISEMENT 0x01 |
|
|
#define PRIV_NETINET_IPFW 491 |
|
|
#define IP_FORWARDING 0x1 |
|
|
#define NETISR_IP 2 |
|
|
#define PRIV_NETINET_DUMMYNET 494 |
|
|
|
|
|
extern int securelevel; |
|
|
|
|
|
#define if_xname name |
|
|
#define if_snd XXX |
|
|
|
|
|
|
|
|
struct ifnet { |
|
|
char if_xname[IFNAMSIZ]; |
|
|
uint32_t if_index; |
|
|
}; |
|
|
|
|
|
struct ifaltq { |
|
|
|
|
|
void *ifq_head; |
|
|
}; |
|
|
int ffs(int); |
|
|
int fls(int); |
|
|
|
|
|
struct ip; |
|
|
|
|
|
int in_cksum(struct mbuf *m, int len); |
|
|
#ifndef __FreeBSD__ |
|
|
u_short in_cksum_hdr(struct ip *); |
|
|
#endif |
|
|
|
|
|
|
|
|
#define CTR3(a, ...) |
|
|
#define uma_zone_set_max(a, b) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined( __linux__) |
|
|
#define if_xname name |
|
|
#define if_snd XXX |
|
|
|
|
|
struct route_in6 { |
|
|
}; |
|
|
|
|
|
#elif defined( _WIN32 ) |
|
|
|
|
|
struct ifnet { |
|
|
char if_xname[IFNAMSIZ]; |
|
|
|
|
|
}; |
|
|
|
|
|
struct net_device { |
|
|
char if_xname[IFNAMSIZ]; |
|
|
}; |
|
|
#elif defined(__APPLE__) |
|
|
typedef u_int32_t tcp_cc; |
|
|
#ifndef s6_addr32 |
|
|
#define s6_addr32 __u6_addr.__u6_addr32 |
|
|
#endif |
|
|
#include <netinet/tcp.h> |
|
|
|
|
|
struct route_in6 { |
|
|
}; |
|
|
|
|
|
struct icmphdr { |
|
|
u_char icmp_type; |
|
|
u_char icmp_code; |
|
|
u_short icmp_cksum; |
|
|
}; |
|
|
|
|
|
#define IPPROTO_SCTP 132 |
|
|
|
|
|
|
|
|
struct sctphdr { |
|
|
uint16_t src_port; |
|
|
uint16_t dest_port; |
|
|
uint32_t v_tag; |
|
|
uint32_t checksum; |
|
|
|
|
|
}; |
|
|
|
|
|
struct carp_header { |
|
|
#if BYTE_ORDER == LITTLE_ENDIAN |
|
|
u_int8_t carp_type:4, |
|
|
carp_version:4; |
|
|
#endif |
|
|
#if BYTE_ORDER == BIG_ENDIAN |
|
|
u_int8_t carp_version:4, |
|
|
carp_type:4; |
|
|
#endif |
|
|
}; |
|
|
|
|
|
|
|
|
struct pim { |
|
|
int dummy; |
|
|
}; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#define divert_cookie(mtag) 0 |
|
|
#define divert_info(mtag) 0 |
|
|
#define pf_find_mtag(a) NULL |
|
|
#define pf_get_mtag(a) NULL |
|
|
#if !defined(_WIN32) && !defined(AF_LINK) |
|
|
#define AF_LINK AF_ASH |
|
|
#endif |
|
|
|
|
|
|
|
|
#define INADDR_TO_IFP(ip, b) b = NULL |
|
|
|
|
|
|
|
|
#define m_pullup(m, x) \ |
|
|
((m)->m_len >= x ? (m) : (FREE_PKT(m), NULL)) |
|
|
|
|
|
struct pf_mtag { |
|
|
void *hdr; |
|
|
sa_family_t af; |
|
|
u_int32_t qid; |
|
|
}; |
|
|
|
|
|
|
|
|
char *inet_ntoa(struct in_addr ina); |
|
|
long random(void); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ |
|
|
for ((var) = TAILQ_FIRST((head)); \ |
|
|
(var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ |
|
|
(var) = (tvar)) |
|
|
|
|
|
#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ |
|
|
for ((var) = SLIST_FIRST((head)); \ |
|
|
(var) && ((tvar) = SLIST_NEXT((var), field), 1); \ |
|
|
(var) = (tvar)) |
|
|
|
|
|
|
|
|
#define RT_NUMFIBS 1 |
|
|
extern u_int rt_numfibs; |
|
|
|
|
|
|
|
|
#ifdef RTFREE |
|
|
#undef RTFREE |
|
|
#define RTFREE(a) fprintf(stderr, "RTFREE: commented out locks\n"); |
|
|
#endif |
|
|
|
|
|
void getmicrouptime(struct timeval *tv); |
|
|
|
|
|
|
|
|
struct ip_moptions; |
|
|
struct route; |
|
|
struct ip; |
|
|
|
|
|
struct inpcb; |
|
|
struct mbuf *ip_reass(struct mbuf *); |
|
|
int ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, |
|
|
struct ip_moptions *imo, struct inpcb *inp); |
|
|
|
|
|
|
|
|
int netisr_dispatch(u_int proto, struct mbuf *m); |
|
|
|
|
|
|
|
|
|
|
|
int sooptcopyout(struct sockopt *sopt, const void *buf, size_t len); |
|
|
int copyout(const void *kaddr, void *uaddr, size_t len); |
|
|
|
|
|
int sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen); |
|
|
|
|
|
|
|
|
int priv_check(struct thread *td, int priv); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct bsd_ucred { |
|
|
uid_t uid; |
|
|
gid_t gid; |
|
|
uint32_t xid; |
|
|
uint32_t nid; |
|
|
}; |
|
|
|
|
|
#ifdef _KERNEL |
|
|
|
|
|
#if 0 |
|
|
int |
|
|
cred_check(void *insn, int proto, struct ifnet *oif, |
|
|
struct in_addr dst_ip, u_int16_t dst_port, struct in_addr src_ip, |
|
|
u_int16_t src_port, struct bsd_ucred *u, int *ugid_lookupp, |
|
|
struct sk_buff *skb); |
|
|
#endif |
|
|
|
|
|
struct ucred; |
|
|
int securelevel_ge(struct ucred *cr, int level); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct sysctl_oid; |
|
|
struct sysctl_req { |
|
|
void *oldptr; |
|
|
int oldlen; |
|
|
void *newptr; |
|
|
int newlen; |
|
|
}; |
|
|
|
|
|
#ifdef _WIN32 |
|
|
#define module_param_named(_name, _var, _ty, _perm) |
|
|
#else |
|
|
|
|
|
#endif |
|
|
|
|
|
#if 0 |
|
|
#define SYSCTL_DECL(_1) |
|
|
#define SYSCTL_OID(_1, _2, _3, _4, _5, _6, _7, _8) |
|
|
#define SYSCTL_NODE(_1, _2, _3, _4, _5, _6) |
|
|
#define _SYSCTL_BASE(_name, _var, _ty, _perm) \ |
|
|
module_param_named(_name, *(_var), _ty, \ |
|
|
( (_perm) == CTLFLAG_RD) ? 0444: 0644 ) |
|
|
#define SYSCTL_PROC(_base, _oid, _name, _mode, _var, _val, _desc, _a, _b) |
|
|
|
|
|
#define SYSCTL_INT(_base, _oid, _name, _mode, _var, _val, _desc) \ |
|
|
_SYSCTL_BASE(_name, _var, int, _mode) |
|
|
|
|
|
#define SYSCTL_LONG(_base, _oid, _name, _mode, _var, _val, _desc) \ |
|
|
_SYSCTL_BASE(_name, _var, long, _mode) |
|
|
|
|
|
#define SYSCTL_ULONG(_base, _oid, _name, _mode, _var, _val, _desc) \ |
|
|
_SYSCTL_BASE(_name, _var, ulong, _mode) |
|
|
|
|
|
#define SYSCTL_UINT(_base, _oid, _name, _mode, _var, _val, _desc) \ |
|
|
_SYSCTL_BASE(_name, _var, uint, _mode) |
|
|
|
|
|
#define TUNABLE_INT(_name, _ptr) |
|
|
|
|
|
#define SYSCTL_VNET_PROC SYSCTL_PROC |
|
|
#define SYSCTL_VNET_INT SYSCTL_INT |
|
|
#define SYSCTL_VNET_UINT SYSCTL_UINT |
|
|
|
|
|
#endif |
|
|
|
|
|
#define SYSCTL_HANDLER_ARGS \ |
|
|
struct sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req |
|
|
typedef int (sysctl_h_fn_t)(SYSCTL_HANDLER_ARGS); |
|
|
int sysctl_handle_int(SYSCTL_HANDLER_ARGS); |
|
|
int sysctl_handle_long(SYSCTL_HANDLER_ARGS); |
|
|
|
|
|
#ifdef EMULATE_SYSCTL |
|
|
|
|
|
#define STRINGIFY(x) #x |
|
|
|
|
|
#ifdef SYSCTL_NODE |
|
|
#undef SYSCTL_NODE |
|
|
#endif |
|
|
#define SYSCTL_NODE(a,b,c,d,e,f) int a; (void)a |
|
|
#define SYSCTL_DECL(a) |
|
|
|
|
|
#define GST_HARD_LIMIT 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct sysctlentry { |
|
|
struct sysctlhead head; |
|
|
char* name; |
|
|
void* data; |
|
|
sysctl_h_fn_t *fn; |
|
|
}; |
|
|
|
|
|
struct sysctltable { |
|
|
int count; |
|
|
int totalsize; |
|
|
void* namebuffer; |
|
|
struct sysctlentry entry[GST_HARD_LIMIT]; |
|
|
}; |
|
|
|
|
|
#ifdef SYSBEGIN |
|
|
#undef SYSBEGIN |
|
|
#endif |
|
|
#define SYSBEGIN(x) void sysctl_addgroup_##x() { |
|
|
#ifdef SYSEND |
|
|
#undef SYSEND |
|
|
#endif |
|
|
#define SYSEND } |
|
|
|
|
|
|
|
|
#define SYSCTL_INT(a,b,c,d,e,f,g) \ |
|
|
sysctl_pushback(STRINGIFY(a) "." STRINGIFY(c) + 1, \ |
|
|
(d) | (SYSCTLTYPE_INT << 2), sizeof(*e), e, NULL) |
|
|
|
|
|
#define SYSCTL_UINT(a,b,c,d,e,f,g) \ |
|
|
sysctl_pushback(STRINGIFY(a) "." STRINGIFY(c) + 1, \ |
|
|
(d) | (SYSCTLTYPE_UINT << 2), sizeof(*e), e, NULL) |
|
|
|
|
|
#define SYSCTL_LONG(a,b,c,d,e,f,g) \ |
|
|
sysctl_pushback(STRINGIFY(a) "." STRINGIFY(c) + 1, \ |
|
|
(d) | (SYSCTLTYPE_LONG << 2), sizeof(*e), e, NULL) |
|
|
|
|
|
#define SYSCTL_ULONG(a,b,c,d,e,f,g) \ |
|
|
sysctl_pushback(STRINGIFY(a) "." STRINGIFY(c) + 1, \ |
|
|
(d) | (SYSCTLTYPE_ULONG << 2), sizeof(*e), e, NULL) |
|
|
#define TUNABLE_INT(a,b) |
|
|
|
|
|
#define SYSCTL_PROC(a,b,c,d,e,f,g,h,i) \ |
|
|
sysctl_pushback(STRINGIFY(a) "." STRINGIFY(c) + 1, \ |
|
|
(d), 4 , (void *)(f ), g) |
|
|
|
|
|
#define SYSCTL_VNET_PROC SYSCTL_PROC |
|
|
#define SYSCTL_VNET_INT SYSCTL_INT |
|
|
#define SYSCTL_VNET_UINT SYSCTL_UINT |
|
|
|
|
|
void keinit_GST(void); |
|
|
void keexit_GST(void); |
|
|
int kesysctl_emu_set(void* p, int l); |
|
|
int kesysctl_emu_get(struct sockopt* sopt); |
|
|
void sysctl_pushback(char* name, int flags, int datalen, void* data, sysctl_h_fn_t *fn); |
|
|
|
|
|
#endif |
|
|
|
|
|
struct ifnet; |
|
|
void ether_demux(struct ifnet *ifp, struct mbuf *m); |
|
|
|
|
|
int ether_output_frame(struct ifnet *ifp, struct mbuf *m); |
|
|
|
|
|
void in_rtalloc_ign(struct route *ro, u_long ignflags, u_int fibnum); |
|
|
|
|
|
void icmp_error(struct mbuf *n, int type, int code, uint32_t dest, int mtu); |
|
|
|
|
|
#define in_localip(_x) (0) |
|
|
|
|
|
#ifndef __FreeBSD__ |
|
|
struct rtentry; |
|
|
#endif |
|
|
void rtfree(struct rtentry *rt); |
|
|
|
|
|
u_short in_cksum_skip(struct mbuf *m, int len, int skip); |
|
|
|
|
|
#ifdef INP_LOCK_ASSERT |
|
|
#undef INP_LOCK_ASSERT |
|
|
#define INP_LOCK_ASSERT(a) |
|
|
#endif |
|
|
|
|
|
int jailed(struct ucred *cred); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int in_localaddr(struct in_addr in); |
|
|
|
|
|
int fnmatch(const char *pattern, const char *string, int flags); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MTAG_IPFW 1148380143 |
|
|
#define MTAG_IPFW_RULE 1262273568 |
|
|
#define MTAG_IPFW_CALL 1308397630 |
|
|
|
|
|
#ifdef __APPLE__ |
|
|
#define offsetof(type, field) __builtin_offsetof(type, field) |
|
|
#endif |
|
|
struct ip_fw_args; |
|
|
extern int (*ip_dn_io_ptr)(struct mbuf **m, int dir, struct ip_fw_args *fwa); |
|
|
|
|
|
#if 1 |
|
|
#define curvnet NULL |
|
|
#define CURVNET_SET(_v) |
|
|
#define CURVNET_RESTORE() |
|
|
#define VNET_ASSERT(condition) |
|
|
|
|
|
#define VNET_NAME(n) n |
|
|
#define VNET_DECLARE(t, n) extern t n |
|
|
#define VNET_DEFINE(t, n) t n |
|
|
#define _VNET_PTR(b, n) &VNET_NAME(n) |
|
|
|
|
|
|
|
|
|
|
|
#define VNET_VNET_PTR(vnet, n) (&(n)) |
|
|
#define VNET_VNET(vnet, n) (n) |
|
|
|
|
|
#define VNET_PTR(n) (&(n)) |
|
|
#define VNET(n) (n) |
|
|
|
|
|
#define IS_DEFAULT_VNET(x) (1) |
|
|
#endif |
|
|
|
|
|
VNET_DECLARE(int, ip_defttl); |
|
|
#define V_ip_defttl VNET(ip_defttl); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ipfw_check_packet(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, struct inpcb *inp); |
|
|
int ipfw_check_frame(void *arg, struct mbuf **m0, struct ifnet *ifp, int dir, struct inpcb *inp); |
|
|
|
|
|
|
|
|
extern void (*ip_divert_ptr)(struct mbuf *m, int incoming); |
|
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
|
|
typedef int ng_ipfw_input_t(struct mbuf **, int, struct ip_fw_args *, int); |
|
|
extern ng_ipfw_input_t *ng_ipfw_input_p; |
|
|
|
|
|
|
|
|
struct ip_fw_args; |
|
|
|
|
|
#define V_ip_fw_ctl_ptr VNET(ip_fw_ctl_ptr) |
|
|
#define V_tcbinfo VNET(tcbinfo) |
|
|
#define V_udbinfo VNET(udbinfo) |
|
|
#endif |
|
|
|
|
|
|
|
|
#define EVENTHANDLER_DECLARE(a, b) |
|
|
|
|
|
|
|
|
struct sess; |
|
|
typedef int (handler_t)(struct sess *sess, void *arg); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum flags_t { |
|
|
WANT_READ=1, WANT_WRITE=2, WANT_RUN=4, |
|
|
WANT_DELETE=0x8000 |
|
|
}; |
|
|
|
|
|
struct sess { |
|
|
struct sess *next; |
|
|
int fd; |
|
|
handler_t *func; |
|
|
void *arg; |
|
|
enum flags_t flags; |
|
|
void *private; |
|
|
}; |
|
|
struct sess * |
|
|
new_session(int fd, handler_t *func, void *arg, enum flags_t flags); |
|
|
|
|
|
|
|
|
void netmap_add_port(const char *dev); |
|
|
#endif |
|
|
|