Re: get ip

Greg <[email protected]> Mon, 17 Mar 2014 16:42:07 -0500
Newsgroups gmane.network.poptop
Message-ID <[email protected]>
I found that remote_number(from auth.c I believe) is populated with the 
original ip of the connecting system.

after that, I used get_ppp_stats to gain the stats needed(bytes_in and 
bytes_out) to log the traffic when the user disconnects.

Thank you,
Greg Borbonus
*Nix Server administrator

On 3/17/2014 4:26 PM, James Cameron wrote:
> On Sun, Mar 16, 2014 at 01:51:57PM -0500, Greg wrote:
>> I was wondering if anyone could tell me how to get the ip address
>> from the client when using ip_up notifier?
>>
>> Also, with the ip_down notifier.
> When given the --logwtmp argument, or the logwtmp option in
> pptpd.conf, pptpd will add four arguments to the pppd command line:
>
>      plugin /usr/lib/pptpd/pptpd-logwtmp.so pptpd-original-ip x.x.x.x
>
> When pppd starts, the pptpd-logwtmp plugin will be activated, which
> adds an options table, and notifiers for ip_up and ip_down.
>
> When pppd processes arguments on the command line, it will fill in the
> pptpd_original_ip variable in the plugin.
>
> When the ip_up notifier is called, the pptpd_original_ip variable will
> have the IP address of the client, or their NAT gateway.
>
> (In the distributed source, ip_up calls logwtmp(3), and optionally
> writes the details to the debug log.)
>
> You can get the IP address from the pptpd_original_ip variable.
>
>> I'm attempting to track the bandwidth usage and connection via the
>> above notifiers.  Any help would be greatly appreciated.
> Conventional UNIX wtmp accounting can be used for connection and time
> spent, but not for data used.
>
> Data used can be deduced by reading the byte counts at ip_down time,
> which are part of the pppd implementation.
>
> The byte counts against the PPP network interface will trend with the
> byte counts of the PPTP stream; but if you need more exact network
> accounting use iptables counters.
>
> Bandwidth can be calculated by averaging data used over connection
> time.
>


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech