X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/f3330037865c0bef6e1e63d32d87cfc8c1954eb6..6ec70a632b2b7902778f8fe1d6cf0fe2a54cffe6:/radius.c?ds=sidebyside diff --git a/radius.c b/radius.c index 0059fcc..8c7bf64 100644 --- a/radius.c +++ b/radius.c @@ -1,6 +1,6 @@ // L2TPNS Radius Stuff -char const *cvs_id_radius = "$Id: radius.c,v 1.43 2005/10/11 02:27:40 foonly Exp $"; +char const *cvs_id_radius = "$Id: radius.c,v 1.46 2005/12/09 00:43:17 bodea Exp $"; #include #include @@ -306,16 +306,9 @@ void radiussend(uint16_t r, uint8_t state) p += p[1]; } - if (session[s].snoop_ip && session[s].snoop_port) { - *p = 26; // vendor-specific - *(uint32_t *) (p + 2) = htonl(9); // Cisco - p[6] = 1; // Cisco-AVPair - p[7] = 2 + sprintf((char *) p + 8, "intercept=%s:%d", - fmtaddr(session[s].snoop_ip, 0), session[s].snoop_port); - - p[1] = p[7] + 6; - p += p[1]; + struct param_radius_account acct = { &tunnel[session[s].tunnel], &session[s], &p }; + run_plugins(PLUGIN_RADIUS_ACCOUNT, &acct); } } } @@ -333,6 +326,30 @@ void radiussend(uint16_t r, uint8_t state) *(uint32_t *) (p + 2) = htonl(session[s].ip); p += p[1]; } + if (s && session[s].route[0].ip) + { + int r; + for (r = 0; s && r < MAXROUTE && session[s].route[r].ip; r++) + { + int width = 32; + if (session[s].route[r].mask) + { + int mask = session[s].route[r].mask; + while (!(mask & 1)) + { + width--; + mask >>= 1; + } + } + + *p = 22; // Framed-Route + p[1] = sprintf((char *) p + 2, "%s/%d %s 1", + fmtaddr(htonl(session[s].route[r].ip), 0), + width, fmtaddr(htonl(session[s].ip), 1)) + 2; + + p += p[1]; + } + } if (*session[s].called) { *p = 30; // called