Fix: last_packet no updated in cluster mode
This commit is contained in:
parent
5111b3ae58
commit
699dd8b571
4 changed files with 20 additions and 5 deletions
2
Makefile
2
Makefile
|
|
@ -129,7 +129,7 @@ radius.o: radius.c md5.h constants.h l2tpns.h plugin.h util.h cluster.h \
|
|||
tbf.o: tbf.c l2tpns.h util.h tbf.h
|
||||
util.o: util.c l2tpns.h bgp.h
|
||||
bgp.o: bgp.c l2tpns.h bgp.h util.h
|
||||
l2tplac.o: l2tplac.c md5.h l2tpns.h util.h l2tplac.h
|
||||
l2tplac.o: l2tplac.c md5.h l2tpns.h util.h cluster.h l2tplac.h
|
||||
autosnoop.so: autosnoop.c l2tpns.h plugin.h
|
||||
autothrottle.so: autothrottle.c l2tpns.h plugin.h
|
||||
garden.so: garden.c l2tpns.h plugin.h control.h
|
||||
|
|
|
|||
16
l2tplac.c
16
l2tplac.c
|
|
@ -8,6 +8,7 @@
|
|||
#include "md5.h"
|
||||
#include "l2tpns.h"
|
||||
#include "util.h"
|
||||
#include "cluster.h"
|
||||
|
||||
#include "l2tplac.h"
|
||||
|
||||
|
|
@ -444,7 +445,7 @@ void lac_calc_rlns_auth(tunnelidt t, uint8_t id, uint8_t *out)
|
|||
}
|
||||
|
||||
// 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
|
||||
|
|
@ -469,6 +470,19 @@ int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ typedef uint16_t confrlnsidt;
|
|||
|
||||
// l2tplac.c
|
||||
void lac_initremotelnsdata();
|
||||
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);
|
||||
int lac_conf_forwardtoremotelns(sessionidt s, char * puser);
|
||||
void lac_calc_rlns_auth(tunnelidt t, uint8_t id, uint8_t *out);
|
||||
int lac_addremotelns(char *mask, char *IP_RemoteLNS, char *Port_RemoteLNS, char *SecretRemoteLNS);
|
||||
|
|
|
|||
5
l2tpns.c
5
l2tpns.c
|
|
@ -258,7 +258,8 @@ static clockt now(double *f)
|
|||
}
|
||||
|
||||
// Time in milliseconds
|
||||
time_now_ms = (t.tv_sec * 1000) + (t.tv_usec/1000);
|
||||
// TODO FOR MLPPP DEV
|
||||
//time_now_ms = (t.tv_sec * 1000) + (t.tv_usec/1000);
|
||||
|
||||
return (t.tv_sec - basetime) * 10 + t.tv_usec / 100000 + 1;
|
||||
}
|
||||
|
|
@ -3224,7 +3225,7 @@ void processudp(uint8_t *buf, int len, struct sockaddr_in *addr)
|
|||
{
|
||||
LOG(5, s, t, "Forwarding data session to session %u\n", session[s].forwardtosession);
|
||||
// Forward to LAC or Remote LNS session
|
||||
lac_session_forward(buf, len, s, proto);
|
||||
lac_session_forward(buf, len, s, proto, addr->sin_addr.s_addr, addr->sin_port);
|
||||
return;
|
||||
}
|
||||
#endif /* LAC */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue