Subject: [netatalk-admins] a solution for papd's 256 MB spool limit

From: [email-masked] (Abel Deuring)
Date: Sun, 13 Sep 1998 00:00:00 +0000

Hello

I hope that I have found a solution for the problem, that papd
stops spooling if more than 256 MB are transferred.

The bugfix was tested on a Linux machine (kernel 2.0.33),
netatalk 1.4b2, gcc 2.7.2 and MacOS 7.5/7.6, LaserWriter 8.4 and
8.5.

In file session.c, line 233, the "duplicate filtration" counter,  
seq, is incremented and then compared with 0xffff, so that the  
value of seq following on 0xfffe is 1. If this line is modified  
so that seq can also have the value 0xffff, the 256 MB spooling  
limit is avoided.

Thanks to Les Klein for giving me the hint, that my first patch  
to papd was not as successful as I hoped, and for testing this  
patch.

bye
Abel

The diff output from my patch:

diff session.c session.c.unpatched

233,234c233
< 	    seq++;
< 	    if (seq == 0) seq = 1;
---
> 	    if ( ++seq == 0xffff ) seq = 1;

---

From: Andras Kadinger <[email-masked]>
Date: Mon, 14 Sep 1998 01:04:07 +0200

Hello Abel, List,

> to papd was not as successful as I hoped, and for testing this

That's a very good point! I've read the pap source many times just after
reading the PAP specification, and I overlooked this each time.

Well then, here is the same for pap, since the coding is consistent
among them. Although I haven't heard anyone complaining yet for pap -
might be, because no job this long could get in through papd before.

Sincerely,
Andras Kadinger
[email-masked]

--- bin/pap/pap.c.orig	Mon Sep 14 00:47:33 1998
+++ bin/pap/pap.c	Mon Sep 14 01:01:24 1998
@@ -391,7 +391,8 @@
      */
     cbuf[ 0 ] = connid;
     cbuf[ 1 ] = PAP_READ;
-    if ( ++seq == 0xffff ) seq = 1;
+    seq++;
+    if ( seq == 0 ) seq = 1;
     netseq = htons( seq );
     bcopy( &netseq, &cbuf[ 2 ], sizeof( netseq ));
     atpb.atp_saddr = &sat;
@@ -590,7 +591,8 @@
 		 */
 		cbuf[ 0 ] = connid;
 		cbuf[ 1 ] = PAP_READ;
-		if ( ++seq == 0xffff ) seq = 1;
+		seq++;
+		if ( seq == 0 ) seq = 1;
 		netseq = htons( seq );
 		bcopy( &netseq, &cbuf[ 2 ], sizeof( netseq ));
 		atpb.atp_saddr = &sat;