socsvn commit: r271342 - in soc2014/dpl/netmap-ipfwjit: . sys/netpfil/ipfw

dpl at FreeBSD.org dpl at FreeBSD.org
Thu Jul 24 17:15:42 UTC 2014


Author: dpl
Date: Thu Jul 24 17:15:40 2014
New Revision: 271342
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=271342

Log:
  Make it compile.

Modified:
  soc2014/dpl/netmap-ipfwjit/Makefile.kipfw
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.h
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.h

Modified: soc2014/dpl/netmap-ipfwjit/Makefile.kipfw
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/Makefile.kipfw	Thu Jul 24 16:33:29 2014	(r271341)
+++ soc2014/dpl/netmap-ipfwjit/Makefile.kipfw	Thu Jul 24 17:15:40 2014	(r271342)
@@ -152,7 +152,7 @@
 
 #Generate the actual bytecode to be used
 ../ip_fw_rules.bc:
-	@$(CC) $(CFLAGS) $(BCFLAGS) -o ../ip_fw_rules.bc ../sys/netpfil/ipfw/ip_fw_rules.h
+	@$(CC) $(CFLAGS) $(BCFLAGS) -o ../ip_fw_rules.bc ../sys/netpfil/ipfw/ip_fw_rules.c
 
 radix.o:#	CFLAGS += -U_KERNEL
 

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c	Thu Jul 24 16:33:29 2014	(r271341)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c	Thu Jul 24 17:15:40 2014	(r271342)
@@ -38,6 +38,7 @@
 #endif /* INET */
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
+#define IPFW_RULES_INLINE __always_inline
 #include "ip_fw_rules.h"
 #include "jit.h"
 
@@ -126,114 +127,7 @@
 /* Use 128 tables by default */
 static unsigned int default_fw_tables = IPFW_TABLES_DEFAULT;
 
