// L2TPNS PPP Stuff
-char const *cvs_id_ppp = "$Id: ppp.c,v 1.13 2004-08-26 04:44:26 fred_nerk Exp $";
+char const *cvs_id_ppp = "$Id: ppp.c,v 1.17 2004-10-29 04:01:53 bodea Exp $";
#include <stdio.h>
#include <string.h>
}
else if (*p == ConfigReq)
{
+ l = ntohs(*(u16 *)(p + 2));
signed int x = l - 4;
u8 *o = (p + 4);
{
// Send back a ConfigAck
log(3, session[s].ip, s, t, "ConfigReq accepted, sending as Ack\n");
- // for win2k L2TP clientis and LCP renegotiation of alive session
- if (magicno || l == 4) initlcp(t, s);
+ // for win2k L2TP clients and LCP renegotiation of alive session
+ if (magicno || l == 4 || (session[s].mru && l == 8)) initlcp(t, s);
q = makeppp(b, sizeof(b), p, l, t, s, PPPLCP);
if (!q)
{
{
// happy with our IPCP
u16 r = session[s].radius;
- if ((!r || radius[r].state == RADIUSIPCP) && !session[s].walled_garden) {
+ if ((!r || radius[r].state == RADIUSIPCP) && !session[s].walled_garden)
+ {
if (!r)
r = radiusnew(s);
if (r)
{
ipt ip;
-
CSTAT(call_processipin);
log_hex(5, "IP", p, l);
if (session[s].snoop_ip && session[s].snoop_port)
{
- // Snooping this session, send it to ASIO
+ // Snooping this session
snoop_send_packet(p, l, session[s].snoop_ip, session[s].snoop_port);
}
STAT(tun_tx_packets);
log_hex(5, "CCP", p, l);
if (l < 2 || (*p != ConfigReq && *p != TerminateReq))
{
- log(1, 0, s, t, "Unexpecetd CCP request code %d\n", *p);
+ log(1, 0, s, t, "Unexpected CCP request code %d\n", *p);
STAT(tunnel_rx_errors);
return ;
}
// returns start of PPP frame
u8 *makeppp(u8 * b, int size, u8 * p, int l, tunnelidt t, sessionidt s, u16 mtype)
{
-
if (size < 12)
return NULL; // Need more space than this!!
*(u16 *) (b + 2) = htons(tunnel[t].far); // tunnel
*(u16 *) (b + 4) = htons(session[s].far); // session
b += 6;
- if (mtype && !(session[s].l2tp_flags & SESSIONACFC))
+ if (mtype == PPPLCP || !(session[s].l2tp_flags & SESSIONACFC))
{
*(u16 *) b = htons(0xFF03); // HDLC header
b += 2;