+#ifdef LAC
+ else if (*p == 64)
+ {
+ // Tunnel-Type
+ if (p[1] != 6) continue;
+ tag = p[2];
+ LOG(3, s, session[s].tunnel, " Radius reply Tunnel-Type:%d %d\n",
+ tag, ntohl(*(uint32_t *)(p + 2)) & 0xFFFFFF);
+ // Fill context
+ lac_set_rad_tag_tunnel_type(tag, ntohl(*(uint32_t *)(p + 2)) & 0xFFFFFF);
+ /* Request open tunnel to remote LNS*/
+ OpentunnelReq = 1;
+ }
+ else if (*p == 65)
+ {
+ // Tunnel-Medium-Type
+ if (p[1] < 6) continue;
+ tag = p[2];
+ LOG(3, s, session[s].tunnel, " Radius reply Tunnel-Medium-Type:%d %d\n",
+ tag, ntohl(*(uint32_t *)(p + 2)) & 0xFFFFFF);
+ // Fill context
+ lac_set_rad_tag_tunnel_medium_type(tag, ntohl(*(uint32_t *)(p + 2)) & 0xFFFFFF);
+ }
+ else if (*p == 67)
+ {
+ // Tunnel-Server-Endpoint
+ if (p[1] < 3) continue;
+ tag = p[2];
+ //If the Tag field is greater than 0x1F,
+ // it SHOULD be interpreted as the first byte of the following String field.
+ memset(strtemp, 0, 256);
+ if (tag > 0x1F)
+ {
+ tag = 0;
+ memcpy(strtemp, (p + 2), p[1]-2);
+ }
+ else
+ memcpy(strtemp, (p + 3), p[1]-3);
+
+ LOG(3, s, session[s].tunnel, " Radius reply Tunnel-Server-Endpoint:%d %s\n", tag, strtemp);
+ // Fill context
+ lac_set_rad_tag_tunnel_serv_endpt(tag, (char *) strtemp);
+ }
+ else if (*p == 69)
+ {
+ // Tunnel-Password
+ size_t lentemp;
+
+ if (p[1] < 5) continue;
+ tag = p[2];
+
+ memset(strtemp, 0, 256);
+ lentemp = p[1]-3;
+ memcpy(strtemp, (p + 3), lentemp);
+ if (!rad_tunnel_pwdecode(strtemp, &lentemp, config->radiussecret, radius[r].auth))
+ {
+ LOG_HEX(3, "Error Decode Tunnel-Password, Dump Radius reponse:", p, p[1]);
+ continue;
+ }
+
+ LOG(3, s, session[s].tunnel, " Radius reply Tunnel-Password:%d %s\n", tag, strtemp);
+ if (strlen((char *) strtemp) > 63)
+ {
+ LOG(1, s, session[s].tunnel, "tunnel password is too long (>63)\n");
+ continue;
+ }
+ // Fill context
+ lac_set_rad_tag_tunnel_password(tag, (char *) strtemp);
+ }
+ else if (*p == 82)
+ {
+ // Tunnel-Assignment-Id
+ if (p[1] < 3) continue;
+ tag = p[2];
+ //If the Tag field is greater than 0x1F,
+ // it SHOULD be interpreted as the first byte of the following String field.
+ memset(strtemp, 0, 256);
+ if (tag > 0x1F)
+ {
+ tag = 0;
+ memcpy(strtemp, (p + 2), p[1]-2);
+ }
+ else
+ memcpy(strtemp, (p + 3), p[1]-3);
+
+ LOG(3, s, session[s].tunnel, " Radius reply Tunnel-Assignment-Id:%d %s\n", tag, strtemp);
+ // Fill context
+ lac_set_rad_tag_tunnel_assignment_id(tag, (char *) strtemp);
+ }
+#endif