Skip to contentSkip to conversation

about generic_establish_ppp()

DISCUSSION [email protected] 2 participants 3 messages May 6, 2008 PPP protocol drivers and compressors

lore
Share & tools
lore
#0 lore raw

in generic_establish_ppp():

ioctl(fd, PPPIOCATTCHAN, &chindex)

1.fd, is the parameter fd a channel's file descriptor or the file descriptor for "/dev/ppp0"?

2.chindex, is this a output parameter or input parameter? what is meaning?

I'm coufused about this function

2008-05-06

#1 lore raw
Quoted 4 lines · On Tue, May 06, 2008 at 11:49:29AM +0800, [email protected] wrote:

in generic_establish_ppp():
ioctl(fd, PPPIOCATTCHAN, &chindex)
1.fd, is the parameter fd a channel's file descriptor or the file descriptor for "/dev/ppp0"?

In the PPPIOCATTCHAN, it is the fd opened from /dev/ppp, but in the PPPIOCGCHAN just prior it is the fd of the tty. The same variable is re-used.

Quoted 1 line

2.chindex, is this a output parameter or input parameter? what is meaning?

At that time, input. In the previous ioctl, it is output. This is obvious because of the error messages in each return status check, and because it is used uninitialised first.

You would need to read the kernel source to be certain.

Read the Documentation/networking/ppp_generic.txt file. Focus on the definition of channels.

Then read the ppp_generic.c source, concentrating on the PPPIOCGCHAN and PPPIOCATTCHAN matches.

Signature · 2 lines
James Cameron
http://ftp.hp.com.au/sigs/jc/
#2 lore raw
In reply to [email protected]

in link_required():
devfd = the_channel->connect();
fd_ppp = the_channel->establish_ppp(devfd);

if uses rp-pppoe plugin , I think devfd is the socket fd not the descriptor for "/dev/ppp0" How to explain this?
2008-05-06

·¢¼şÈË£º James Cameron
·¢ËÍʱ¼ä£º 2008-05-06 14:51:16
ÊÕ¼şÈË£º [email protected]
³­ËÍ£º linux-ppp
Ö÷Ì⣺ Re: about generic_establish_ppp()

Quoted 4 lines · On Tue, May 06, 2008 at 11:49:29AM +0800, [email protected] wrote:

in generic_establish_ppp():
ioctl(fd, PPPIOCATTCHAN, &chindex)
1.fd, is the parameter fd a channel's file descriptor or the file descriptor for "/dev/ppp0"?

In the PPPIOCATTCHAN, it is the fd opened from /dev/ppp, but in the PPPIOCGCHAN just prior it is the fd of the tty. The same variable is re-used.

Quoted 1 line

2.chindex, is this a output parameter or input parameter? what is meaning?

At that time, input. In the previous ioctl, it is output. This is obvious because of the error messages in each return status check, and because it is used uninitialised first.
You would need to read the kernel source to be certain.
Read the Documentation/networking/ppp_generic.txt file. Focus on the definition of channels.
Then read the ppp_generic.c source, concentrating on the PPPIOCGCHAN and PPPIOCATTCHAN matches.

Signature · 9 lines
James Cameron
http://ftp.hp.com.au/sigs/jc/
--
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to [email protected]
__________ NOD32 3072 (20080503) Information __________
This message was checked by NOD32 antivirus system.
http://www.nod32cn.com
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±şšiş)í…æèw*jg¬±¨¶‰š�Šİ¢jÿ¾«şG«�éÿ¢¸¢·¦j:+v‰¨ŠwèjØm¶Ÿÿşø¯ù®w¥şŠàşf£¢·hš�â�úÿ†Ù¥