Module Name:    src
Committed By:   drochner
Date:           Thu Feb 10 21:17:49 UTC 2011

Modified Files:
        src/sys/opencrypto: deflate.c

Log Message:
whan compressing, set the Z_FINISH flag to zlib to tell that
the data chunk is the final one, which makes that zlib issues the
proper termination marker
(KAME IPSEC does this, but doesn't check eagerly in the receive
path, so the missing termination didn't cause problems so far)
closes my PR kern/44539
being here, replace the Z_PARTIAL_FLUSH flag which is marked
deprecated by zlib by Z_SYNC_FLUSH in the decompression path
(tested with IPv4 IPCOMP on i386)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/opencrypto/deflate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/opencrypto/deflate.c
diff -u src/sys/opencrypto/deflate.c:1.13 src/sys/opencrypto/deflate.c:1.14
--- src/sys/opencrypto/deflate.c:1.13	Wed Mar 25 01:26:13 2009
+++ src/sys/opencrypto/deflate.c	Thu Feb 10 21:17:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: deflate.c,v 1.13 2009/03/25 01:26:13 darran Exp $ */
+/*	$NetBSD: deflate.c,v 1.14 2011/02/10 21:17:49 drochner Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/deflate.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $	*/
 /* $OpenBSD: deflate.c,v 1.3 2001/08/20 02:45:22 hugh Exp $ */
 
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.13 2009/03/25 01:26:13 darran Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deflate.c,v 1.14 2011/02/10 21:17:49 drochner Exp $");
 
 #include <sys/types.h>
 #include <sys/malloc.h>
@@ -132,8 +132,8 @@
 	if (error != Z_OK)
 		goto bad;
 	for (;;) {
-		error = decomp ? inflate(&zbuf, Z_PARTIAL_FLUSH) :
-				 deflate(&zbuf, Z_PARTIAL_FLUSH);
+		error = decomp ? inflate(&zbuf, Z_SYNC_FLUSH) :
+				 deflate(&zbuf, Z_FINISH);
 		if (error != Z_OK && error != Z_STREAM_END)
 			goto bad;
 		else if (zbuf.avail_in == 0 && zbuf.avail_out != 0)
@@ -354,8 +354,8 @@
 	for (;;) {
 		DPRINTF(("pre: %s in:%d out:%d\n", decomp ? "deflate()" : "inflate()", 
 				zbuf.avail_in, zbuf.avail_out));
-		error = decomp ? inflate(&zbuf, Z_PARTIAL_FLUSH) :
-				 deflate(&zbuf, Z_PARTIAL_FLUSH);
+		error = decomp ? inflate(&zbuf, Z_SYNC_FLUSH) :
+				 deflate(&zbuf, Z_FINISH);
 		DPRINTF(("post: %s in:%d out:%d\n", decomp ? "deflate()" : "inflate()", 
 				zbuf.avail_in, zbuf.avail_out));
 		if (error != Z_OK && error != Z_STREAM_END) {

Reply via email to