#include "md5.h"
#include "l2tpns.h"
#include "util.h"
+#include "cluster.h"
#include "l2tplac.h"
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 poart
+ 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);
}
// Forward session to LAC or Remote LNS
-int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto)
+int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto, in_addr_t s_addr, int sin_port)
{
uint16_t t = 0, s = 0;
uint8_t *p = buf + 2; // First word L2TP options
return 0;
}
+ if (!config->cluster_iam_master)
+ {
+ if ( (proto == PPPIPCP) || (proto == PPPLCP) ||
+ (proto == PPPPAP) || (proto == PPPCHAP) ||
+ (proto == PPPIPV6CP && config->ipv6_prefix.s6_addr[0]) ||
+ (proto == PPPCCP) )
+ {
+ session[sess].last_packet = time_now;
+ master_forward_packet(buf, len, s_addr, sin_port);
+ return 1;
+ }
+ }
+
if (*buf & 0x40)
{ // length
p += 2;