+ ptunnelrlns[tag].tunnel_server_endpoint = ntohl(inet_addr(tunnel_server_endpoint));
+ }
+}
+
+// Add tunnel_password Radius TAG tunnel to context
+void lac_set_rad_tag_tunnel_password(uint8_t tag, char *tunnel_password)
+{
+ if ((tag < MAXTAGTUNNEL) && (strlen(tunnel_password) < 64))
+ {
+ strcpy(ptunnelrlns[tag].tunnel_password, tunnel_password);
+ }
+}
+
+// Add tunnel_assignment_id Radius TAG tunnel to context
+void lac_set_rad_tag_tunnel_assignment_id(uint8_t tag, char *tunnel_assignment_id)
+{
+ if ((tag < MAXTAGTUNNEL) && (strlen(tunnel_assignment_id) < 256))
+ {
+ strcpy(ptunnelrlns[tag].tunnel_assignment_id, tunnel_assignment_id);
+ }
+}
+
+// Select a tunnel_assignment_id
+int lac_rad_select_assignment_id(sessionidt s, char *assignment_id)
+{
+ int idtag;
+ int nbtagfound = 0;
+ int bufidtag[MAXTAGTUNNEL];
+
+ for (idtag = 0; idtag < MAXTAGTUNNEL; ++idtag)
+ {
+ if (ptunnelrlns[idtag].tunnel_type == 0)
+ continue;
+ else if (ptunnelrlns[idtag].tunnel_type != 3) // 3 == L2TP tunnel type
+ LOG(1, s, session[s].tunnel, "Error, Only L2TP tunnel type supported\n");
+ else if (ptunnelrlns[idtag].tunnel_medium_type != 1)
+ LOG(1, s, session[s].tunnel, "Error, Only IP tunnel medium type supported\n");
+ else if (ptunnelrlns[idtag].tunnel_server_endpoint == 0)
+ LOG(1, s, session[s].tunnel, "Error, Bad IP tunnel server endpoint \n");
+ else if (strlen(ptunnelrlns[idtag].tunnel_assignment_id) > 0)