+ 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)
+ LOG(1, s, session[s].tunnel, "Error, No tunnel_assignment_id \n");
+ else if (ptunnelrlns[idtag].tunnel_server_endpoint == ntohl(config->bind_address))
+ LOG(0, s, session[s].tunnel, "Error, IP Remote LNS == IP local bind address (%s) !!!\n", fmtaddr(config->bind_address, 0));
+ else
+ {
+ for (idrlns = 1; idrlns < MAXRLNSTUNNEL; ++idrlns)
+ {
+ if (pconfigrlns[idrlns].state == CONFRLNSFREE)
+ {
+ pconfigrlns[idrlns].ip = ptunnelrlns[idtag].tunnel_server_endpoint;
+ pconfigrlns[idrlns].port = L2TPPORT; //Default L2TP port
+ strcpy(pconfigrlns[idrlns].l2tp_secret, ptunnelrlns[idtag].tunnel_password);
+ strcpy(pconfigrlns[idrlns].tunnel_assignment_id, ptunnelrlns[idtag].tunnel_assignment_id);