socsvn commit: r273961 - soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw

dpl at FreeBSD.org dpl at FreeBSD.org
Thu Sep 11 10:13:19 UTC 2014


Author: dpl
Date: Thu Sep 11 10:13:18 2014
New Revision: 273961
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=273961

Log:
  Force inclusion of functions at bitcode.

Modified:
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c	Thu Sep 11 10:13:04 2014	(r273960)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw_rules.c	Thu Sep 11 10:13:18 2014	(r273961)
@@ -7,8 +7,18 @@
 
 // The real function will be compiled and inserted by the JIT.
 int ipfw_chk_jit(struct ip_fw_args *args, struct ip_fw_chain *chain);
+static int jump_fast(struct ip_fw_chain *chain, struct ip_fw *f, int num,
+					int tablearg, int jump_backwards);
+static void set_match(struct ip_fw_args *args, int slot, struct ip_fw_chain *chain);
+static int is_icmp_query(struct icmphdr *icmp);
+static int ipopts_match(struct ip *ip, ipfw_insn *cmd);
+static int tcpopts_match(struct tcphdr *tcp, ipfw_insn *cmd);
+static int iface_match(struct ifnet *ifp, ipfw_insn_if *cmd, 
+				struct ip_fw_chain *chain, uint32_t *tablearg);
+static int verify_path(struct in_addr src, struct ifnet *ifp, u_int fib);
+static void send_reject(struct ip_fw_args *args, int code, int iplen, 
+						struct ip *ip);
 
-void crfree(struct ucred *);
 time_t time_uptime = 0;
 
 /* XXX Function defined at ip_fw_sockopt.c
@@ -41,7 +51,6 @@
 int tags_minlen = 64;
 int tags_freelist_count = 0;
 static int tags_freelist_max = 0;
-
 struct mbuf *mbuf_freelist;
 
 void
@@ -87,50 +96,56 @@
 struct _ipfw_insn_if;
 struct _ipfw_dyn_rule;
 
-// We should hide this.
-#ifndef __FreeBSD__
-	struct bsd_ucred;
-#else
-	struct ucred;
-#endif
-
 // This functions only forces the compiler to store the stubs of the functions
 // so that they can be used by the JIT-compiled code instead.
-// this functions is not to be called anywhere.
+// This function is not to be called ever.
 void
 voidfunction()
 {
 	struct ip_fw_args arguments;
 	struct ip_fw_chain chainss;
-	uint32_t thing;
-
-	#ifndef __FreeBSD__
-		struct bsd_ucred user_creds;
-	#else
-		struct ucred user_creds;
-	#endif
 
-	// These two structs are not included.
+	// These structs are not included.
 	// We need to do something with them.
 	struct _ipfw_insn_if insnif;
 	struct _ipfw_dyn_rule rules;
-
-	struct ip_fw_args *args = &arguments;
+	struct _ipfw_insn_ip ip;
+	struct _ipfw_insn_u16 u16;
+	struct _ipfw_dyn_rule rule;
+	struct ip_fw_args *args;
 	struct ip_fw_chain *chain = &chainss;
+	struct ip_fw f;
+	struct icmphdr icmp;
+	struct ip ipstruct;
+	struct tcphdr tcp;
+	ipfw_insn cmd;
+	struct ifnet ifp;
+	ipfw_insn_if cmdif;
+	struct in_addr src;
+
+	int n, tablearg, jmp;
+	uint32_t t;
+	u_int fib;
+
+	args = &arguments;
+	ip.o.opcode = 1;
+	u16.o.opcode = 1;
+	rule.pcnt = 0;
 
 	ipfw_find_rule(chain, 0, 0);
-	ipfw_chk_jit(args, chain);
-
 	insnif.o.opcode = 0;
 	rules.next = &rules;
 
-#ifdef __FreeBSD__
-	struct ucred *ucreds = &user_creds;
-
-	crfree(ucreds);
-#endif
-
-	thing = htonl(thing);
-	thing = ntohl(thing);
+	/* Functions */
+	ipfw_chk_jit(args, chain);
+	n = tablearg = jmp = t = fib = 0;
+	jump_fast(chain, &f, n, tablearg, jmp);
+	set_match(args, n, chain);
+	is_icmp_query(&icmp);
+	ipopts_match(&ipstruct, &cmd);
+	tcpopts_match(&tcp, &cmd);
+	iface_match(&ifp, &cmdif, chain, &t);
+	verify_path(src, &ifp, fib);
+	send_reject(args, tablearg , n, &ipstruct);
 }
 


More information about the svn-soc-all mailing list