Thanks Stefan, I just add a conditional before to check if it's a mpd NAS: if ("%{client:shortname}" == 'mpd-nas') { if ("%{sql:SELECT Value FROM radreply WHERE Username = %{User-Name} and attribute='Mikrotik-Rate-Limit'}" =~ /regex/) { update reply { mpd-limit := "in#1=all ..." mpd-limit += "out#1=all ..." } } } Is it ok? Thanks! :) On Wed, Jul 22, 2015 at 10:30 AM, Stefan Paetow <Stefan.Paetow@jisc.ac.uk> wrote:
I have the following value in Mikrotik-Rate-Limit:
2048k/2048k 384k/384k 768k/768k 100/100 8 0K/0K
And this is the two values to mpd-limit reply:
in#1=all rate-limit 2048000 384000 768000 pass out#1=all rate-limit 2048000 384000 768000 pass
I'd use a regex of some sort and then add the mpd-limit attributes:
if ("%{sql:SELECT Value FROM radreply WHERE Username = %{User-Name} and attribute='Mikrotik-Rate-Limit'}" =~ /regex-to-pull-values-from-Mikrotik-attribute-here/) { update reply { mpd-limit := "in#1=all ..." mpd-limit += "out#1=all ..." } }
Or, store them in the radreply table like the Mikrotik-Rate-Limit value:
| User-Name | Mikrotik-Rate-Limit | = | 2048k/2048k 384k/384k 768k/768k 100/100 8 0K/0K | | User-Name | mpd-limit | += | in#1=all rate-limit 2048000 384000 768000 pass | | User-Name | mpd-limit | += | out#1=all rate-limit 2048000 384000 768000 pass |
;-)
Stefan Paetow Moonshot Industry & Research Liaison Coordinator
t: +44 (0)1235 822 125 gpg: 0x3FCE5142 xmpp: stefanp@jabber.dev.ja.net skype: stefan.paetow.janet Lumen House, Library Avenue, Harwell Oxford, Didcot, OX11 0SG
jisc.ac.uk
Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800. Jisc Collections and Janet Ltd. is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under Company No. number 2881024, VAT No. GB 197 0632 86. The registered office is: Lumen House, Library Avenue, Harwell, Didcot, Oxfordshire, OX11 0SG. T 01235 822200.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html