Subject: Re: pkg/33926 rp-pppoe/pppoe-server fails
To: None <,,>
From: Water NB <>
List: pkgsrc-bugs
Date: 10/30/2006 14:10:06
The following reply was made to PR pkg/33926; it has been noted by GNATS.

From: Water NB <>
Subject: Re: pkg/33926 rp-pppoe/pppoe-server fails
Date: Mon, 30 Oct 2006 22:04:49 +0800

 I traced the problem and now report the result here:
 asyncReadFromPPP() is used to read data from pppd,
 but comment in patch gived by martin said that it read from BPF.
 I think I couldn't agree it.
 pppoe-server fork pppd, pppd fork pppoe. so data-stream is like below:
 pppd <---> pppoe <---> BPF/ethernet
 safe_fork() in src/dist/pppd/pppd/main.c says:
 pppd create a pipe and used to communicates with forked progcess (here
 is pppoe).
 because of safe_fork()'s works,
 pppoe read from stdin (fd=0) means read from pppd,
 pppoe write to stdout (fd=1) means write to pppd,
 Now I find out a problem, 
 when pppoe call openInterface() to get BPF fd (calling in session() of
 it return 0;
 So, in fact, as like I traced:
 asyncReadFromPPP() alwasy read data from BPF. But it should read from
 pipe of pppd.
 I notice that openInterface() return 3 in program pppoe-server.
 Why it return 0 in program pppoe?
 Because pppd close stdin, stdout,stderr before call execl()?
 I guess that if openInterface() return >= 3 will resolve the problem.