Subject: Re: pkg/33926 (rp-pppoe report asyncReadFromPPP error on NetBSD-3.0)
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Water He <water@infor-trans.com>
List: pkgsrc-bugs
Date: 09/01/2006 15:10:10
The following reply was made to PR pkg/33926; it has been noted by GNATS.

From: "Water He" <water@infor-trans.com>
To: <gnats-bugs@NetBSD.org>, <martin@NetBSD.org>,
	<gnats-admin@NetBSD.org>, <pkgsrc-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/33926 (rp-pppoe report asyncReadFromPPP error on NetBSD-3.0)
Date: Fri, 1 Sep 2006 18:16:30 +0800

 I am very very sorry: till now, I am able to test your modify.
 
 1)
 I don't know how to apply the file `patch-ah` you provided.
 I try to add patch-ah into distinfo, but I am afraid of checksum 
 calculating.
 
 for example, to verify it, i test it on patch-aa
 serv01: [water] {46} sha1 patch-aa
 SHA1 (patch-aa) = 65d518f2eeede695ec2827f1a55d6cbbb87bd8ae
 
 but in distinfo:
 SHA1 (patch-aa) = 3f806e96d3c89d9d0850d6692fd8b14778bc46c4
 
 what's wrong?
 
 2)
 So, when make is done, I apply your patch-ah line by line manually,
 re-compile ppp.o, re-link pppoe and copy it to /usr/pkg/sbin/
 
 below is /var/log/messages:
 
 Sep  1 17:55:38 au1550 pppd[28940]: Using interface ppp0
 Sep  1 17:55:38 au1550 pppd[28940]: Connect: ppp0 <--> /dev/ttyp1
 Sep  1 17:55:38 au1550 pppoe[24931]: Interface=aumac1 
 HWaddr=00:00:1A:19:1C:26 D
 evice=/dev/bpf0 Buffer size=32768
 Sep  1 17:56:09 au1550 pppd[28940]: LCP: timeout sending Config-Requests
 Sep  1 17:56:09 au1550 pppd[28940]: Connection terminated.
 Sep  1 17:56:09 au1550 pppd[28940]: read: Bad file descriptor
 Sep  1 17:56:09 au1550 pppd[28940]: Exit.
 Sep  1 17:56:09 au1550 pppoe-server[23339]: Session 3 closed for client 
 00:00:f0
 :7e:d3:24 (192.168.13.12) on aumac1
 Sep  1 17:56:09 au1550 pppoe[23916]: Unexpected packet code 167
 Sep  1 17:56:09 au1550 pppoe-server[23339]: Sent PADT
 
 ----- Original Message ----- 
 From: "Martin Husemann" <martin@duskware.de>
 To: <martin@NetBSD.org>; <gnats-admin@NetBSD.org>; <pkgsrc-bugs@NetBSD.org>; 
 <water@infor-trans.com>
 Sent: Saturday, August 05, 2006 10:15 PM
 Subject: Re: pkg/33926 (rp-pppoe report asyncReadFromPPP error on 
 NetBSD-3.0)
 
 
 > The following reply was made to PR pkg/33926; it has been noted by GNATS.
 >
 > From: Martin Husemann <martin@duskware.de>
 > To: gnats-bugs@NetBSD.org
 > Cc:
 > Subject: Re: pkg/33926 (rp-pppoe report asyncReadFromPPP error on 
 > NetBSD-3.0)
 > Date: Sat, 5 Aug 2006 16:12:43 +0200
 >
 > --RASg3xLB4tUQ4RcS
 > Content-Type: text/plain; charset=us-ascii
 > Content-Disposition: inline
 >
 > The package seems broken in multiple ways. The patches patch-ac and
 > patch-ad (both noops and unecessary) should be removed.
 >
 > The patch below fixes the obvious EINVAL problem reported in this PR, but
 > it does not make the package work - to me it seems after restructuring
 > rp-pppoe completely there has been no testing on OSes using BPF.
 >
 > If noone volunteers to debug the package all way through we should either
 > mark it broken or consider downgrading it.
 >
 > Martin
 >
 > --RASg3xLB4tUQ4RcS
 > Content-Type: text/plain; charset=us-ascii
 > Content-Disposition: attachment; filename=patch-ah
 >
 > --- src/ppp.c.orig 2002-07-08 16:38:24.000000000 +0200
 > +++ src/ppp.c 2006-08-05 15:49:46.000000000 +0200
 > @@ -164,13 +164,27 @@
 >  void
 >  asyncReadFromPPP(PPPoEConnection *conn, PPPoEPacket *packet)
 >  {
 > -    unsigned char buf[READ_CHUNK];
 > -    unsigned char *ptr = buf;
 > +    unsigned char *ptr;
 >      unsigned char c;
 > +    extern int bpfLength;
 > +    static int readLength = 0;
 > +    unsigned char *buf = NULL;
 >
 >      int r;
 >
 > -    r = read(0, buf, READ_CHUNK);
 > +    if (readLength == 0) {
 > + /*
 > + * We need to read everything from BPF in the size the kernel
 > + * told us (bpfLength), if we are using BPF.
 > + * Otherwise just use READ_CHUNK.
 > + */
 > + if (bpfLength == 0)
 > +     readLength = READ_CHUNK;
 > + else
 > +     readLength = bpfLength;
 > +    }
 > +    ptr = buf = malloc(readLength);
 > +    r = read(0, buf, readLength);
 >      if (r < 0) {
 >  fatalSys("read (asyncReadFromPPP)");
 >      }
 > @@ -193,7 +207,7 @@
 >  }
 >
 >  /* Still waiting... */
 > - if (PPPState == STATE_WAITFOR_FRAME_ADDR) return;
 > + if (PPPState == STATE_WAITFOR_FRAME_ADDR) goto done;
 >
 >  while(r && PPPState == STATE_DROP_PROTO) {
 >      --r;
 > @@ -202,7 +216,7 @@
 >      }
 >  }
 >
 > - if (PPPState == STATE_DROP_PROTO) return;
 > + if (PPPState == STATE_DROP_PROTO) goto done;
 >
 >  /* Start building frame */
 >  while(r && PPPState == STATE_BUILDING_PACKET) {
 > @@ -234,6 +248,8 @@
 >      }
 >  }
 >      }
 > +done:
 > +    free(buf);
 >  }
 >
 >  /**********************************************************************
 >
 > --RASg3xLB4tUQ4RcS--
 >
 >