diff options
author | brian <brian@FreeBSD.org> | 1999-02-26 21:28:14 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-02-26 21:28:14 +0000 |
commit | ee13d15d8f4dbbc16f743a3690a6e495279d5559 (patch) | |
tree | c5807a2099a7111ab5ef9d2ea6aee114863663ec /usr.sbin/ppp/ipcp.c | |
parent | 7810a0ea5a45f6d62932ef2f65c9127f4683098e (diff) | |
download | FreeBSD-src-ee13d15d8f4dbbc16f743a3690a6e495279d5559.zip FreeBSD-src-ee13d15d8f4dbbc16f743a3690a6e495279d5559.tar.gz |
Allow control over the number of ConfigREQ & TermREQ attempts
that are made in each of the FSMs (LCP, CCP & IPCP) and the
number of REQs/Challenges for PAP/CHAP by accepting more arguments
in the ``set {c,ip,l}cpretry'' and ``set {ch,p}apretry'' commands.
Change the non-convergence thresholds to 3 times the number of configured
REQ tries (rather than the previous fixed ``10''). We now notice
repeated NAKs and REJs rather than just REQs.
Don't suggest that CHAP 0x05 isn't supported when it's not configured.
Fix some bugs that expose themselves with smaller numbers of retries:
o Handle instantaneous disconnects (set device /dev/null) correctly
by stopping all fsm timers in fsm2initial.
o Don't forget to uu_unlock() devices that are files but are not
ttys (set device /dev/zero).
Fix a *HORRENDOUS* bug in RFC1661 (already fixed for an Open event in state
``Closed''):
According to the state transition table, a RCR+ or RCR- received in
the ``Stopped'' state are supposed to InitRestartCounter, SendConfigReq
and SendConfig{Ack,Nak}. However, in ``Stopped'', we haven't yet
done a TLS (or the last thing we did is a TLF). We must therefore
do the TLS at this point !
This was never noticed before because LCP and CCP used not use
LayerStart() for anything interesting, and IPCP tends to go into
Stopped then get a Down because of an LCP RTR rather than getting a
RCR again.
Diffstat (limited to 'usr.sbin/ppp/ipcp.c')
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index a430994..48ac07b 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.70 1999/02/02 20:27:12 brian Exp $ + * $Id: ipcp.c,v 1.71 1999/02/06 02:54:45 brian Exp $ * * TODO: * o More RFC1772 backward compatibility @@ -96,7 +96,7 @@ static int IpcpLayerUp(struct fsm *); static void IpcpLayerDown(struct fsm *); static void IpcpLayerStart(struct fsm *); static void IpcpLayerFinish(struct fsm *); -static void IpcpInitRestartCounter(struct fsm *); +static void IpcpInitRestartCounter(struct fsm *, int); static void IpcpSendConfigReq(struct fsm *); static void IpcpSentTerminateReq(struct fsm *); static void IpcpSendTerminateAck(struct fsm *, u_char); @@ -282,6 +282,10 @@ ipcp_Show(struct cmdargs const *arg) } prompt_Printf(arg->prompt, "\nDefaults:\n"); + prompt_Printf(arg->prompt, " FSM retry = %us, max %u Config" + " REQ%s, %u Term REQ%s\n", ipcp->cfg.fsm.timeout, + ipcp->cfg.fsm.maxreq, ipcp->cfg.fsm.maxreq == 1 ? "" : "s", + ipcp->cfg.fsm.maxtrm, ipcp->cfg.fsm.maxtrm == 1 ? "" : "s"); prompt_Printf(arg->prompt, " My Address: %s/%d", inet_ntoa(ipcp->cfg.my_range.ipaddr), ipcp->cfg.my_range.width); @@ -348,7 +352,7 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l, static const char *timer_names[] = {"IPCP restart", "IPCP openmode", "IPCP stopped"}; - fsm_Init(&ipcp->fsm, "IPCP", PROTO_IPCP, 1, IPCP_MAXCODE, 10, LogIPCP, + fsm_Init(&ipcp->fsm, "IPCP", PROTO_IPCP, 1, IPCP_MAXCODE, LogIPCP, bundle, l, parent, &ipcp_Callbacks, timer_names); ipcp->route = NULL; @@ -371,7 +375,9 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l, ipcp->cfg.ns.nbns[0].s_addr = INADDR_ANY; ipcp->cfg.ns.nbns[1].s_addr = INADDR_ANY; - ipcp->cfg.fsmretry = DEF_FSMRETRY; + ipcp->cfg.fsm.timeout = DEF_FSMRETRY; + ipcp->cfg.fsm.maxreq = DEF_FSMTRIES; + ipcp->cfg.fsm.maxtrm = DEF_FSMTRIES; ipcp->cfg.vj.neg = NEG_ENABLED|NEG_ACCEPTED; memset(&ipcp->vj, '\0', sizeof ipcp->vj); @@ -394,7 +400,6 @@ ipcp_Setup(struct ipcp *ipcp, u_int32_t mask) int pos, n; ipcp->fsm.open_mode = 0; - ipcp->fsm.maxconfig = 10; ipcp->ifmask.s_addr = mask == INADDR_NONE ? ipcp->cfg.netmask.s_addr : mask; if (iplist_isvalid(&ipcp->cfg.peer_list)) { @@ -571,13 +576,23 @@ ChooseHisAddr(struct bundle *bundle, struct in_addr gw) } static void -IpcpInitRestartCounter(struct fsm * fp) +IpcpInitRestartCounter(struct fsm *fp, int what) { /* Set fsm timer load */ struct ipcp *ipcp = fsm2ipcp(fp); - fp->FsmTimer.load = ipcp->cfg.fsmretry * SECTICKS; - fp->restart = DEF_REQs; + fp->FsmTimer.load = ipcp->cfg.fsm.timeout * SECTICKS; + switch (what) { + case FSM_REQ_TIMER: + fp->restart = ipcp->cfg.fsm.maxreq; + break; + case FSM_TRM_TIMER: + fp->restart = ipcp->cfg.fsm.maxtrm; + break; + default: + fp->restart = 1; + break; + } } static void @@ -628,7 +643,7 @@ IpcpSendConfigReq(struct fsm *fp) } static void -IpcpSentTerminateReq(struct fsm * fp) +IpcpSentTerminateReq(struct fsm *fp) { /* Term REQ just sent by FSM */ } @@ -649,8 +664,7 @@ IpcpLayerStart(struct fsm *fp) log_Printf(LogIPCP, "%s: LayerStart.\n", fp->link->name); throughput_start(&ipcp->throughput, "IPCP throughput", Enabled(fp->bundle, OPT_THROUGHPUT)); - - /* This is where we should be setting up the interface in AUTO mode */ + fp->more.reqs = fp->more.naks = fp->more.rejs = ipcp->cfg.fsm.maxreq * 3; } static void @@ -765,7 +779,9 @@ IpcpLayerUp(struct fsm *fp) system_Select(fp->bundle, "MYADDR", LINKUPFILE, NULL, NULL); } + fp->more.reqs = fp->more.naks = fp->more.rejs = ipcp->cfg.fsm.maxreq * 3; log_DisplayPrompts(); + return 1; } |