#include <ctype.h>
#include <netinet/in.h>
#include <errno.h>
+#include <linux/rtnetlink.h>
#include "md5.h"
#include "constants.h"
+#include "dhcp6.h"
#include "l2tpns.h"
#include "plugin.h"
#include "util.h"
run_plugins(PLUGIN_POST_AUTH, &packet);
r_code = packet.auth_allowed ? AccessAccept : AccessReject;
-#ifndef LAC
- // process auth response
- if (radius[r].chap)
- {
- // CHAP
- uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPCHAP, 0, 0, 0);
- if (!p) return; // Abort!
-
- *p = (r_code == AccessAccept) ? 3 : 4; // ack/nak
- p[1] = radius[r].id;
- *(uint16_t *) (p + 2) = ntohs(4); // no message
- tunnelsend(b, (p - b) + 4, t); // send it
-
- LOG(3, s, session[s].tunnel, " CHAP User %s authentication %s.\n", session[s].user,
- (r_code == AccessAccept) ? "allowed" : "denied");
- }
- else
- {
- // PAP
- uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPPAP, 0, 0, 0);
- if (!p) return; // Abort!
-
- // ack/nak
- *p = r_code;
- p[1] = radius[r].id;
- *(uint16_t *) (p + 2) = ntohs(5);
- p[4] = 0; // no message
- tunnelsend(b, (p - b) + 5, t); // send it
-
- LOG(3, s, session[s].tunnel, " PAP User %s authentication %s.\n", session[s].user,
- (r_code == AccessAccept) ? "allowed" : "denied");
- }
-#endif
-
if (r_code == AccessAccept)
{
// Login successful
else if (vendor == 529 && attrib >= 135 && attrib <= 136) // Ascend
{
// handle old-format ascend DNS attributes below
- p += 6;
+ p += 6;
+ }
+ else if (vendor == 64520) // Sames
+ {
+ //Sames vendor-specific 64520
+ uint8_t *pvs = p + 6; // pvs set to begin to attribute
+ LOG(3, s, session[s].tunnel, " Sames vendor-specific: %d, Attrib: %d, lenght: %d\n", vendor, attrib, attrib_length);
+ grp_processvendorspecific(s, pvs);
+ continue;
}
else
{
- LOG(3, s, session[s].tunnel, " Unknown vendor-specific\n");
+ LOG(3, s, session[s].tunnel, " Unknown vendor-specific: %d, Attrib: %d\n", vendor, attrib);
continue;
}
}
int prefixlen;
uint8_t *n = p + 2;
uint8_t *e = p + p[1];
- uint8_t *m = memchr(n, '/', e - p);
+ uint8_t *m = memchr(n, '/', e - n);
*m++ = 0;
inet_pton(AF_INET6, (char *) n, &r6);
session[s].ipv6prefixlen = prefixlen;
}
}
+ else if (*p == 123)
+ {
+ // Delegated-IPv6-Prefix
+ 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);
+ }
+ }
+ else if (*p == 168)
+ {
+ // Framed-IPv6-Address
+ if (p[1] == 18)
+ {
+ char ipv6addr[INET6_ADDRSTRLEN];
+ memcpy(&session[s].ipv6address, &p[2], 16);
+ LOG(3, s, session[s].tunnel, " Radius reply contains Framed-IPv6-Address %s\n", inet_ntop(AF_INET6, &session[s].ipv6address, ipv6addr, INET6_ADDRSTRLEN));
+ }
+ }
else if (*p == 25)
{
// Class