socsvn commit: r272675 - in soc2014/dpl/netmap-ipfwjit: extra sys/netpfil/ipfw

dpl at FreeBSD.org dpl at FreeBSD.org
Tue Aug 19 19:00:56 UTC 2014


Author: dpl
Date: Tue Aug 19 19:00:54 2014
New Revision: 272675
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272675

Log:
  Respect allocating memory initialized to zero.

Modified:
  soc2014/dpl/netmap-ipfwjit/extra/missing.c
  soc2014/dpl/netmap-ipfwjit/extra/missing.h
  soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c

Modified: soc2014/dpl/netmap-ipfwjit/extra/missing.c
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/extra/missing.c	Tue Aug 19 18:47:47 2014	(r272674)
+++ soc2014/dpl/netmap-ipfwjit/extra/missing.c	Tue Aug 19 19:00:54 2014	(r272675)
@@ -450,8 +450,10 @@
 }
 
 void *
-kern_malloc(int sz)
+kern_malloc(int sz, int flags)
 {
+	if (flags & M_ZERO)
+		return calloc(1, sz);
 	return malloc(sz);
 }
 

Modified: soc2014/dpl/netmap-ipfwjit/extra/missing.h
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/extra/missing.h	Tue Aug 19 18:47:47 2014	(r272674)
+++ soc2014/dpl/netmap-ipfwjit/extra/missing.h	Tue Aug 19 19:00:54 2014	(r272675)
@@ -54,6 +54,7 @@
 #endif
 
 #include <stdio.h>	// printf
+#include <sys/malloc.h> // M_* flags
 #include <sys/socket.h>	// IFNAMSIZ ?
 #include <string.h>	// strncmp
 #ifdef NEED_KERNEL
@@ -70,9 +71,10 @@
 
 #define MALLOC_DECLARE(x)	/* nothing */
 // XXX kernel malloc/free
-extern void *kern_malloc(int);
+extern void *kern_malloc(int, int);
 extern void kern_free(void *);
-#define malloc(_size, type, flags) kern_malloc(_size)
+#define malloc(_size, type, _flags) \
+	kern_malloc(_size, _flags)
 #define free(_var, type) kern_free(_var)
 
 /* inet_ntoa_r() differs in userspace and kernel.

Modified: soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c
==============================================================================
--- soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c	Tue Aug 19 18:47:47 2014	(r272674)
+++ soc2014/dpl/netmap-ipfwjit/sys/netpfil/ipfw/ip_fw2.c	Tue Aug 19 19:00:54 2014	(r272675)
@@ -279,6 +279,7 @@
 			IPFW_PF_RUNLOCK(chain);
 			return (IP_FW_PASS);	/* accept */
 		}
+		printf("\nAbout to compile!\n");
 		compiledfuncptr = compile_code(args, chain);
 		IPFW_PF_RUNLOCK(chain);
 	} else


More information about the svn-soc-all mailing list