sending POD for PPPoe

Randeep randeep123 at gmail.com
Wed Sep 16 08:45:03 CEST 2015


Hi Alan,

We have both pppoe and hotspot services. If the user reaches the max data
limit we are applying fup limit by sending a coa update.

But with pppoe coa  is not working. So we implemented the following logic.

If the user exceeded the limit, then we will check whether its pppoe or
hotspot. If it is pppoe we are sending disconnect.

        update control    {
        #sum of the AcctInputOctets+AcctOutputOctets for this month.(From
the first day of the current month to till date)
        Tmp-Integer-0 := "%{sql:SELECT
(SUM(acctinputoctets)+SUM(acctoutputoctets)) AS Total FROM radacct where
radacct.username='%{User-Name}'}"
        #Value of Max-Data from the radgroupcheck for the group of the user
        Tmp-Integer-1 := "%{sql: SELECT radgroupcheck.value FROM
radusergroup INNER JOIN radgroupcheck ON radusergroup.groupname =
radgroupcheck.groupname WHERE  radusergroup.username='%{User-Name}' AND
 radgroupcheck.attribute='Max-Data'}"
        Tmp-String-1 := "%{sql: SELECT radgroupcheck.value FROM
radusergroup INNER JOIN radgroupcheck ON radusergroup.groupname =
radgroupcheck.groupname WHERE  radusergroup.username='%{User-Name}' AND
 radgroupcheck.attribute='Mikrotik-Rate-Limit'}"
        Tmp-String-3 = "%{sql:select calledstationid from radacct where
acctsessionid='%{Acct-Session-Id}'}"
}
        if ("%{control:Tmp-Integer-0}" > "%{control:Tmp-Integer-1}") {
#Added these to update COA for hotspot and disconnect for PPPOE
    if ("%{control:Tmp-String-3}" == "hotspot1"){
    update coa {
    User-Name = "%{User-Name}"
    Acct-Session-Id = "%{Acct-Session-Id}"
    NAS-IP-Address = "%{NAS-IP-Address}"
    Framed-IP-Address = "%{Framed-IP-Address}"
    Mikrotik-Rate-Limit = "%{control:Tmp-String-1}"
      }
    }
    else {
    echo "Acct-Session-Id=\"%{Acct-Session-Id}\"" >
/tmp/\"%{User-Name}\".txt
    echo "User-Name=\"%{User-Name}\"" >> /tmp/\"%{User-Name}\".txt
    echo "NAS-IP-Address=\"%{Framed-IP-Address}\"" >>
/tmp/\"%{User-Name}\".txt
    Secret= `grep "%{NAS-IP-Address}" /usr/local/etc/raddb/clients.conf -b2
| grep secret |awk '{print $4}' `
    cat "/tmp/\"%{User-Name}\".txt" | radclient -x "%{NAS-IP-Address}":3799
disconnect "$Secret"
    }
  }

But when running radiusd -XXX its giving the following error.
Wed Sep 16 12:14:04 2015 : Error:
/usr/local/etc/raddb/sites-enabled/default[623]: Expecting section start
brace '{' after "echo Acct-Session-Id="%{Acct-Session-Id}""
Wed Sep 16 12:14:04 2015 : Error: Errors reading or parsing
/usr/local/etc/raddb/radiusd.conf

Please help

Regards,
Randeep


More information about the Freeradius-Users mailing list