| 4257 | } |
| 4258 | |
| 4259 | static void |
| 4260 | sppp_chap_tlu(struct sppp *sp) |
| 4261 | { |
| 4262 | STDDCL; |
| 4263 | int i; |
| 4264 | |
| 4265 | i = 0; |
| 4266 | sp->rst_counter[IDX_CHAP] = sp->lcp.max_configure; |
| 4267 | |
| 4268 | /* |
| 4269 | * Some broken CHAP implementations (Conware CoNet, firmware |
| 4270 | * 4.0.?) don't want to re-authenticate their CHAP once the |
| 4271 | * initial challenge-response exchange has taken place. |
| 4272 | * Provide for an option to avoid rechallenges. |
| 4273 | */ |
| 4274 | if ((sp->hisauth.flags & AUTHFLAG_NORECHALLENGE) == 0) { |
| 4275 | /* |
| 4276 | * Compute the re-challenge timeout. This will yield |
| 4277 | * a number between 300 and 810 seconds. |
| 4278 | */ |
| 4279 | i = 300 + ((unsigned)(random() & 0xff00) >> 7); |
| 4280 | callout_reset(&sp->ch[IDX_CHAP], i * hz, chap.TO, (void *)sp); |
| 4281 | } |
| 4282 | |
| 4283 | if (debug) { |
| 4284 | log(LOG_DEBUG, |
| 4285 | SPP_FMT "chap %s, ", |
| 4286 | SPP_ARGS(ifp), |
| 4287 | sp->pp_phase == PHASE_NETWORK? "reconfirmed": "tlu"); |
| 4288 | if ((sp->hisauth.flags & AUTHFLAG_NORECHALLENGE) == 0) |
| 4289 | log(-1, "next re-challenge in %d seconds\n", i); |
| 4290 | else |
| 4291 | log(-1, "re-challenging suppressed\n"); |
| 4292 | } |
| 4293 | |
| 4294 | SPPP_LOCK(sp); |
| 4295 | /* indicate to LCP that we need to be closed down */ |
| 4296 | sp->lcp.protos |= (1 << IDX_CHAP); |
| 4297 | |
| 4298 | if (sp->pp_flags & PP_NEEDAUTH) { |
| 4299 | /* |
| 4300 | * Remote is authenticator, but his auth proto didn't |
| 4301 | * complete yet. Defer the transition to network |
| 4302 | * phase. |
| 4303 | */ |
| 4304 | SPPP_UNLOCK(sp); |
| 4305 | return; |
| 4306 | } |
| 4307 | SPPP_UNLOCK(sp); |
| 4308 | |
| 4309 | /* |
| 4310 | * If we are already in phase network, we are done here. This |
| 4311 | * is the case if this is a dummy tlu event after a re-challenge. |
| 4312 | */ |
| 4313 | if (sp->pp_phase != PHASE_NETWORK) |
| 4314 | sppp_phase_network(sp); |
| 4315 | } |
| 4316 |
nothing calls this directly
no test coverage detected