From: bodea Date: Tue, 18 Apr 2006 06:00:07 +0000 (+0000) Subject: don't shutdown on TerminateReq, wait for CDN X-Git-Tag: release_2_1_18~1 X-Git-Url: http://git.sameswireless.fr/l2tpns.git/commitdiff_plain/4f866369eafbb09bda24354b1d555f9a6c6ea02b?hp=b089008c0575e64aaf6fc15baaca0c02951f0a82 don't shutdown on TerminateReq, wait for CDN --- diff --git a/Changes b/Changes index 3eed3bf..fb56a4c 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +* Tue Apr 18 2006 Brendan O'Dea 2.1.18 +- Don't shutdown on TerminateReq, wait for CDN. + * Thu Apr 13 2006 Brendan O'Dea 2.1.17 - Fix IPCP length test to allow Terminate-Request (4 bytes). - Send nsctl responses back using the correct source address (thanks ltd). diff --git a/l2tpns.h b/l2tpns.h index 240c7d4..12b7440 100644 --- a/l2tpns.h +++ b/l2tpns.h @@ -1,5 +1,5 @@ // L2TPNS Global Stuff -// $Id: l2tpns.h,v 1.112 2006/04/13 11:14:35 bodea Exp $ +// $Id: l2tpns.h,v 1.113 2006/04/18 06:00:08 bodea Exp $ #ifndef __L2TPNS_H__ #define __L2TPNS_H__ @@ -14,7 +14,7 @@ #include #include -#define VERSION "2.1.17" +#define VERSION "2.1.18" // Limits #define MAXTUNNEL 500 // could be up to 65535 @@ -147,7 +147,16 @@ enum { // reset state machine counters #define initialise_restart_count(_s, _fsm) \ - sess_local[_s]._fsm.conf_sent = sess_local[_s]._fsm.nak_sent = 0 + sess_local[_s]._fsm.conf_sent = \ + sess_local[_s]._fsm.nak_sent = 0 + +// no more attempts +#define zero_restart_count(_s, _fsm) ({ \ + sess_local[_s]._fsm.conf_sent = \ + config->ppp_max_configure; \ + sess_local[_s]._fsm.restart = \ + time_now + config->ppp_restart_time; \ +}) // increment ConfReq counter and reset timer #define restart_timer(_s, _fsm) ({ \ diff --git a/l2tpns.spec b/l2tpns.spec index 11352ff..f8f3ffc 100644 --- a/l2tpns.spec +++ b/l2tpns.spec @@ -1,6 +1,6 @@ Summary: A high-speed clustered L2TP LNS Name: l2tpns -Version: 2.1.17 +Version: 2.1.18 Release: 1 License: GPL Group: System Environment/Daemons @@ -43,5 +43,5 @@ rm -rf %{buildroot} %attr(644,root,root) /usr/share/man/man[58]/* %changelog -* Thu Apr 13 2006 Brendan O'Dea 2.1.17-1 -- 2.1.17 release, see /usr/share/doc/l2tpns-2.1.17/Changes +* Tue Apr 18 2006 Brendan O'Dea 2.1.18-1 +- 2.1.18 release, see /usr/share/doc/l2tpns-2.1.18/Changes diff --git a/ppp.c b/ppp.c index 3fae559..3e8bed9 100644 --- a/ppp.c +++ b/ppp.c @@ -1,6 +1,6 @@ // L2TPNS PPP Stuff -char const *cvs_id_ppp = "$Id: ppp.c,v 1.98 2006/04/13 11:14:35 bodea Exp $"; +char const *cvs_id_ppp = "$Id: ppp.c,v 1.99 2006/04/18 06:00:08 bodea Exp $"; #include #include @@ -870,7 +870,29 @@ void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) } else if (*p == TerminateReq) { - *p = TerminateAck; // close + switch (session[s].ppp.lcp) + { + case Closed: + case Stopped: + case Closing: + case Stopping: + case RequestSent: + case AckReceived: + case AckSent: + break; + + case Opened: + lcp_restart(s); + zero_restart_count(s, lcp); + change_state(s, lcp, Closing); + break; + + default: + LOG(2, s, t, "LCP: ignoring %s in state %s\n", ppp_code(*p), ppp_state(session[s].ppp.lcp)); + return; + } + + *p = TerminateAck; // send ack q = makeppp(b, sizeof(b), p, l, s, t, PPPLCP); if (!q) return; @@ -878,11 +900,6 @@ void processlcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) if (config->debug > 3) dumplcp(q, l); tunnelsend(b, l + (q - b), t); // send it - sessionshutdown(s, "Remote end closed connection.", CDN_ADMIN_DISC, TERM_USER_REQUEST); - } - else if (*p == TerminateAck) - { - sessionshutdown(s, "Connection closed.", CDN_ADMIN_DISC, TERM_NAS_REQUEST); } else if (*p == ProtocolRej) { @@ -1153,12 +1170,33 @@ void processipcp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) } else if (*p == TerminateReq) { - *p = TerminateAck; - q = makeppp(b, sizeof(b), p, l, s, t, PPPIPCP); + switch (session[s].ppp.ipcp) + { + case Closed: + case Stopped: + case Closing: + case Stopping: + case RequestSent: + case AckReceived: + case AckSent: + break; + + case Opened: + zero_restart_count(s, ipcp); + change_state(s, ipcp, Closing); + break; + + default: + LOG(2, s, t, "IPCP: ignoring %s in state %s\n", ppp_code(*p), ppp_state(session[s].ppp.ipcp)); + return; + } + + *p = TerminateAck; // send ack + 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); // send it } else if (*p != CodeRej) { @@ -1353,12 +1391,33 @@ void processipv6cp(sessionidt s, tunnelidt t, uint8_t *p, uint16_t l) } else if (*p == TerminateReq) { - *p = TerminateAck; + switch (session[s].ppp.ipv6cp) + { + case Closed: + case Stopped: + case Closing: + case Stopping: + case RequestSent: + case AckReceived: + case AckSent: + break; + + case Opened: + zero_restart_count(s, ipv6cp); + change_state(s, ipv6cp, Closing); + break; + + default: + LOG(2, s, t, "IPV6CP: ignoring %s in state %s\n", ppp_code(*p), ppp_state(session[s].ppp.ipv6cp)); + return; + } + + *p = TerminateAck; // send ack 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); // send it } else if (*p != CodeRej) {