version 1.1.1.2, 2013/07/22 08:44:29
|
version 1.1.1.3, 2016/11/01 09:56:12
|
Line 8
|
Line 8
|
#include "ppp.h" |
#include "ppp.h" |
#include "radsrv.h" |
#include "radsrv.h" |
#include "util.h" |
#include "util.h" |
|
#include <stdint.h> |
#include <radlib.h> |
#include <radlib.h> |
#include <radlib_vs.h> |
#include <radlib_vs.h> |
|
|
Line 97 RadsrvEvent(int type, void *cookie)
|
Line 98 RadsrvEvent(int type, void *cookie)
|
char *username = NULL, *called = NULL, *calling = NULL, *sesid = NULL; |
char *username = NULL, *called = NULL, *calling = NULL, *sesid = NULL; |
char *msesid = NULL, *link = NULL, *bundle = NULL, *iface = NULL; |
char *msesid = NULL, *link = NULL, *bundle = NULL, *iface = NULL; |
int nasport = -1, serv_type = 0, ifindex = -1, i; |
int nasport = -1, serv_type = 0, ifindex = -1, i; |
u_int session_timeout = -1, idle_timeout = -1, acct_update = -1; | u_int session_timeout = UINT_MAX, idle_timeout = UINT_MAX; |
struct in_addr ip = { -1 }; | u_int acct_update = UINT_MAX; |
struct in_addr nas_ip = { -1 }; | struct in_addr ip = { INADDR_BROADCAST }; |
| struct in_addr nas_ip = { INADDR_BROADCAST }; |
char buf[64]; |
char buf[64]; |
u_int32_t vendor; |
u_int32_t vendor; |
u_char *state = NULL, *rad_class = NULL; |
u_char *state = NULL, *rad_class = NULL; |
Line 230 RadsrvEvent(int type, void *cookie)
|
Line 232 RadsrvEvent(int type, void *cookie)
|
ip = rad_cvt_addr(data); |
ip = rad_cvt_addr(data); |
Log(LG_RADIUS2, ("radsrv: Got RAD_FRAMED_IP_ADDRESS: %s", |
Log(LG_RADIUS2, ("radsrv: Got RAD_FRAMED_IP_ADDRESS: %s", |
inet_ntoa(ip))); |
inet_ntoa(ip))); |
|
if (ip.s_addr == INADDR_BROADCAST) |
|
Log(LG_ERR, ("radsrv: incorrect Framed-IP-Address")); |
break; |
break; |
case RAD_NAS_PORT: |
case RAD_NAS_PORT: |
anysesid = 1; |
anysesid = 1; |
Line 439 RadsrvEvent(int type, void *cookie)
|
Line 443 RadsrvEvent(int type, void *cookie)
|
} |
} |
} |
} |
err = 0; |
err = 0; |
if (w->addr.u.ip4.s_addr != 0 && nas_ip.s_addr != -1 && w->addr.u.ip4.s_addr != nas_ip.s_addr) { | if (w->addr.u.ip4.s_addr != 0 && nas_ip.s_addr != INADDR_BROADCAST |
| && w->addr.u.ip4.s_addr != nas_ip.s_addr) { |
Log(LG_ERR, ("radsrv: incorrect NAS-IP-Address")); |
Log(LG_ERR, ("radsrv: incorrect NAS-IP-Address")); |
err = 403; |
err = 403; |
} else if (anysesid == 0) { |
} else if (anysesid == 0) { |
Line 487 RadsrvEvent(int type, void *cookie)
|
Line 492 RadsrvEvent(int type, void *cookie)
|
continue; |
continue; |
if (iface && (!B || strcmp(iface, B->iface.ifname))) |
if (iface && (!B || strcmp(iface, B->iface.ifname))) |
continue; |
continue; |
if (ifindex >= 0 && (!B || ifindex != B->iface.ifindex)) | if (ifindex >= 0 && (!B || (uint)ifindex != B->iface.ifindex)) |
continue; |
continue; |
if (ip.s_addr != -1 && (!B || | if (ip.s_addr != INADDR_BROADCAST && (!B || |
ip.s_addr != B->iface.peer_addr.u.ip4.s_addr)) |
ip.s_addr != B->iface.peer_addr.u.ip4.s_addr)) |
continue; |
continue; |
|
|
Line 546 RadsrvEvent(int type, void *cookie)
|
Line 551 RadsrvEvent(int type, void *cookie)
|
strcpy(L->lcp.auth.params.std_acct[0], std_acct[0]); |
strcpy(L->lcp.auth.params.std_acct[0], std_acct[0]); |
strcpy(L->lcp.auth.params.std_acct[1], std_acct[1]); |
strcpy(L->lcp.auth.params.std_acct[1], std_acct[1]); |
#endif |
#endif |
if (session_timeout != -1) | if (session_timeout != UINT_MAX) |
L->lcp.auth.params.session_timeout = session_timeout; |
L->lcp.auth.params.session_timeout = session_timeout; |
if (idle_timeout != -1) | if (idle_timeout != UINT_MAX) |
L->lcp.auth.params.idle_timeout = idle_timeout; |
L->lcp.auth.params.idle_timeout = idle_timeout; |
if (acct_update != -1) { | if (acct_update != UINT_MAX) { |
L->lcp.auth.params.acct_update = acct_update; |
L->lcp.auth.params.acct_update = acct_update; |
/* Stop accounting update timer if running. */ |
/* Stop accounting update timer if running. */ |
TimerStop(&L->lcp.auth.acct_timer); |
TimerStop(&L->lcp.auth.acct_timer); |