radius proxy patch
Deon van der Merwe <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
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 */
}
}
}
}