summaryrefslogtreecommitdiffstats
path: root/sys/net/if_spppsubr.c
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1997-08-10 14:28:16 +0000
committerjoerg <joerg@FreeBSD.org>1997-08-10 14:28:16 +0000
commit7c374e293dcb027d305ffda9c88002560ea0b905 (patch)
treeac84a08dc3c94243992d8e861a1850cbf49e6f28 /sys/net/if_spppsubr.c
parentb350688b281b089b301d8f78952b1025907bba9e (diff)
downloadFreeBSD-src-7c374e293dcb027d305ffda9c88002560ea0b905.zip
FreeBSD-src-7c374e293dcb027d305ffda9c88002560ea0b905.tar.gz
Implement the LCP fail_counter: if an option has been NAK'ed for more
than max_failures attempts, we are going to REJ it, to prevent endless NAK loops. (This is actually part of a larger local set of modifications i'm running with, but the remainder (PAP & CHAP) ain't ready for prime- time yet.)
Diffstat (limited to 'sys/net/if_spppsubr.c')
-rw-r--r--sys/net/if_spppsubr.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index c1bfb65..6064932 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -17,7 +17,7 @@
*
* From: Version 1.9, Wed Oct 4 18:58:15 MSK 1995
*
- * $Id: if_spppsubr.c,v 1.22 1997/05/23 20:40:15 joerg Exp $
+ * $Id: if_spppsubr.c,v 1.23 1997/08/06 01:43:09 itojun Exp $
*/
#include <sys/param.h>
@@ -1810,13 +1810,22 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len)
rlen += p[1];
}
if (rlen) {
- if (debug)
- addlog(" send conf-nak\n");
- sppp_cp_send (sp, PPP_LCP, CONF_NAK, h->ident, rlen, buf);
+ if (++sp->fail_counter[IDX_LCP] >= sp->lcp.max_failure) {
+ if (debug)
+ addlog(" max_failure (%d) exceeded, "
+ "send conf-rej\n",
+ sp->lcp.max_failure);
+ sppp_cp_send(sp, PPP_LCP, CONF_REJ, h->ident, rlen, buf);
+ } else {
+ if (debug)
+ addlog(" send conf-nak\n");
+ sppp_cp_send (sp, PPP_LCP, CONF_NAK, h->ident, rlen, buf);
+ }
return 0;
} else {
if (debug)
addlog(" send conf-ack\n");
+ sp->fail_counter[IDX_LCP] = 0;
sp->pp_loopcnt = 0;
sppp_cp_send (sp, PPP_LCP, CONF_ACK,
h->ident, origlen, h+1);
OpenPOWER on IntegriCloud