EfendyRadius call radreply_ipoe шлет такую конструкцию
(14) sql: EXPAND call radreply_ipoe('%{User-Name}','%{NAS-Identifier}')
(14) sql: --> call radreply_ipoe('ec086bd996e7-0012cf7ef380-21','accel-ppp-ipoe')
radreply_ipoe
DELIMITER $$
CREATE DEFINER=`nodeny`@`%` PROCEDURE `radreply_ipoe`(IN `login` VARCHAR(64), IN `tag` VARCHAR(64))
BEGIN
DECLARE rad_mac VARCHAR(12);
DECLARE rad_dev_mac VARCHAR(12);
DECLARE rad_port VARCHAR(6);
DECLARE usr_id INT;
DECLARE usr_onecon INT;
DECLARE usr_ip VARCHAR(15);
SELECT SUBSTRING_INDEX(login, '-', 1) INTO rad_mac;
SELECT SUBSTRING_INDEX(login, '-', -1) INTO rad_port;
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(login, '-', 2), '-', -1) INTO rad_dev_mac;
SELECT uid, oneconnect INTO usr_id, usr_onecon FROM mac_uid
WHERE device_mac=rad_dev_mac AND device_port=rad_port
AND (mac=rad_mac OR (oneconnect>0 AND device_mac<>''))
LIMIT 1;
IF usr_id IS NOT NULL AND usr_id > 0 THEN
SELECT get_ip_by_tag(usr_id, tag) INTO usr_ip;
UPDATE mac_uid SET ip=0 WHERE ip=INET_ATON(usr_ip) AND uid<>usr_id;
UPDATE mac_uid SET ip=INET_ATON(usr_ip), time=UNIX_TIMESTAMP() WHERE uid=usr_id;
IF usr_onecon > 0 THEN
UPDATE mac_uid SET mac=NULL WHERE mac=rad_mac AND oneconnect=0;
UPDATE mac_uid SET mac=rad_mac WHERE device_mac=rad_dev_mac AND device_port=rad_port AND oneconnect>0;
END IF;
ELSE
UPDATE mac_uid SET ip=0 WHERE uid=0 AND time<(UNIX_TIMESTAMP()-3600);
UPDATE mac_uid SET mac=NULL WHERE mac=rad_mac AND oneconnect>0;
START TRANSACTION;
SELECT INET_NTOA(ip) INTO usr_ip FROM ip_pool p WHERE uid=0 AND type='dynamic'
AND tags LIKE CONCAT('%,', tag ,',%')
AND NOT EXISTS (SELECT ip FROM mac_uid WHERE ip=p.ip)
ORDER BY RAND() LIMIT 1 FOR UPDATE;
INSERT INTO mac_uid VALUES(
NULL, rad_mac, INET_ATON(usr_ip), 0, UNIX_TIMESTAMP(), rad_dev_mac, rad_port, 0)
ON DUPLICATE KEY
UPDATE ip=IF(ip>0 AND device_mac=rad_dev_mac AND device_port=rad_port, ip, INET_ATON(usr_ip)),
uid=0, device_mac=rad_dev_mac, device_port=rad_port, time=UNIX_TIMESTAMP();
COMMIT;
SELECT INET_NTOA(ip) INTO usr_ip FROM mac_uid
WHERE mac=rad_mac AND device_mac=rad_dev_mac AND device_port=rad_port;
END IF;
SELECT NULL, login, 'Framed-IP-Address', usr_ip, '=';
END$$
DELIMITER ;
ip получаю с пула по тегу все хорошо, функцию
get_ip_by_tag использую от сюда
h//p://nodeny.com.ua/wiki/index.php/%D0%92%D1%8B%D0%B4%D0%B0%D1%87%D0%B0_ip_%D0%B2_%D0%B7%D0%B0%D0%B2%D0%B8%D1%81%D0%B8%D0%BC%D0%BE%D1%81%D1%82%D0%B8_%D0%BE%D1%82_%D1%82%D0%BE%D0%B3%D0%BE,_%D0%BA_%D0%BA%D0%B0%D0%BA%D0%BE%D0%BC%D1%83_NAS_%D0%BF%D0%BE%D0%B4%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD_%D0%B0%D0%B1%D0%BE%D0%BD%D0%B5%D0%BD%D1%82
Efendy можно в кратце логику работы radreply, поддерживающее "один на порту" последнее что вы дали, а то я не все понимаю и возможно что-то упущу при тестировании в сети, хотелось бы все ситуации проверить.
Radius call radupdate_ipoe
(28) sql: EXPAND call radupdate_ipoe('%{User-Name}','%{Framed-IP-Address}','nas=%{NAS-IP-Address}','%{NAS-Identifier}')
(28) sql: --> call radupdate_ipoe('ec086bd996e7-0012cf7ef380-21','10.194.13.129','nas=172.19.0.12','accel-ppp-ipoe')
radupdate_ipoe
DELIMITER $$
CREATE DEFINER=`nodeny`@`%` PROCEDURE `radupdate_ipoe`(IN login VARCHAR(64), IN ipa VARCHAR(16),
IN properties VARCHAR(255), tag VARCHAR(64))
BEGIN
DECLARE rad_mac VARCHAR(12);
DECLARE rad_dev_mac VARCHAR(12);
DECLARE rad_port VARCHAR(6);
DECLARE usr_id INT;
DECLARE usr_ip VARCHAR(15);
SELECT SUBSTRING_INDEX(login, '-', 1) INTO rad_mac;
SELECT SUBSTRING_INDEX(login, '-', -1) INTO rad_port;
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(login, '-', 2), '-', -1) INTO rad_dev_mac;
SELECT uid INTO usr_id FROM mac_uid
WHERE device_mac=rad_dev_mac AND device_port=rad_port
AND (mac=rad_mac OR (oneconnect>0 AND device_mac<>''))
LIMIT 1;
IF usr_id IS NULL
THEN
SELECT ip INTO usr_ip;
ELSE
SELECT get_ip_by_tag(usr_id, tag) INTO usr_ip;
END IF;
CALL set_auth(usr_ip, CONCAT('mod=dhcp;user=', rad_mac, ';', 'dev=', rad_dev_mac, ';', 'port=', rad_port, ';', REPLACE(properties,':','')));
UPDATE mac_uid SET time=UNIX_TIMESTAMP() WHERE ip=INET_ATON(ipa) LIMIT 1;
END$$
DELIMITER ;
radupdate_ipoe отрабатывает успешно, но не уверен что сделана она по логике биллинга гляньте пожалуйста.