X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/b3f40f41f7de7a383c6f1170e546d0b09cc57338..a222a373d7b01b08f7cb2979d8a0c4c04f0c8e3d:/radius.c?ds=sidebyside diff --git a/radius.c b/radius.c index 76ff390..4eda15f 100644 --- a/radius.c +++ b/radius.c @@ -533,7 +533,8 @@ void processrad(uint8_t *buf, int len, char socket_index) sessionidt s; tunnelidt t = 0; hasht hash; - uint8_t routes = 0; + int routes = 0; + int routes6 = 0; int r_code; int r_id; int OpentunnelReq = 0; @@ -786,11 +787,17 @@ void processrad(uint8_t *buf, int len, char socket_index) if (prefixlen) { - LOG(3, s, session[s].tunnel, - " Radius reply contains route for %s/%d\n", - n, prefixlen); - session[s].ipv6route = r6; - session[s].ipv6prefixlen = prefixlen; + if (routes6 == MAXROUTE6) + { + LOG(1, s, session[s].tunnel, " Too many IPv6 routes\n"); + } + else + { + LOG(3, s, session[s].tunnel, " Radius reply contains route for %s/%d\n", n, prefixlen); + session[s].route6[routes6].ipv6route = r6; + session[s].route6[routes6].ipv6prefixlen = prefixlen; + routes6++; + } } } else if (*p == 123) @@ -799,10 +806,19 @@ void processrad(uint8_t *buf, int len, char socket_index) if ((p[1] > 4) && (p[3] > 0) && (p[3] <= 128)) { char ipv6addr[INET6_ADDRSTRLEN]; - memcpy(&session[s].ipv6route, &p[4], p[1] - 4); - session[s].ipv6prefixlen = p[3]; - LOG(3, s, session[s].tunnel, " Radius reply contains Delegated IPv6 Prefix %s/%d\n", - inet_ntop(AF_INET6, &session[s].ipv6route, ipv6addr, INET6_ADDRSTRLEN), session[s].ipv6prefixlen); + + if (routes6 == MAXROUTE6) + { + LOG(1, s, session[s].tunnel, " Too many IPv6 routes\n"); + } + else + { + memcpy(&session[s].route6[routes6].ipv6route, &p[4], p[1] - 4); + session[s].route6[routes6].ipv6prefixlen = p[3]; + LOG(3, s, session[s].tunnel, " Radius reply contains Delegated IPv6 Prefix %s/%d\n", + inet_ntop(AF_INET6, &session[s].route6[routes6].ipv6route, ipv6addr, INET6_ADDRSTRLEN), session[s].route6[routes6].ipv6prefixlen); + routes6++; + } } } else if (*p == 168)