Re: How to assign specified PPP interface?

"JC Tsai" <[email protected]>
Newsgroups gmane.network.poptop
Message-ID <[email protected]>
Hi,

I found it's wired if I use a global variable to pass the specified PPP 
interface number from pptp_manager to pptpctrl. The first time, it works and 
the PPP number will be set to the # I want(such as ppp6). However, at the 
second time, I can't pass 7 to pptpctrl, and it will use ppp0. Finally I use 
clientNumber to reach the result I want. Pesudo code is as follows:

In "static void connectCall(int clientSocket, int clientNumber)"

Everytime pptpctrl is fork, clientNumber will be unique and different,

        /* set up PPP interface number */
        NUM2ARRAY(ppp_num_str,clientNumber+6);
        ppp_num_digit = strlen(ppp_num_str);
        ppp_num_str[ppp_num_digit] = '\0';
        ctrl_argv[pptpctrl_argc++] = ppp_num_str;

        /* terminate argv array with a NULL */
        ctrl_argv[pptpctrl_argc] = NULL;
        pptpctrl_argc++;

Thus I can pass ppp_number (as the last pptpctrl option) to pptpctrl, when 
two clients connected, the result is as:

ppp6      Link encap:Point-to-Point Protocol
          inet addr:192.168.44.1  P-t-P:192.168.44.10  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1400  Metric:1
          RX packets:24 errors:2 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:64
          RX bytes:2194 (2.1 KiB)  TX bytes:108 (108.0 B)

ppp7      Link encap:Point-to-Point Protocol
          inet addr:192.168.44.1  P-t-P:192.168.44.11  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1400  Metric:1
          RX packets:27 errors:2 dropped:0 overruns:0 frame:0
          TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:64
          RX bytes:2552 (2.4 KiB)  TX bytes:108 (108.0 B)

This is what I want. Thanks for your "unit information". However, I just 
wonder if the clientNumbers are sequential starting from 0 or not? Or it 
will be assigned randomly?

Regards,
JC Tsai

"James Cameron" <[email protected]> 
???????:[email protected]...
> On Tue, Mar 01, 2011 at 10:43:02PM +0800, JC Tsai wrote:
>> Can anyone tell me how to assign specified PPP interface when pptpd
>> calls pppd?
>
> The unit number is assigned by pppd, not by pptpd.
>
> pppd can use the "unit" option.  Easiest place to put this is in the
> options file that pppd is given.  Exactly where that is depends on your
> distribution choice or how you build pptpd, but usually it is in
> /etc/ppp and provided by the pptpd package as options.pptpd.
>
> If the unit number is already in use, the next available is used
> instead.
>
> See "man pppd" and search for the unit option.
>
> Another method to solve this is to direct the other applications, which
> may create fewer interfaces, to use higher numbered units.
>
> -- 
> James Cameron
> http://quozl.linux.org.au/
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search & Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT 
> data
> generated by your applications, servers and devices whether physical, 
> virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev 




------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.