projects
/
l2tpns.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
restart BGP on receipt of CEASE
[l2tpns.git]
/
ppp.c
diff --git
a/ppp.c
b/ppp.c
index
05cc5fd
..
806880e
100644
(file)
--- a/
ppp.c
+++ b/
ppp.c
@@
-1,6
+1,6
@@
// L2TPNS PPP Stuff
// L2TPNS PPP Stuff
-char const *cvs_id_ppp = "$Id: ppp.c,v 1.
69 2005-08-11 05:50:4
9 bodea Exp $";
+char const *cvs_id_ppp = "$Id: ppp.c,v 1.
79 2005-08-31 12:41:0
9 bodea Exp $";
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
@@
-85,11
+85,10
@@
void processpap(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
LOG(3, s, t, "PAP login %s/%s\n", user, pass);
}
LOG(3, s, t, "PAP login %s/%s\n", user, pass);
}
- r = radiusnew(s);
- if (session[s].ip || !r)
+ if (session[s].ip || !(r = radiusnew(s)))
{
// respond now, either no RADIUS available or already authenticated
{
// respond now, either no RADIUS available or already authenticated
- uint8_t b[MAX
CONTROL
];
+ uint8_t b[MAX
ETHER
];
uint8_t id = p[1];
uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPPAP);
if (!p) return;
uint8_t id = p[1];
uint8_t *p = makeppp(b, sizeof(b), 0, 0, s, t, PPPPAP);
if (!p) return;
@@
-148,13
+147,6
@@
void processchap(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
CSTAT(processchap);
LOG_HEX(5, "CHAP", p, l);
CSTAT(processchap);
LOG_HEX(5, "CHAP", p, l);
- r = sess_local[s].radius;
- if (!r)
- {
- LOG(1, s, t, "Unexpected CHAP message\n");
- STAT(tunnel_rx_errors);
- return;
- }
if (l < 4)
{
if (l < 4)
{
@@
-181,6
+173,13
@@
void processchap(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
return;
}
return;
}
+ r = sess_local[s].radius;
+ if (!r)
+ {
+ LOG(3, s, t, "Unexpected CHAP message\n");
+ return;
+ }
+
if (session[s].ppp.phase != Authenticate)
{
LOG(2, s, t, "CHAP ignored in %s phase\n", ppp_phase(session[s].ppp.phase));
if (session[s].ppp.phase != Authenticate)
{
LOG(2, s, t, "CHAP ignored in %s phase\n", ppp_phase(session[s].ppp.phase));
@@
-341,6
+340,8
@@
void lcp_open(sessionidt s, tunnelidt t)
// transition to Authentication or Network phase:
session[s].ppp.phase = sess_local[s].lcp_authtype ? Authenticate : Network;
// transition to Authentication or Network phase:
session[s].ppp.phase = sess_local[s].lcp_authtype ? Authenticate : Network;
+ LOG(3, s, t, "LCP: Opened, phase %s\n", ppp_phase(session[s].ppp.phase));
+
// LCP now Opened
change_state(s, lcp, Opened);
// LCP now Opened
change_state(s, lcp, Opened);
@@
-426,7
+427,7
@@
static uint8_t *ppp_nak(sessionidt s, uint8_t *buf, size_t blen, uint16_t mtype,
if (!queued)
return 0;
if (!queued)
return 0;
-
*nak_sent
++;
+
(*nak_sent)
++;
*queued = ConfigNak;
queued += 4;
}
*queued = ConfigNak;
queued += 4;
}
@@
-446,7
+447,7
@@
static uint8_t *ppp_nak(sessionidt s, uint8_t *buf, size_t blen, uint16_t mtype,
// Process LCP messages
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
// Process LCP messages
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
- uint8_t b[MAX
CONTROL
];
+ uint8_t b[MAX
ETHER
];
uint8_t *q = NULL;
uint32_t magicno = 0;
uint16_t hl;
uint8_t *q = NULL;
uint32_t magicno = 0;
uint16_t hl;
@@
-520,7
+521,7
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
if (session[s].ppp.lcp == Opened)
lcp_restart(s);
if (session[s].ppp.lcp == Opened)
lcp_restart(s);
- sendlcp(s, t
, sess_local[s].lcp_authtype
);
+ sendlcp(s, t);
change_state(s, lcp, RequestSent);
break;
change_state(s, lcp, RequestSent);
break;
@@
-650,7
+651,7
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
case Stopped:
initialise_restart_count(s, lcp);
case Stopped:
initialise_restart_count(s, lcp);
- sendlcp(s, t
, sess_local[s].lcp_authtype
);
+ sendlcp(s, t);
if (*response == ConfigAck)
change_state(s, lcp, AckSent);
else
if (*response == ConfigAck)
change_state(s, lcp, AckSent);
else
@@
-672,7
+673,7
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
case Opened:
lcp_restart(s);
case Opened:
lcp_restart(s);
- sendlcp(s, t
, sess_local[s].lcp_authtype
);
+ sendlcp(s, t);
/* fallthrough */
case AckSent:
/* fallthrough */
case AckSent:
@@
-693,7
+694,7
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
tunnelsend(b, l + (response - b), t);
}
tunnelsend(b, l + (response - b), t);
}
- else if (*p == ConfigNak)
+ else if (*p == ConfigNak
|| *p == ConfigRej
)
{
int x = l - 4;
uint8_t *o = (p + 4);
{
int x = l - 4;
uint8_t *o = (p + 4);
@@
-708,14
+709,24
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
switch (type)
{
case 1: // Maximum-Receive-Unit
switch (type)
{
case 1: // Maximum-Receive-Unit
- session[s].mru = ntohs(*(uint16_t *)(o + 2));
- LOG(3, s, t, " Remote requested MRU of %u\n", session[s].mru);
+ if (*p == ConfigNak)
+ {
+ session[s].mru = ntohs(*(uint16_t *)(o + 2));
+ LOG(3, s, t, " Remote requested MRU of %u\n", session[s].mru);
+ }
+ else
+ {
+ session[s].mru = 0;
+ LOG(3, s, t, " Remote rejected MRU negotiation\n");
+ }
+
break;
case 3: // Authentication-Protocol
if (authtype > 0)
break;
break;
case 3: // Authentication-Protocol
if (authtype > 0)
break;
+ if (*p == ConfigNak)
{
int proto = ntohs(*(uint16_t *)(o + 2));
if (proto == PPPPAP)
{
int proto = ntohs(*(uint16_t *)(o + 2));
if (proto == PPPPAP)
@@
-736,11
+747,16
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
proto);
}
}
proto);
}
}
+ else
+ {
+ LOG(2, s, t, "LCP: remote rejected auth negotiation\n");
+ authtype = 0; // shutdown
+ }
break;
default:
break;
default:
- LOG(2, s, t, "
Remote NAKed LCP type %u?\n"
, type);
+ LOG(2, s, t, "
LCP: remote sent %s for type %u?\n", ppp_code(*p)
, type);
break;
}
x -= length;
break;
}
x -= length;
@@
-765,6
+781,10
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
if (!response) return;
*response = TerminateAck;
*((uint16_t *) (response + 2)) = htons(l = 4);
if (!response) return;
*response = TerminateAck;
*((uint16_t *) (response + 2)) = htons(l = 4);
+
+ LOG(3, s, t, "LCP: send %s\n", ppp_code(*response));
+ if (config->debug > 3) dumplcp(response, l);
+
tunnelsend(b, l + (response - b), t);
}
break;
tunnelsend(b, l + (response - b), t);
}
break;
@@
-772,17
+792,17
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
case RequestSent:
case AckSent:
initialise_restart_count(s, lcp);
case RequestSent:
case AckSent:
initialise_restart_count(s, lcp);
- sendlcp(s, t
, sess_local[s].lcp_authtype
);
+ sendlcp(s, t);
break;
case AckReceived:
LOG(2, s, t, "LCP: ConfigNak in state %s? Sending ConfigReq\n", ppp_state(session[s].ppp.lcp));
break;
case AckReceived:
LOG(2, s, t, "LCP: ConfigNak in state %s? Sending ConfigReq\n", ppp_state(session[s].ppp.lcp));
- sendlcp(s, t
, sess_local[s].lcp_authtype
);
+ sendlcp(s, t);
break;
case Opened:
lcp_restart(s);
break;
case Opened:
lcp_restart(s);
- sendlcp(s, t
, sess_local[s].lcp_authtype
);
+ sendlcp(s, t);
break;
default:
break;
default:
@@
-795,6
+815,10
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
*p = TerminateAck; // close
q = makeppp(b, sizeof(b), p, l, s, t, PPPLCP);
if (!q) return;
*p = TerminateAck; // close
q = makeppp(b, sizeof(b), p, l, s, t, PPPLCP);
if (!q) return;
+
+ LOG(3, s, t, "LCP: send %s\n", ppp_code(*q));
+ if (config->debug > 3) dumplcp(q, l);
+
tunnelsend(b, l + (q - b), t); // send it
sessionshutdown(s, "Remote end closed connection.", 3, 0);
}
tunnelsend(b, l + (q - b), t); // send it
sessionshutdown(s, "Remote end closed connection.", 3, 0);
}
@@
-804,16
+828,26
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
}
else if (*p == ProtocolRej)
{
}
else if (*p == ProtocolRej)
{
- if (*(uint16_t *) (p+4) == htons(PPPIPV6CP))
+ uint16_t proto = 0;
+
+ if (l > 4)
+ {
+ proto = *(p+4);
+ if (l > 5 && !(proto & 1))
+ {
+ proto <<= 8;
+ proto |= *(p+5);
+ }
+ }
+
+ if (proto == PPPIPV6CP)
{
LOG(3, s, t, "IPv6 rejected\n");
change_state(s, ipv6cp, Closed);
}
else
{
{
LOG(3, s, t, "IPv6 rejected\n");
change_state(s, ipv6cp, Closed);
}
else
{
- LOG(1, s, t, "Unexpected LCP protocol reject 0x%X\n",
- ntohs(*(uint16_t *) (p+4)));
- STAT(tunnel_rx_errors);
+ LOG(3, s, t, "LCP protocol reject: 0x%04X\n", proto);
}
}
else if (*p == EchoReq)
}
}
else if (*p == EchoReq)
@@
-822,13
+856,17
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
*(uint32_t *) (p + 4) = htonl(session[s].magic); // our magic number
q = makeppp(b, sizeof(b), p, l, s, t, PPPLCP);
if (!q) return;
*(uint32_t *) (p + 4) = htonl(session[s].magic); // our magic number
q = makeppp(b, sizeof(b), p, l, s, t, PPPLCP);
if (!q) return;
+
+ LOG(4, s, t, "LCP: send %s\n", ppp_code(*q));
+ if (config->debug > 3) dumplcp(q, l);
+
tunnelsend(b, l + (q - b), t); // send it
}
else if (*p == EchoReply)
{
// Ignore it, last_packet time is set earlier than this.
}
tunnelsend(b, l + (q - b), t); // send it
}
else if (*p == EchoReply)
{
// Ignore it, last_packet time is set earlier than this.
}
- else
+ else
if (*p != CodeRej)
{
int code = *p;
int mru = session[s].mru;
{
int code = *p;
int mru = session[s].mru;
@@
-841,7
+879,10
@@
void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
q = makeppp(b, sizeof(b), p, l, s, t, PPPLCP);
if (!q) return;
q = makeppp(b, sizeof(b), p, l, s, t, PPPLCP);
if (!q) return;
- LOG(3, s, t, "Unexpected LCP code %s\n", ppp_code(code));
+ LOG(2, s, t, "Unexpected LCP code %s\n", ppp_code(code));
+ LOG(3, s, t, "LCP: send %s\n", ppp_code(*q));
+ if (config->debug > 3) dumplcp(q, l);
+
tunnelsend(b, l + (q - b), t);
}
}
tunnelsend(b, l + (q - b), t);
}
}
@@
-870,7
+911,7
@@
static void ipcp_open(sessionidt s, tunnelidt t)
// Process IPCP messages
void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
// Process IPCP messages
void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
- uint8_t b[MAX
CONTROL
];
+ uint8_t b[MAX
ETHER
];
uint8_t *q = 0;
uint16_t hl;
uint8_t *q = 0;
uint16_t hl;
@@
-898,6
+939,8
@@
void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
return;
}
return;
}
+ LOG(3, s, t, "IPCP: recv %s\n", ppp_code(*p));
+
if (*p == ConfigAck)
{
switch (session[s].ppp.ipcp)
if (*p == ConfigAck)
{
switch (session[s].ppp.ipcp)
@@
-930,8
+973,6
@@
void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
int gotip = 0;
in_addr_t addr;
int gotip = 0;
in_addr_t addr;
- LOG(3, s, t, "IPCP: ConfigReq received\n");
-
while (length > 2)
{
switch (*o)
while (length > 2)
{
switch (*o)
@@
-943,8
+984,9
@@
void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
addr = htonl(session[s].ip);
if (memcmp(o + 2, &addr, (sizeof addr)))
{
addr = htonl(session[s].ip);
if (memcmp(o + 2, &addr, (sizeof addr)))
{
+ uint8_t *oq = q;
q = ppp_nak(s, b, sizeof(b), PPPIPCP, &response, q, p, o, (uint8_t *) &addr, sizeof(addr));
q = ppp_nak(s, b, sizeof(b), PPPIPCP, &response, q, p, o, (uint8_t *) &addr, sizeof(addr));
- if (!q ||
*response == ConfigRej
)
+ if (!q ||
(q != oq && *response == ConfigRej)
)
{
sessionshutdown(s, "Can't negotiate IPCP.", 3, 0);
return;
{
sessionshutdown(s, "Can't negotiate IPCP.", 3, 0);
return;
@@
-1055,19
+1097,19
@@
void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
return;
}
return;
}
- LOG(3, s, t, "IPCP:
Sending
%s\n", ppp_code(*response));
+ LOG(3, s, t, "IPCP:
send
%s\n", ppp_code(*response));
tunnelsend(b, l + (response - b), t);
}
else if (*p == TerminateReq)
{
tunnelsend(b, l + (response - b), t);
}
else if (*p == TerminateReq)
{
- LOG(3, s, t, "IPCP: Received TerminateReq. Sending TerminateAck\n");
*p = TerminateAck;
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPCP);
if (!q) return;
*p = TerminateAck;
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPCP);
if (!q) return;
+ LOG(3, s, t, "IPCP: send %s\n", ppp_code(*q));
tunnelsend(b, l + (q - b), t);
change_state(s, ipcp, Stopped);
}
tunnelsend(b, l + (q - b), t);
change_state(s, ipcp, Stopped);
}
- else
+ else
if (*p != CodeRej)
{
int code = *p;
int mru = session[s].mru;
{
int code = *p;
int mru = session[s].mru;
@@
-1080,7
+1122,8
@@
void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPCP);
if (!q) return;
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPCP);
if (!q) return;
- LOG(3, s, t, "Unexpected IPCP code %s\n", ppp_code(code));
+ LOG(2, s, t, "Unexpected IPCP code %s\n", ppp_code(code));
+ LOG(3, s, t, "IPCP: send %s\n", ppp_code(*q));
tunnelsend(b, l + (q - b), t);
}
}
tunnelsend(b, l + (q - b), t);
}
}
@@
-1100,7
+1143,7
@@
static void ipv6cp_open(sessionidt s, tunnelidt t)
// Process IPV6CP messages
void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
// Process IPV6CP messages
void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
- uint8_t b[MAX
CONTROL
];
+ uint8_t b[MAX
ETHER
];
uint8_t *q = 0;
uint16_t hl;
uint8_t *q = 0;
uint16_t hl;
@@
-1128,6
+1171,8
@@
void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
return;
}
return;
}
+ LOG(3, s, t, "IPV6CP: recv %s\n", ppp_code(*p));
+
if (!config->ipv6_prefix.s6_addr[0])
{
LOG(2, s, t, "IPV6CP: %s rejected (not configured)\n", ppp_code(*p));
if (!config->ipv6_prefix.s6_addr[0])
{
LOG(2, s, t, "IPV6CP: %s rejected (not configured)\n", ppp_code(*p));
@@
-1176,8
+1221,6
@@
void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
int gotip = 0;
uint8_t ident[8];
int gotip = 0;
uint8_t ident[8];
- LOG(3, s, t, "IPV6CP: ConfigReq received\n");
-
while (length > 2)
{
switch (*o)
while (length > 2)
{
switch (*o)
@@
-1275,19
+1318,19
@@
void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
return;
}
return;
}
- LOG(3, s, t, "IPV6CP:
Sending
%s\n", ppp_code(*response));
+ LOG(3, s, t, "IPV6CP:
send
%s\n", ppp_code(*response));
tunnelsend(b, l + (response - b), t);
}
else if (*p == TerminateReq)
{
tunnelsend(b, l + (response - b), t);
}
else if (*p == TerminateReq)
{
- LOG(3, s, t, "IPV6CP: Received TerminateReq. Sending TerminateAck\n");
*p = TerminateAck;
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPV6CP);
if (!q) return;
*p = TerminateAck;
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPV6CP);
if (!q) return;
+ LOG(3, s, t, "IPV6CP: send %s\n", ppp_code(*q));
tunnelsend(b, l + (q - b), t);
change_state(s, ipv6cp, Stopped);
}
tunnelsend(b, l + (q - b), t);
change_state(s, ipv6cp, Stopped);
}
- else
+ else
if (*p != CodeRej)
{
int code = *p;
int mru = session[s].mru;
{
int code = *p;
int mru = session[s].mru;
@@
-1300,7
+1343,8
@@
void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPV6CP);
if (!q) return;
q = makeppp(b, sizeof(b), p, l, s, t, PPPIPV6CP);
if (!q) return;
- LOG(3, s, t, "Unexpected IPV6CP code %s\n", ppp_code(code));
+ LOG(2, s, t, "Unexpected IPV6CP code %s\n", ppp_code(code));
+ LOG(3, s, t, "IPV6CP: send %s\n", ppp_code(*q));
tunnelsend(b, l + (q - b), t);
}
}
tunnelsend(b, l + (q - b), t);
}
}
@@
-1531,7
+1575,7
@@
void send_ipin(sessionidt s, uint8_t *buf, int len)
// Process CCP messages
void processccp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
// Process CCP messages
void processccp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
{
- uint8_t b[MAX
CONTROL
];
+ uint8_t b[MAX
ETHER
];
uint8_t *q;
CSTAT(processccp);
uint8_t *q;
CSTAT(processccp);
@@
-1550,6
+1594,7
@@
void processccp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
STAT(tunnel_rx_errors);
}
STAT(tunnel_rx_errors);
}
+ LOG(3, s, t, "CCP: recv %s\n", ppp_code(*p));
if (*p == ConfigAck)
{
switch (session[s].ppp.ccp)
if (*p == ConfigAck)
{
switch (session[s].ppp.ccp)
@@
-1634,19
+1679,19
@@
void processccp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
return;
}
return;
}
- LOG(3, s, t, "CCP:
Sending
%s\n", ppp_code(*q));
+ LOG(3, s, t, "CCP:
send
%s\n", ppp_code(*q));
tunnelsend(b, l + (q - b), t);
}
else if (*p == TerminateReq)
{
tunnelsend(b, l + (q - b), t);
}
else if (*p == TerminateReq)
{
- LOG(3, s, t, "CCP: Received TerminateReq. Sending TerminateAck\n");
*p = TerminateAck;
q = makeppp(b, sizeof(b), p, l, s, t, PPPCCP);
if (!q) return;
*p = TerminateAck;
q = makeppp(b, sizeof(b), p, l, s, t, PPPCCP);
if (!q) return;
+ LOG(3, s, t, "CCP: send %s\n", ppp_code(*q));
tunnelsend(b, l + (q - b), t);
change_state(s, ccp, Stopped);
}
tunnelsend(b, l + (q - b), t);
change_state(s, ccp, Stopped);
}
- else
+ else
if (*p != CodeRej)
{
int code = *p;
int mru = session[s].mru;
{
int code = *p;
int mru = session[s].mru;
@@
-1659,7
+1704,8
@@
void processccp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
q = makeppp(b, sizeof(b), p, l, s, t, PPPCCP);
if (!q) return;
q = makeppp(b, sizeof(b), p, l, s, t, PPPCCP);
if (!q) return;
- LOG(3, s, t, "Unexpected CCP code %s\n", ppp_code(code));
+ LOG(2, s, t, "Unexpected CCP code %s\n", ppp_code(code));
+ LOG(3, s, t, "CCP: send %s\n", ppp_code(*q));
tunnelsend(b, l + (q - b), t);
}
}
tunnelsend(b, l + (q - b), t);
}
}
@@
-1667,7
+1713,7
@@
void processccp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l)
// send a CHAP challenge
void sendchap(sessionidt s, tunnelidt t)
{
// send a CHAP challenge
void sendchap(sessionidt s, tunnelidt t)
{
- uint8_t b[MAX
CONTROL
];
+ uint8_t b[MAX
ETHER
];
uint16_t r;
uint8_t *q;
uint16_t r;
uint8_t *q;
@@
-1779,9
+1825,10
@@
static int add_lcp_auth(uint8_t *b, int size, int authtype)
}
// Send initial LCP ConfigReq for MRU, authentication type and magic no
}
// Send initial LCP ConfigReq for MRU, authentication type and magic no
-void sendlcp(sessionidt s, tunnelidt t
, int authtype
)
+void sendlcp(sessionidt s, tunnelidt t)
{
uint8_t b[500], *q, *l;
{
uint8_t b[500], *q, *l;
+ int authtype = sess_local[s].lcp_authtype;
if (!(q = makeppp(b, sizeof(b), NULL, 0, s, t, PPPLCP)))
return;
if (!(q = makeppp(b, sizeof(b), NULL, 0, s, t, PPPLCP)))
return;
@@
-1791,17
+1838,17
@@
void sendlcp(sessionidt s, tunnelidt t, int authtype)
authtype ? (authtype == AUTHCHAP ? "CHAP" : "PAP") : "",
authtype ? ")" : "");
authtype ? (authtype == AUTHCHAP ? "CHAP" : "PAP") : "",
authtype ? ")" : "");
- if (!session[s].mru)
- session[s].mru = DEFAULT_MRU;
-
l = q;
*l++ = ConfigReq;
*l++ = (time_now % 255) + 1; // ID
l += 2; //Save space for length
l = q;
*l++ = ConfigReq;
*l++ = (time_now % 255) + 1; // ID
l += 2; //Save space for length
- *l++ = 1; *l++ = 4; // Maximum-Receive-Unit (length 4)
- *(uint16_t *) l = htons(session[s].mru); l += 2;
+ if (session[s].mru)
+ {
+ *l++ = 1; *l++ = 4; // Maximum-Receive-Unit (length 4)
+ *(uint16_t *) l = htons(session[s].mru); l += 2;
+ }
if (authtype)
l += add_lcp_auth(l, sizeof(b) - (l - b), authtype);
if (authtype)
l += add_lcp_auth(l, sizeof(b) - (l - b), authtype);
@@
-1826,7
+1873,8
@@
void sendccp(sessionidt s, tunnelidt t)
if (!(q = makeppp(b, sizeof(b), NULL, 0, s, t, PPPCCP)))
return;
if (!(q = makeppp(b, sizeof(b), NULL, 0, s, t, PPPCCP)))
return;
- LOG(4, s, t, "Sending CCP ConfigReq for no compression\n");
+ LOG(3, s, t, "CCP: send ConfigReq (no compression)\n");
+
*q = ConfigReq;
*(uint8_t *)(q + 1) = (time_now % 255) + 1; // ID
*(uint16_t *)(q + 2) = htons(4); // Length
*q = ConfigReq;
*(uint8_t *)(q + 1) = (time_now % 255) + 1; // ID
*(uint16_t *)(q + 2) = htons(4); // Length