Nas-Ip-Address attribute and source IP address of UDP datagram.

Dmitry V. Krivenok krivenok at orangesystem.ru
Thu Jan 22 17:01:38 CET 2009


Alan DeKok wrote:
> Dmitry V. Krivenok wrote:
>   
>> I deal with bad "hand-made" NAS, which doesn't include "Nas-Ip-Address"
>> attribute into the packet.
>> So I can't distinguish packets from different NAS'es.
>>     
>
>   Look at Packet-Src-IP-Address.  It is a "virtual" attribute that you
> can use in dynamic expansions.
>
>   
>> Is there a way to add this attribute (with value of source address of
>> UDP datagram) using standard FreeRadius facilities?
>> We don't use proxies, so this solution seems to be correct.
>>     
>
> 	if (!NAS-IP-Address) {
> 		update request {
> 			NAS-IP-Address = "%{Packet-Src-IP-Address}"
> 		}
> 	}
>   

It looks cool.
Where can I use this code?
In authorize section?

>   
>> I'm writing my own rlm and I can implement desired functionality if
>> there is no one in FreeRadius.
>> The problem lies in that I can't find the address of client in REQUEST
>> (i.e.  auth_req) structure.
>>     
>
>   request->packet->src_ipaddr.
>   
request->client->ipaddr seems to be what I need.
I tested via the following command:
DEBUG("rlm_osb: Source IP address %s.", 
inet_ntoa(request->client->ipaddr.ipaddr.ip4addr));

Is it correct to use request->client->ipaddr instead of 
request->packet->src_ipaddr?

>   Alan Dekok.
>   


-- 
Sincerely yours, Dmitry V. Krivenok
Orange System Co., Ltd.
Saint-Petersburg, Russia
work phone: +7 812 332-32-40
cellular phone: +7 921 576-70-91
e-mail: krivenok at orangesystem.ru
web: http://www.orangesystem.ru
skype: krivenok_dmitry
jabber: krivenok_dmitry at jabber.ru
icq: 242-526-443




More information about the Freeradius-Users mailing list