From: bodea Date: Wed, 2 Aug 2006 14:17:20 +0000 (+0000) Subject: allow DNS servers to be specified using either old or new vendor-specific Ascend... X-Git-Tag: release_2_1_20 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/d5a8182952d802b7844e8caf290a096ded9a00bd?ds=inline;hp=58e4b6528a085aead9d73428327767f064367411 allow DNS servers to be specified using either old or new vendor-specific Ascend formats --- diff --git a/Changes b/Changes index df439df..ee938a7 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ -* Wed Aug 2 2006 Brendan O'Dea 2.1.20 +* Thu Aug 3 2006 Brendan O'Dea 2.1.20 - Fix sign problem with reporting of unknown VSAs. +- Allow DNS servers to be specified either using the old or new + vendor-specific Ascend formats. * Fri Jun 23 2006 Brendan O'Dea 2.1.19 - Kludge around problem with Netgear DM602 authentication. diff --git a/l2tpns.spec b/l2tpns.spec index b2ee66a..3ed4c39 100644 --- a/l2tpns.spec +++ b/l2tpns.spec @@ -43,5 +43,5 @@ rm -rf %{buildroot} %attr(644,root,root) /usr/share/man/man[58]/* %changelog -* Wed Aug 2 2006 Brendan O'Dea 2.1.20-1 +* Thu Aug 3 2006 Brendan O'Dea 2.1.20-1 - 2.1.20 release, see /usr/share/doc/l2tpns-2.1.20/Changes diff --git a/radius.c b/radius.c index 3976bb7..8a39894 100644 --- a/radius.c +++ b/radius.c @@ -1,6 +1,6 @@ // L2TPNS Radius Stuff -char const *cvs_id_radius = "$Id: radius.c,v 1.49.2.1 2006/08/02 12:51:25 bodea Exp $"; +char const *cvs_id_radius = "$Id: radius.c,v 1.49.2.2 2006/08/02 14:17:20 bodea Exp $"; #include #include @@ -573,6 +573,35 @@ void processrad(uint8_t *buf, int len, char socket_index) uint8_t *e = buf + len; for (; p + 2 <= e && p[1] && p + p[1] <= e; p += p[1]) { + if (*p == 26 && p[1] >= 7) + { + // Vendor-Specific Attribute + uint32_t vendor = ntohl(*(int *)(p + 2)); + uint8_t attrib = *(p + 6); + int attrib_length = *(p + 7) - 2; + + LOG(4, s, session[s].tunnel, " Radius reply contains Vendor-Specific. Vendor=%u Attrib=%u Length=%d\n", vendor, attrib, attrib_length); + if (vendor == 9 && attrib == 1) // Cisco-AVPair + { + if (attrib_length < 0) continue; + LOG(3, s, session[s].tunnel, " Cisco-AVPair value: %.*s\n", + attrib_length, p + 8); + + handle_avpair(s, p + 8, attrib_length); + continue; + } + else if (vendor == 529 && attrib >= 135 && attrib <= 136) // Ascend + { + // handle old-format ascend DNS attributes below + p += 6; + } + else + { + LOG(3, s, session[s].tunnel, " Unknown vendor-specific\n"); + continue; + } + } + if (*p == 8) { // Framed-IP-Address @@ -686,28 +715,6 @@ void processrad(uint8_t *buf, int len, char socket_index) ip_filters[f].used++; } } - else if (*p == 26 && p[1] >= 7) - { - // Vendor-Specific Attribute - uint32_t vendor = ntohl(*(int *)(p + 2)); - uint8_t attrib = *(p + 6); - int attrib_length = *(p + 7) - 2; - - LOG(3, s, session[s].tunnel, " Radius reply contains Vendor-Specific. Vendor=%u Attrib=%u Length=%d\n", vendor, attrib, attrib_length); - if (vendor != 9 || attrib != 1) - { - LOG(3, s, session[s].tunnel, " Unknown vendor-specific\n"); - continue; - } - - if (attrib_length > 0) - { - LOG(3, s, session[s].tunnel, " Cisco-AVPair value: %.*s\n", - attrib_length, p + 8); - - handle_avpair(s, p + 8, attrib_length); - } - } else if (*p == 99) { // Framed-IPv6-Route