Re: radius proxy patch
Stipe Tolj <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Organization | The Kannel Group |
| Message-ID | <[email protected]> |
Deon van der Merwe wrote:
> Hi,
>
> We would like to share this change that we made to
> radius/radius_acct.c. We had the problem that sometimes the real
> RADIUS server's response gets lost. This change basically adds a
> 40millisecond wait for the response... has been running on our live
> system for 2 days now...
>
> // make the client socket non-blocking
> fl = fcntl(cs, F_GETFL);
> fcntl(cs, F_SETFL, fl | O_NONBLOCK);
>
> if ((remote_host != NULL) && forward) {
> if (udp_sendto(cs, data, addr) == -1) {
> error(0, "RADIUS: Couldn't send to remote RADIUS <%s:%ld>.",
> octstr_get_cstr(remote_host), remote_port);
> } else {
> if (read_available(cs, 40000) < 1) {
> error(0, "RADIUS: timeout waiting for response from
> remote RADIUS <%s:%d>.",
> octstr_get_cstr(remote_host), remote_port);
> } else {
> if (udp_recvfrom(cs, &data, &from_radius) == -1) {
> error(0, "RADIUS: Couldn't receive from remote
> RADIUS <%s:%ld>.",
> octstr_get_cstr(remote_host), remote_port);
> } else {
> info(0, "RADIUS: Got data from remote RADIUS <%s:%d>.",
> octstr_get_cstr(udp_get_ip(from_radius)),
> udp_get_port(from_radius));
> octstr_dump(data, 0);
>
> /* XXX unpack the response PDU and check if the response
> * authenticator is valid */
> }
> }
> }
> }
++1, this solves the blocking problem.
Commited in a slightly variation to CVS, including 'remote-timeout' config
directive for 'radius-acct' config goup.
ChangeLog:
2005-12-07 Stipe Tolj <stolj at kannel.org>
* doc/userguide/userguide.xml: add new 'remote-timeout' directive to RADIUS
accounting proxy section.
* gwlib/cfg.def: adding 'remote-timout' to 'radius-acct' group.
* radius/radius_acct.c: fixing blocking state if remote RADIUS does not
answer within pre-defined timeout. This ensures that the proxy operation
continues. Thanks to Deon van der Merwe <[email protected]> for
this fix and included patch.
[Msg-Id: <[email protected]]
Thanks a lot!
@Deon: if you have time for the XXX, go ahead ;)
Stipe
mailto:stolj_{at}_wapme-group.de
-------------------------------------------------------------------
Wapme Systems AG
Vogelsanger Weg 80
40470 Düsseldorf, NRW, Germany
phone: +49.211.74845.0
fax: +49.211.74845.299
mailto:info_{at}_wapme-systems.de
http://www.wapme-systems.de/
-------------------------------------------------------------------