X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/dc3e79bf7e65b4f7787baa2f665296418518f5c9..refs/tags/release_2_1_3:/ppp.c diff --git a/ppp.c b/ppp.c index c5aaf19..d2c0cc4 100644 --- a/ppp.c +++ b/ppp.c @@ -1,6 +1,6 @@ // L2TPNS PPP Stuff -char const *cvs_id_ppp = "$Id: ppp.c,v 1.70 2005/08/11 06:18:56 bodea Exp $"; +char const *cvs_id_ppp = "$Id: ppp.c,v 1.74 2005/08/17 03:56:27 bodea Exp $"; #include #include @@ -85,8 +85,7 @@ void processpap(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) 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 uint8_t b[MAXCONTROL]; @@ -428,7 +427,7 @@ static uint8_t *ppp_nak(sessionidt s, uint8_t *buf, size_t blen, uint16_t mtype, if (!queued) return 0; - *nak_sent++; + (*nak_sent)++; *queued = ConfigNak; queued += 4; } @@ -960,8 +959,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))) { + uint8_t *oq = q; 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; @@ -1301,7 +1301,7 @@ void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) *p = TerminateAck; q = makeppp(b, sizeof(b), p, l, s, t, PPPIPV6CP); if (!q) return; - LOG(3, s, t, "IPV6CP: Sending %s\n", ppp_code(*response)); + LOG(3, s, t, "IPV6CP: send %s\n", ppp_code(*q)); tunnelsend(b, l + (q - b), t); change_state(s, ipv6cp, Stopped); } @@ -1319,7 +1319,7 @@ void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) if (!q) return; LOG(2, s, t, "Unexpected IPV6CP code %s\n", ppp_code(code)); - LOG(3, s, t, "IPV6CP: Sending %s\n", ppp_code(*response)); + LOG(3, s, t, "IPV6CP: send %s\n", ppp_code(*q)); tunnelsend(b, l + (q - b), t); } } @@ -1847,7 +1847,8 @@ void sendccp(sessionidt s, tunnelidt t) 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