projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update Changelog
[l2tpns.git]
/
l2tplac.c
diff --git
a/l2tplac.c
b/l2tplac.c
index
281bbc4
..
fd3a7e0
100644
(file)
--- a/
l2tplac.c
+++ b/
l2tplac.c
@@
-1,9
+1,14
@@
/*
/*
+ * Fernando ALVES 2013
* Add functionality "LAC" to l2tpns.
* Used to forward a ppp session to another "LNS".
* Add functionality "LAC" to l2tpns.
* Used to forward a ppp session to another "LNS".
+ * GPL licenced
*/
*/
+
#include <errno.h>
#include <string.h>
#include <errno.h>
#include <string.h>
+#include <sys/socket.h>
+#include <linux/rtnetlink.h>
#include "md5.h"
#include "l2tpns.h"
#include "md5.h"
#include "l2tpns.h"
@@
-11,6
+16,7
@@
#include "cluster.h"
#include "l2tplac.h"
#include "cluster.h"
#include "l2tplac.h"
+#include "pppoe.h"
/* sequence diagram: Client <--> LAC <--> LNS1 <--> LNS2
*
/* sequence diagram: Client <--> LAC <--> LNS1 <--> LNS2
*
@@
-291,6
+297,7
@@
static int lac_create_tunnelsession(tunnelidt t, sessionidt s, confrlnsidt i_con
tunnel[t].port = pconfigrlns[i_conf].port;
tunnel[t].window = 4; // default window
tunnel[t].isremotelns = i_conf;
tunnel[t].port = pconfigrlns[i_conf].port;
tunnel[t].window = 4; // default window
tunnel[t].isremotelns = i_conf;
+ tunnel[t].indexudp = config->indexlacudpfd;
STAT(tunnel_created);
random_data(pconfigrlns[i_conf].auth, sizeof(pconfigrlns[i_conf].auth));
STAT(tunnel_created);
random_data(pconfigrlns[i_conf].auth, sizeof(pconfigrlns[i_conf].auth));
@@
-445,7
+452,7
@@
void lac_calc_rlns_auth(tunnelidt t, uint8_t id, uint8_t *out)
}
// Forward session to LAC or Remote LNS
}
// Forward session to LAC or Remote LNS
-int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto, in_addr_t s_addr, int sin_port)
+int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto, in_addr_t s_addr, int sin_port
, uint16_t indexudpfd
)
{
uint16_t t = 0, s = 0;
uint8_t *p = buf + 2; // First word L2TP options
{
uint16_t t = 0, s = 0;
uint8_t *p = buf + 2; // First word L2TP options
@@
-466,7
+473,7
@@
int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto,
if ((!tunnel[t].isremotelns) && (!tunnel[session[sess].tunnel].isremotelns))
{
if ((!tunnel[t].isremotelns) && (!tunnel[session[sess].tunnel].isremotelns))
{
- LOG(0, sess, session[sess].tunnel, "Link Tunnel Session (%u
) broken\n", s
);
+ LOG(0, sess, session[sess].tunnel, "Link Tunnel Session (%u
/%u) broken\n", s, t
);
return 0;
}
return 0;
}
@@
-478,11
+485,17
@@
int lac_session_forward(uint8_t *buf, int len, sessionidt sess, uint16_t proto,
(proto == PPPCCP) )
{
session[sess].last_packet = time_now;
(proto == PPPCCP) )
{
session[sess].last_packet = time_now;
- master_forward_packet(buf, len, s_addr, sin_port);
+ master_forward_packet(buf, len, s_addr, sin_port
, indexudpfd
);
return 1;
}
}
return 1;
}
}
+ if (t == TUNNEL_ID_PPPOE)
+ {
+ pppoe_forwardto_session_pppoe(buf, len, sess, proto);
+ return 1;
+ }
+
if (*buf & 0x40)
{ // length
p += 2;
if (*buf & 0x40)
{ // length
p += 2;