Нарезка согласно биллингу
DROP PROCEDURE IF EXISTS `radreply`;
DELIMITER $$
CREATE PROCEDURE `radreply` (IN login VARCHAR(64))
BEGIN
DECLARE usr_id INT;
DECLARE usr_ip VARCHAR(15);
DECLARE rate_limit INT;
DECLARE rate_limit_out INT;
DECLARE normal_burst INT;
DECLARE normal_burst_out INT;
DECLARE extended_burst INT;
DECLARE extended_burst_out INT;
SELECT id,ip INTO usr_id,usr_ip FROM users WHERE name=login;
INSERT into dblogin (mid,act,time) VALUES (usr_id,47,unix_timestamp());
SELECT plans2.speed,plans2.speed_out INTO rate_limit,rate_limit_out from users,plans2 where users.name=login and users.paket=plans2.id ;
SET rate_limit=rate_limit*1024;
SET rate_limit_out=rate_limit_out*1024;
SET normal_burst=ROUND(rate_limit*3/16);
SET normal_burst_out=ROUND(rate_limit_out*3/16);
SET extended_burst=2*normal_burst;
SET extended_burst_out=2*normal_burst_out;
SELECT usr_id as id,login,'Framed-IP-Netmask' as Attribute,'255.255.255.255' as Value,':=' as op;
SELECT usr_id as id,login,'Framed-IP-Address' as Attribute,usr_ip as Value,':=' as op;
IF (rate_limit>0) THEN SELECT usr_id as id,login,"mpd-limit" as Attribute,concat("out#1=all shape ",rate_limit," ",normal_burst," ",extended_burst) as Value,"+=" as op;
END IF;
IF (rate_limit_out>0) THEN SELECT usr_id as id,login,"mpd-limit" as Attribute,concat("in#1=all shape ",rate_limit_out," ",normal_burst_out," ",extended_burst_out) as Value,"+=" as op;
END IF;
END$$
DELIMITER ;
По аналогичному принцыпу реализовано и для Mikrotik .
Аналогичное встречал (когда уже сделал) на
http://groups.google.com/group/nodeny для CISCO .