If statement for two different sql queries

Giedrius Baronas g.baronas at gmail.com
Mon Oct 11 20:04:58 CEST 2021


 Hi,
I will try to describe it more precisely. If radius receives a packet with
radius attribute "ADSL-Agent-Circuit-Id" then I need to use a sql1
instance. In the else statement I need it to use sql2 instance.
How can I set sql instances ?

/usr/local/etc/raddb/sites-enabled/default

authorize {
(...)
        if(ADSL-Agent-Circuit-Id) {
        if(ADSL-Agent-Circuit-Id =~ /.+\..+\..+\..+/) {
            update request {
                (instance sql1)
            }
        }else{
            update request {
                 (instance sql2)
            }
        }
   }

sql sql1 {
          ...
}
sql sql2 {
          ...
}


Pagarbiai,
Giedrius


2021-10-11, pr, 01:11 Alan DeKok <aland at deployingradius.com> rašė:

> On Oct 10, 2021, at 5:15 PM, Giedrius Baronas <g.baronas at gmail.com> wrote:
> >
> > I need help to split it radreply to two different queries.
>
>   To do... what?
>
> > I have a two different queries:DHCP message and ARP message
> > For examples
> > ARP query
> > (1) Received Access-Request Id 93 from 10.10.10.2:64387 to
> 10.10.10.3:1812
> > (1)   User-Name = "d4:ca:6d:0a:94:5b"
> > (1)   User-Password = "password"
>
>   That's not an ARP query.  I don't know what it is, but it's something
> magic (and non-standard) created by the NAS.
>
> > DHCP query
> > (2) Received Access-Request Id 94 from 10.10.10.2:54337 to
> 10.10.10.3:1812
> > (2)   User-Name = "d4:ca:6d:0a:94:5b"
> > (2)   User-Password = "password"
>
>   That's not DHCP.  That's just a normal RADIUS packet.
>
> > I wrote IF statement in default file authorize section
>
>   To do... what?
>
> > I think I will use multiple instances for different rad_replay queries.
> Is
> > this a bad idea?
> > Is it possible to create just two queries.conf files with different
> queries?
>
>   I have no idea what you're trying to do.  Please explain in more detail.
>
>   Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html


More information about the Freeradius-Users mailing list