-/* Rule functions, ordered by appereance in the code */
-static __always_inline void rule_nop(int *);
-static __always_inline void rule_forward_mac(int);
-static __always_inline void rule_jail(int *, u_short, uint8_t, ipfw_insn *, struct ip_fw_args *, int, void *);
-static __always_inline void rule_recv(int *, ipfw_insn *, struct mbuf *, struct ip_fw_chain *, uint32_t *);
-static __always_inline void rule_xmit(int *, struct ifnet *, ipfw_insn *, struct ip_fw_chain *, uint32_t *);
-static __always_inline void rule_via(int *, struct ifnet *, struct mbuf *, ipfw_insn *, struct ip_fw_chain *, uint32_t *);
-static __always_inline void rule_macaddr2(int *, struct ip_fw_args *, ipfw_insn *);
-static __always_inline void rule_mac_type(int *, struct ip_fw_args *, ipfw_insn *, int, uint16_t);
-static __always_inline void rule_frag(int *, u_short);
-static __always_inline void rule_in(int *, struct ifnet *);
-static __always_inline void rule_layer2(int *, struct ip_fw_args *);
-static __always_inline void rule_diverted(int *, struct ip_fw_args *, ipfw_insn *);
-static __always_inline void rule_proto(int *, uint8_t, ipfw_insn *);
-static __always_inline void rule_ip_src(int *, int, ipfw_insn *, struct in_addr *);
-static __always_inline void rule_ip_dst_lookup(int *, ipfw_insn *, int, struct ip_fw_args *, uint32_t *, int, int, struct ip *, struct in_addr *, struct in_addr *, uint16_t, uint16_t, u_short, uint8_t, int, void *, struct ip_fw_chain *);
-static __always_inline void rule_ip_dst_mask(int *, int, ipfw_insn *, int, struct in_addr *, struct in_addr *);
-static __always_inline void rule_ip_src_me(int *, int, int, struct in_addr *, struct ip_fw_args *);
-
-#ifdef INET6
-static __always_inline void rule_ip6_src_me(int *, int, struct ip_fw_args *);
-#endif /* INET6 */
-
-static __always_inline void rule_ip_src_set(int *, int, ipfw_insn *, struct ip_fw_args *);
-static __always_inline void rule_ip_dst(int *, int, ipfw_insn *, struct in_addr *);
-static __always_inline void rule_ip_dst_me(int *, struct ip_fw_args *, int, int, struct in_addr *);
-
-#ifdef INET6
-static __always_inline void rule_ip6_dst_me(int *, struct ip_fw_args *args, int is_ipv6);
-#endif /* INET6 */
-
-static __always_inline void rule_ip_dstport(int *, uint8_t, u_short , ipfw_insn *, int , uint16_t , uint16_t);
-static __always_inline void rule_icmptype(int *, u_short, uint8_t , void *, ipfw_insn *);
-
-#ifdef INET6
-static __always_inline void rule_icmp6type(int *, u_short, int, uint8_t, void *, ipfw_insn *);
-#endif /* INET6 */
-
-static __always_inline void rule_ipopt(int *, int, struct ip *, ipfw_insn *);
-static __always_inline void rule_ipver(int *, int, ipfw_insn *, struct ip *);
-static __always_inline void rule_ipttl(int *, int, ipfw_insn *, int, struct ip *, uint16_t);
-static __always_inline void rule_ipprecedence(int *, int, ipfw_insn *, struct ip *);
-static __always_inline void rule_iptos(int *, int, ipfw_insn *, struct ip *);
-static __always_inline void rule_dscp(int *, int, int, ipfw_insn *, struct ip *);
-static __always_inline void rule_tcpdatalen(int *, uint8_t, u_short, void *, uint16_t, int, ipfw_insn *, struct ip *);
-static __always_inline void rule_tcpflags(int *, uint8_t, u_short, ipfw_insn *, void *);
-static __always_inline int rule_tcpopts(int *, u_int, void *, uint8_t, u_short, ipfw_insn *, struct mbuf *, struct ip_fw_args *);
-static __always_inline void rule_tcpseq(int *, uint8_t, u_short, ipfw_insn *, void *);
-static __always_inline void rule_tcpack(int *, uint8_t, u_short, ipfw_insn *, void *);
-static __always_inline void rule_tcpwin(int *, uint8_t, u_short, ipfw_insn *, int, void *);
-static __always_inline void rule_estab(int *, uint8_t, u_short, void *);
-static __always_inline void rule_altq(int *, ipfw_insn *, struct mbuf *, struct ip *);
-static __always_inline void rule_log(int *, struct ip_fw *, u_int, struct ip_fw_args *, struct mbuf *, struct ifnet *, u_short, u_short, uint32_t, struct ip *);
-static __always_inline void rule_prob(int *, ipfw_insn *);
-static __always_inline void rule_verrevpath(int *, struct ifnet *, struct mbuf *, int, struct ip_fw_args *, struct in_addr *);
-static __always_inline void rule_versrcreach(int *, u_int, struct ifnet *, int, struct ip_fw_args *, struct in_addr *);
-static __always_inline void rule_antispoof(int *, struct ifnet *, u_int, int, int, struct in_addr *, struct ip_fw_args *, struct mbuf *);
-
-#ifdef IPSEC
-static __always_inline void rule_ipsec(int *match, struct mbuf *);
-#endif /* IPSEC */
-
-#ifdef INET6
-static __always_inline void rule_ip6_src(int *, int, struct ip_fw_args *, ipfw_insn *);
-static __always_inline void rule_ip6_dst(int *, int, struct ip_fw_args *, ipfw_insn *);
-static __always_inline void rule_ip6_dst_mask(int *, struct ip_fw_args *, ipfw_insn *, int, int);
-static __always_inline void rule_flow6id(int *, int, struct ip_fw_args *, ipfw_insn *);
-static __always_inline void rule_ext_hdr(int *, int, uint16_t, ipfw_insn *);
-static __always_inline void rule_ip6(int *, int);
-#endif /* INET6 */
-
-static __always_inline void rule_ip4(int *, int);
-static __always_inline void rule_tag(int *, ipfw_insn *, struct mbuf *, uint32_t);
-static __always_inline void rule_fib(int *, struct ip_fw_args *, ipfw_insn *);
-static __always_inline void rule_sockarg(int *, int, uint8_t, struct in_addr *, struct in_addr *, uint16_t, uint16_t, struct ip_fw_args *, uint32_t *);
-static __always_inline void rule_tagged(int *, ipfw_insn *, int, struct mbuf *, uint32_t);
-
-/* The second sets of opcodes. They represent the actions of a rule. */
-static __always_inline void rule_keep_state(int *, struct ip_fw *f, ipfw_insn *, struct ip_fw_args *, uint32_t, int *, int *, int *);
-static __always_inline void rule_check_state(int *, int *, ipfw_dyn_rule *, struct ip_fw_args *, uint8_t, void *, int, struct ip_fw *, int *, struct ip_fw_chain *, ipfw_insn *, int *, int *);
-static __always_inline void rule_accept(int *, int *, int *);
-static __always_inline void rule_queue(struct ip_fw_args *, int, struct ip_fw_chain *, ipfw_insn *, uint32_t, int *, int *, int *);
-static __always_inline void rule_tee(int *, int *, int *, ipfw_insn *, struct ip_fw_args *, int, uint32_t, struct ip_fw_chain *);
-static __always_inline void rule_count(int *, struct ip_fw *, int);
-static __always_inline void rule_skipto(int *, int *, ipfw_insn *, int *, int *, int *, struct ip_fw *, int, struct ip_fw_chain *, uint32_t);
-static __always_inline void rule_callreturn(ipfw_insn *, struct mbuf *, struct ip_fw *, struct ip_fw_chain *, uint32_t, int, int *, int *, int *, int *);
-static __always_inline void rule_reject(u_int, int, u_short, uint8_t, void *, struct mbuf *, struct in_addr *, struct ip_fw_args *, ipfw_insn *, uint16_t, struct ip *);
-
-#ifdef INET6
-static __always_inline void rule_unreach6(u_int, int, u_short, uint8_t, uint8_t, struct mbuf *, struct ip_fw_args *, ipfw_insn *, struct ip *);
-#endif /* INET6 */
-
-static __always_inline void rule_deny(int *, int *, int *);
-static __always_inline void rule_forward_ip(struct ip_fw_args *, ipfw_dyn_rule *, struct ip_fw *, int, ipfw_insn *, uint32_t, int *, int *, int *);
-
-#ifdef INET6
-static __always_inline void rule_forward_ip6(struct ip_fw_args *, ipfw_dyn_rule *, struct ip_fw *, int, ipfw_insn *, int *, int *, int *);
-#endif /* INET6 */
-
-static __always_inline void rule_ngtee(struct ip_fw_args *, int, struct ip_fw_chain *, ipfw_insn *, uint32_t, int *, int *, int *);
-static __always_inline void rule_setfib(struct ip_fw *, int, uint32_t, ipfw_insn *, struct mbuf *, struct ip_fw_args *, int *);
-static __always_inline void rule_setdscp(ipfw_insn *, struct ip *, int, int, uint32_t, struct ip_fw *, int, int *);
-static __always_inline void rule_nat(struct ip_fw_args *, int, struct ip_fw_chain *, ipfw_insn *, struct mbuf *, uint32_t, int *, int *, int *);
-static __always_inline void rule_reass(struct ip_fw *, int, struct ip_fw_chain *, int, struct ip *, struct ip_fw_args *, struct mbuf *, int *, int *, int *);
-
 /* JIT compiling API */
