G'day.
I noticed a difference between the Sent bytes entry in the pppd 2.3.7 log
and corresponding number provided by ipchains -L -v. I guess this
reflects the difference between raw bytes and cooked packet contents, but
I don't know of any documentation that makes this clear. So I will
explain how I am getting the numbers, and await your reassuring comments.
:-)
When someone connects to calypso.view.net.au and starts pppd with
authentication, ip-up creates an ipchains chain whose name is the
peername (with two added characters "_d", unfortunately abbreviated
because I haven't yet hacked ipchains to accommodate the required name
length).
Here are the relevant lines from ip-up
CHNAME=`echo $PEERNAME | cut -b1-6`
/sbin/ipchains -N ${CHNAME}_d
/sbin/ipchains -A ${CHNAME}_d -d $IPREMOTE
/sbin/ipchains -A output -d $IPREMOTE -j ${CHNAME}_d
bytes=`/sbin/ipchains -L ${CHNAME}_d -v -n | /usr/sbin/bytegrep`
timebytes=`date +"%b %d %T "`$bytes
echo -e "$timebytes\t$PEERNAME\t$IPREMOTE up" >>/var/log/ephtraff/hangup_d
where bytegrep is a little script that just extracts the byte count from
the ipchains output. Since it's relevant to the point I'll append it
below. Obviously, 'bytes' should be zero at this stage. It seems that it
isn't always, but I'm disregarding those cases.
When the link is closed, ip-down gets another -L -v report of the chain,
then (redundantly, I think) zeroes it, then deletes it.
bytes=`/sbin/ipchains -L ${CHNAME}_d -v -n | /usr/sbin/bytegrep`
timebytes=`date +"%b %d %T "`$bytes
echo -e "$timebytes\t$PEERNAME\t$IPREMOTE" >>/var/log/ephtraff/hangup_d
/sbin/ipchains -D output -d $IPREMOTE -j ${CHNAME}_d
/sbin/ipchains -D ${CHNAME}_d -d $IPREMOTE
/sbin/ipchains -Z ${CHNAME}_d
/sbin/ipchains -X ${CHNAME}_d
Here is example output, and the corresponding lines from the pppd log:
Apr 11 12:29:15 0 chameleon 10.1.6.2 up
Apr 11 12:33:56 24853 chameleon 10.1.6.2
Apr 11 12:33:55 calypso pppd[147]: Connect time 4.8 minutes.
Apr 11 12:33:55 calypso pppd[147]: Sent 8444 bytes, received 7963 bytes.
I'd like to understand why 24853 in one case and 8444 in the other.
Here is /usr/sbin/bytegrep:
#!/usr/bin/tclsh
set fname [lindex $argv 0]
if {$fname == ""} {
set fvar stdin
} else {
set fvar [open $fname r]
}
gets $fvar
gets $fvar
gets $fvar teststring
if [regexp {^ *[0-9]+ +([0-9]+(K?|M?))} $teststring discard want] {
puts $want
}
-
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to [EMAIL PROTECTED]