-typedef int (*funcptr)();
-
 void ipfw_jit_init();
 funcptr compile_code();
 

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.h
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.h	Thu Jul 24 16:33:29 2014	(r271341)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.h	Thu Jul 24 17:15:40 2014	(r271342)
@@ -656,13 +656,13 @@
  * Actions executed per-rule.
  */
 
-static void
+static IPFW_RULES_INLINE void
 rule_nop(int *match)
 {
 	*match = 1;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_forward_mac(int opcode)
 {
 	printf("ipfw: opcode %d unimplemented\n",
@@ -670,7 +670,7 @@
 
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_jail(int * match, u_short offset, uint8_t proto, ipfw_insn *cmd, struct ip_fw_args *args, int ucred_lookup, void *ucred_cache)
 {
 	/*
@@ -693,25 +693,25 @@
 #endif
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_recv(int *match, ipfw_insn *cmd, struct mbuf *m, struct ip_fw_chain *chain, uint32_t *tablearg)
 {
 	*match = iface_match(m->m_pkthdr.rcvif, (ipfw_insn_if *)cmd, chain, tablearg);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_xmit(int *match, struct ifnet *oif, ipfw_insn *cmd, struct ip_fw_chain *chain, uint32_t *tablearg)
 {
 	*match = iface_match(oif, (ipfw_insn_if *)cmd, chain, tablearg);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_via(int *match, struct ifnet *oif, struct mbuf *m, ipfw_insn *cmd, struct ip_fw_chain *chain, uint32_t *tablearg)
 {
 	*match = iface_match(oif ? oif : m->m_pkthdr.rcvif, (ipfw_insn_if *)cmd, chain, tablearg);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_macaddr2(int *match, struct ip_fw_args *args, ipfw_insn *cmd)
 {
 	if (args->eh != NULL) {	/* have MAC header */
@@ -729,7 +729,7 @@
 
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_mac_type(int *match, struct ip_fw_args *args, ipfw_insn *cmd, int cmdlen, uint16_t etype)
 {
 	if (args->eh != NULL) {
@@ -745,26 +745,26 @@
 
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_frag(int *match, u_short offset)
 {
 	*match = (offset != 0);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_in(int *match, struct ifnet *oif)
 {
 	/* "out" is "not in" */
 	*match = (oif == NULL);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_layer2(int *match, struct ip_fw_args * args)
 {
 	*match = (args->eh != NULL);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_diverted(int *match, struct ip_fw_args * args, ipfw_insn *cmd)
 {
 	/* For diverted packets, args->rule.info
@@ -776,7 +776,7 @@
 	    cmd->arg1 & ((i & IPFW_INFO_IN) ? 1 : 2);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_proto(int *match, uint8_t proto, ipfw_insn *cmd)
 {
 	/*
@@ -786,7 +786,7 @@
 	*match = (proto == cmd->arg1);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_src(int *match, int is_ipv4, ipfw_insn *cmd, struct in_addr *src_ip)
 {
 	*match = is_ipv4 &&
@@ -794,7 +794,7 @@
 	    src_ip->s_addr);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_dst_lookup(int *match, ipfw_insn *cmd, int cmdlen, struct ip_fw_args *args, uint32_t *tablearg, int is_ipv4, int is_ipv6, struct ip *ip, struct in_addr *dst_ip, struct in_addr *src_ip, uint16_t dst_port, uint16_t src_port, u_short offset, uint8_t proto, int ucred_lookup, void *ucred_cache, struct ip_fw_chain *chain)
 {
 	if (is_ipv4) {
@@ -869,7 +869,7 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_dst_mask(int *match, int is_ipv4, ipfw_insn *cmd, int cmdlen, struct in_addr *dst_ip, struct in_addr *src_ip)
 {
 	if (is_ipv4) {
@@ -884,7 +884,7 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_src_me(int *match, int is_ipv4, int is_ipv6, struct in_addr *src_ip, struct ip_fw_args *args)
 {
 	if (is_ipv4) {
@@ -901,14 +901,14 @@
 }
 
 #ifdef INET6
-static void
+static IPFW_RULES_INLINE void
 rule_ip6_src_me(int *match, int is_ipv6, struct ip_fw_args *args)
 {
 	*match= is_ipv6 && search_ip6_addr_net(&args->f_id.src_ip6);
 }
 #endif /* INET6 */
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_src_set(int *match, int is_ipv4, ipfw_insn *cmd, struct ip_fw_args *args)
 {
 	if (is_ipv4) {
@@ -927,7 +927,7 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_dst(int *match, int is_ipv4, ipfw_insn *cmd, struct in_addr *dst_ip)
 {
 	*match = is_ipv4 &&
@@ -935,7 +935,7 @@
 	    dst_ip->s_addr);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_dst_me(int *match, struct ip_fw_args *args, int is_ipv4, int is_ipv6, struct in_addr *dst_ip)
 {
 	if (is_ipv4) {
@@ -951,14 +951,14 @@
 }
 
 #ifdef INET6
-static void
+static IPFW_RULES_INLINE void
 rule_ip6_dst_me(int *match, struct ip_fw_args *args, int is_ipv6)
 {
 	*match= is_ipv6 && search_ip6_addr_net(&args->f_id.dst_ip6);
 }
 #endif /* INET6 */
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip_dstport(int *match, uint8_t proto, u_short offset, ipfw_insn *cmd, int cmdlen, uint16_t dst_port, uint16_t src_port)
 {
 	/*
@@ -981,7 +981,7 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_icmptype(int *match, u_short offset, uint8_t proto, void *ulp, ipfw_insn *cmd )
 {
 	*match = (offset == 0 && proto==IPPROTO_ICMP &&
@@ -989,7 +989,7 @@
 }
 
 #ifdef INET6
-static void
+static IPFW_RULES_INLINE void
 rule_icmp6type(int *match, u_short offset, int is_ipv6, uint8_t proto, void *ulp, ipfw_insn *cmd)
 {
 	*match = is_ipv6 && offset == 0 &&
@@ -1001,7 +1001,7 @@
 #endif /* INET6 */
 
 
-static void
+static IPFW_RULES_INLINE void
 rule_ipopt(int *match, int is_ipv4, struct ip *ip, ipfw_insn *cmd)
 {
 	*match = (is_ipv4 &&
@@ -1009,14 +1009,14 @@
 
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ipver(int *match, int is_ipv4, ipfw_insn *cmd, struct ip *ip)
 {
 	*match = (is_ipv4 &&
 		cmd->arg1 == ip->ip_v);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ipttl(int *match, int is_ipv4, ipfw_insn *cmd, int cmdlen, struct ip *ip, uint16_t iplen)
 {
 	if (is_ipv4) {	/* only for IP packets */
@@ -1042,21 +1042,21 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ipprecedence(int *match, int is_ipv4, ipfw_insn *cmd, struct ip *ip)
 {
 	*match = (is_ipv4 &&
 	    (cmd->arg1 == (ip->ip_tos & 0xe0)) );
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_iptos(int *match, int is_ipv4, ipfw_insn *cmd, struct ip *ip)
 {
 	*match = (is_ipv4 &&
 	    flags_match(cmd, ip->ip_tos));
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_dscp(int *match, int is_ipv4, int is_ipv6, ipfw_insn *cmd, struct ip *ip)
 {
 	uint32_t *p;
@@ -1082,7 +1082,7 @@
 		*match = *p & (1 << x);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tcpdatalen(int *match, uint8_t proto, u_short offset, void *ulp, uint16_t iplen, int cmdlen, ipfw_insn *cmd, struct ip *ip)
 {
 	if (proto == IPPROTO_TCP && offset == 0) {
@@ -1106,14 +1106,14 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tcpflags(int *match, uint8_t proto, u_short offset, ipfw_insn *cmd, void *ulp)
 {
 	*match = (proto == IPPROTO_TCP && offset == 0 &&
 	    flags_match(cmd, TCP(ulp)->th_flags));
 }
 
-static int
+static IPFW_RULES_INLINE int
 rule_tcpopts(int *match, u_int hlen, void *ulp, uint8_t proto, u_short offset, ipfw_insn *cmd, struct mbuf *m, struct ip_fw_args *args)
 {
 	/*
@@ -1137,7 +1137,7 @@
 	return (0);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tcpseq(int *match, uint8_t proto, u_short offset, ipfw_insn *cmd, void *ulp)
 {
 	*match = (proto == IPPROTO_TCP && offset == 0 &&
@@ -1145,7 +1145,7 @@
 		TCP(ulp)->th_seq);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tcpack(int *match, uint8_t proto, u_short offset, ipfw_insn *cmd, void *ulp)
 {
 	*match = (proto == IPPROTO_TCP && offset == 0 &&
@@ -1153,7 +1153,7 @@
 		TCP(ulp)->th_ack);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tcpwin(int *match, uint8_t proto, u_short offset, ipfw_insn *cmd, int cmdlen, void *ulp)
 {
 	if (proto == IPPROTO_TCP && offset == 0) {
@@ -1174,7 +1174,7 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_estab(int *match, uint8_t proto, u_short offset, void *ulp)
 {
 	/* reject packets which have SYN only */
@@ -1184,7 +1184,7 @@
 	     (TH_RST | TH_ACK | TH_SYN)) != TH_SYN);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_altq(int *match, ipfw_insn *cmd, struct mbuf *m, struct ip *ip)
 {
 	struct pf_mtag *at;
@@ -1216,7 +1216,7 @@
 	at->hdr = ip;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_log(int *match, struct ip_fw *f, u_int hlen, struct ip_fw_args *args, struct mbuf *m, struct ifnet *oif, u_short offset, u_short ip6f_mf, uint32_t tablearg, struct ip *ip)
 {
 	ipfw_log(f, hlen, args, m,
@@ -1224,14 +1224,14 @@
 	*match = 1;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_prob(int *match, ipfw_insn *cmd)
 {
 	*match = (random()<((ipfw_insn_u32 *)cmd)->d[0]);
 	return;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_verrevpath(int *match, struct ifnet *oif, struct mbuf *m, int is_ipv6, struct ip_fw_args *args, struct in_addr *src_ip)
 {
 	/* Outgoing packets automatically pass/match */
@@ -1247,7 +1247,7 @@
 	        args->f_id.fib)));
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_versrcreach(int *match, u_int hlen, struct ifnet *oif, int is_ipv6, struct ip_fw_args *args, struct in_addr *src_ip)
 {
 	/* Outgoing packets automatically pass/match */
@@ -1261,7 +1261,7 @@
 }
 
 /* dpl XXX We could pass pointers to struct in_addr at in_localaddr() */
-static void
+static IPFW_RULES_INLINE void
 rule_antispoof(int *match, struct ifnet *oif, u_int hlen, int is_ipv4, int is_ipv6, struct in_addr *src_ip, struct ip_fw_args *args, struct mbuf *m)
 {
 	/* Outgoing packets automatically pass/match */
@@ -1287,7 +1287,7 @@
 }
 
 #ifdef IPSEC
-static void
+static IPFW_RULES_INLINE void
 rule_ipsec(int *match, struct mbuf *)
 {
 	*match = (m_tag_find(m,
@@ -1296,7 +1296,7 @@
 #endif /* IPSEC */
 
 #ifdef INET6
-static void
+static IPFW_RULES_INLINE void
 rule_ip6_src(int *match, int is_ipv6, struct ip_fw_args *args, ipfw_insn *cmd)
 {
 	*match = is_ipv6 &&
@@ -1304,7 +1304,7 @@
 	    &((ipfw_insn_ip6 *)cmd)->addr6);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip6_dst(int *match, int is_ipv6, struct ip_fw_args *args, ipfw_insn *cmd)
 {
 	*match = is_ipv6 &&
@@ -1312,7 +1312,7 @@
 	    &((ipfw_insn_ip6 *)cmd)->addr6);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip6_dst_mask(int *match, struct ip_fw_args *args, ipfw_insn *cmd, int cmdlen, int is_ipv6)
 {
 	if (is_ipv6) {
@@ -1336,7 +1336,7 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_flow6id(int *match, int is_ipv6, struct ip_fw_args *args, ipfw_insn *cmd)
 {
 	*match = is_ipv6 &&
@@ -1344,27 +1344,27 @@
 	    (ipfw_insn_u32 *) cmd);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ext_hdr(int *match, int is_ipv6, uint16_t ext_hd, ipfw_insn *cmd)
 {
 	*match = is_ipv6 &&
 	    (ext_hd & ((ipfw_insn *) cmd)->arg1);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip6(int *match, int is_ipv6)
 {
 	*match = is_ipv6;
 }
 #endif /* INET6 */
 
-static void
+static IPFW_RULES_INLINE void
 rule_ip4(int *match, int is_ipv4)
 {
 	*match = is_ipv4;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tag(int *match, ipfw_insn *cmd, struct mbuf *m, uint32_t tablearg)
 {
 	struct m_tag *mtag;
@@ -1395,14 +1395,14 @@
 	}
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_fib(int *match, struct ip_fw_args *args, ipfw_insn *cmd)
 {
 	if (args->f_id.fib == cmd->arg1)
 		*match = 1;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_sockarg(int *match, int is_ipv6, uint8_t proto, struct in_addr *dst_ip, struct in_addr *src_ip, uint16_t dst_port, uint16_t src_port, struct ip_fw_args *args, uint32_t *tablearg)
 {
 #ifndef USERSPACE	/* not supported in userspace */
@@ -1449,7 +1449,7 @@
 #endif /* !USERSPACE */
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tagged(int *match, ipfw_insn *cmd, int cmdlen, struct mbuf *m, uint32_t tablearg)
 {
 	struct m_tag *mtag;
@@ -1483,7 +1483,7 @@
 /*
  * The second sets of opcodes. They represent the actions of a rule.
  */
-static void
+static IPFW_RULES_INLINE void
 rule_keep_state(int *match, struct ip_fw *f, ipfw_insn *cmd, struct ip_fw_args *args, uint32_t tablearg, int *retval, int *l, int *done)
 {
 	if (ipfw_install_state(f,
@@ -1496,7 +1496,7 @@
 	*match = 1;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_check_state(int *match, int *dyn_dir, ipfw_dyn_rule *q, struct ip_fw_args *args, uint8_t proto, void *ulp, int pktlen, struct ip_fw *f, int *f_pos, struct ip_fw_chain *chain, ipfw_insn *cmd, int *cmdlen, int *l)
 {
 	/*
@@ -1545,7 +1545,7 @@
 	*match = 1;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_accept(int *retval, int *l, int *done)
 {
 	*retval = 0;	/* accept */
@@ -1553,7 +1553,7 @@
 	*done = 1;	/* exit outer loop */
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_queue(struct ip_fw_args *args, int f_pos, struct ip_fw_chain *chain, ipfw_insn *cmd, uint32_t tablearg, int *retval, int *l, int *done)
 {
 	set_match(args, f_pos, chain);
@@ -1567,7 +1567,7 @@
 	*done = 1;       /* exit outer loop */
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_tee(int *l, int *done, int *retval, ipfw_insn *cmd, struct ip_fw_args *args, int f_pos, uint32_t tablearg, struct ip_fw_chain *chain)
 {
 	if (args->eh) /* not on layer 2 */
@@ -1581,14 +1581,14 @@
 	args->rule.info = IP_FW_ARG_TABLEARG(cmd->arg1);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_count(int *l, struct ip_fw *f, int pktlen)
 {
 	IPFW_INC_RULE_COUNTER(f, pktlen);
 	*l = 0;		/* exit inner loop */
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_skipto(int *match, int *l, ipfw_insn *cmd, int *cmdlen, int *skip_or, int *f_pos, struct ip_fw *f, int pktlen, struct ip_fw_chain *chain, uint32_t tablearg)
 {
     IPFW_INC_RULE_COUNTER(f, pktlen);
@@ -1613,7 +1613,7 @@
     *skip_or = 0;
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_callreturn(ipfw_insn *cmd, struct mbuf *m, struct ip_fw *f, struct ip_fw_chain *chain, uint32_t tablearg, int pktlen, int *skip_or, int *cmdlen, int *f_pos, int *l)
 {
 	/*
@@ -1710,7 +1710,7 @@
 #undef IS_RETURN
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_reject(u_int hlen, int is_ipv4, u_short offset, uint8_t proto, void *ulp, struct mbuf *m, struct in_addr *dst_ip, struct ip_fw_args *args, ipfw_insn *cmd, uint16_t iplen, struct ip *ip)
 {
 	/*
@@ -1729,7 +1729,7 @@
 }
 
 #ifdef INET6
-static void
+static IPFW_RULES_INLINE void
 rule_unreach6(u_int hlen, int is_ipv6, u_short offset, uint8_t proto, uint8_t icmp6_type, struct mbuf *m, struct ip_fw_args *args, ipfw_insn *cmd, struct ip *ip)
 {
 	if (hlen > 0 && is_ipv6 &&
@@ -1747,7 +1747,7 @@
 #endif /* INET6 */
 
 
-static void
+static IPFW_RULES_INLINE void
 rule_deny(int *l, int *done, int *retval)
 {
 	*retval = IP_FW_DENY;
@@ -1755,7 +1755,7 @@
 	*done = 1;	/* exit outer loop */
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_forward_ip(struct ip_fw_args *args, ipfw_dyn_rule *q, struct ip_fw *f, int dyn_dir, ipfw_insn *cmd, uint32_t tablearg, int *retval, int *l, int *done)
 {
 	if (args->eh)	/* not valid on layer2 pkts */
@@ -1780,7 +1780,7 @@
 }
 
 #ifdef INET6
-static void
+static IPFW_RULES_INLINE void
 rule_forward_ip6(struct ip_fw_args *args, ipfw_dyn_rule *q, struct ip_fw *f, int dyn_dir, ipfw_insn *cmd, int *retval, int *l, int *done)
 {
 	if (args->eh)	/* not valid on layer2 pkts */
@@ -1798,7 +1798,7 @@
 }
 #endif /* INET6 */
 
-static void
+static IPFW_RULES_INLINE void
 rule_ngtee(struct ip_fw_args *args, int f_pos, struct ip_fw_chain *chain, ipfw_insn *cmd, uint32_t tablearg, int *retval, int *l, int *done)
 {
 	set_match(args, f_pos, chain);
@@ -1811,7 +1811,7 @@
 	*done = 1;       /* exit outer loop */
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_setfib(struct ip_fw *f, int pktlen, uint32_t tablearg, ipfw_insn *cmd, struct mbuf *m, struct ip_fw_args *args, int *l)
 {
 	uint32_t fib;
@@ -1825,7 +1825,7 @@
 	*l = 0;		/* exit inner loop */
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_setdscp(ipfw_insn *cmd, struct ip *ip, int is_ipv4, int is_ipv6, uint32_t tablearg, struct ip_fw *f, int pktlen, int *l)
 {
 	uint16_t code;
@@ -1852,7 +1852,7 @@
 	IPFW_INC_RULE_COUNTER(f, pktlen);
 }
 
-static void
+static IPFW_RULES_INLINE void
 rule_nat(struct ip_fw_args *args, int f_pos, struct ip_fw_chain *chain, ipfw_insn *cmd, struct mbuf *m, uint32_t tablearg, int *retval, int *done, int *l)
 {
 	*l = 0;          /* exit inner loop */
@@ -1886,7 +1886,8 @@
 	*retval = ipfw_nat_ptr(args, t, m);
 }
 
-static void rule_reass(struct ip_fw *f, int f_pos, struct ip_fw_chain *chain, int pktlen, struct ip *ip, struct ip_fw_args *args, struct mbuf *m, int *retval, int *done, int *l)
+static IPFW_RULES_INLINE void
+rule_reass(struct ip_fw *f, int f_pos, struct ip_fw_chain *chain, int pktlen, struct ip *ip, struct ip_fw_args *args, struct mbuf *m, int *retval, int *done, int *l)
 {
 	int ip_off;
 

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc	Thu Jul 24 16:33:29 2014	(r271341)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.cc	Thu Jul 24 17:15:40 2014	(r271342)
@@ -10,6 +10,7 @@
 #include <llvm/Support/MemoryBuffer.h>
 #include <llvm/Support/ErrorOr.h>
 
+typedef int (*funcptr)();
 using namespace llvm;
 
 class jitCompiler { 
@@ -35,7 +36,6 @@
 				exit(EXIT_FAILURE);
 			}
 			mod = ptr.get();
-			ptr = parseBitcodeFile(buffer.get(), c);
 		}
 } ;
 
@@ -86,3 +86,10 @@
 
 	*/
 }
+
+/* The mother of all functions! */
+extern "C" funcptr
+compile_code()
+{
+	return 0;
+}

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.h
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.h	Thu Jul 24 16:33:29 2014	(r271341)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/jit.h	Thu Jul 24 17:15:40 2014	(r271342)
@@ -1,2 +1,4 @@
-/* JIT code headers */
+typedef int (*funcptr)();
+
 void ipfw_jit_init();
+funcptr compile_code();


More information about the svn-soc-all mailing list