1995-02-27 03:18:28 +00:00
|
|
|
/*
|
|
|
|
* Written by Toshiharu OHNO (tony-o@iij.ad.jp)
|
|
|
|
*
|
|
|
|
* Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms are permitted
|
|
|
|
* provided that the above copyright notice and this paragraph are
|
|
|
|
* duplicated in all such forms and that any documentation,
|
|
|
|
* advertising materials, and other materials related to such
|
|
|
|
* distribution and use acknowledge that the software was developed
|
|
|
|
* by the Internet Initiative Japan. The name of the
|
|
|
|
* IIJ may not be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
1999-08-28 01:35:59 +00:00
|
|
|
* $FreeBSD$
|
1995-02-27 03:18:28 +00:00
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
*/
|
|
|
|
|
1998-01-29 00:49:32 +00:00
|
|
|
struct physical;
|
1998-04-07 00:54:26 +00:00
|
|
|
struct bundle;
|
1999-02-06 02:54:47 +00:00
|
|
|
struct authinfo;
|
|
|
|
typedef void (*auth_func)(struct authinfo *);
|
1995-02-27 03:18:28 +00:00
|
|
|
|
|
|
|
struct authinfo {
|
1999-02-06 02:54:47 +00:00
|
|
|
struct {
|
|
|
|
auth_func req;
|
|
|
|
auth_func success;
|
|
|
|
auth_func failure;
|
|
|
|
} fn;
|
|
|
|
struct {
|
|
|
|
struct fsmheader hdr;
|
|
|
|
char name[AUTHLEN];
|
|
|
|
} in;
|
1995-02-27 03:18:28 +00:00
|
|
|
struct pppTimer authtimer;
|
|
|
|
int retry;
|
|
|
|
int id;
|
1998-01-29 00:49:32 +00:00
|
|
|
struct physical *physical;
|
1998-04-03 19:24:07 +00:00
|
|
|
struct {
|
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.
1999-02-26 21:28:14 +00:00
|
|
|
struct fsm_retry fsm; /* How often/frequently to resend requests */
|
1998-04-03 19:24:07 +00:00
|
|
|
} cfg;
|
1995-02-27 03:18:28 +00:00
|
|
|
};
|
|
|
|
|
1999-02-06 02:54:47 +00:00
|
|
|
#define auth_Failure(a) (*a->fn.failure)(a);
|
|
|
|
#define auth_Success(a) (*a->fn.success)(a);
|
1998-05-01 19:26:12 +00:00
|
|
|
|
1999-02-18 00:52:15 +00:00
|
|
|
extern const char *Auth2Nam(u_short, u_char);
|
1999-02-06 02:54:47 +00:00
|
|
|
extern void auth_Init(struct authinfo *, struct physical *,
|
|
|
|
auth_func, auth_func, auth_func);
|
1998-05-01 19:26:12 +00:00
|
|
|
extern void auth_StopTimer(struct authinfo *);
|
1999-02-06 02:54:47 +00:00
|
|
|
extern void auth_StartReq(struct authinfo *);
|
1998-05-01 19:26:12 +00:00
|
|
|
extern int auth_Validate(struct bundle *, const char *, const char *,
|
|
|
|
struct physical *);
|
|
|
|
extern char *auth_GetSecret(struct bundle *, const char *, int,
|
|
|
|
struct physical *);
|
1998-08-07 18:42:51 +00:00
|
|
|
extern int auth_SetPhoneList(const char *, char *, int);
|
|
|
|
extern int auth_Select(struct bundle *, const char *);
|
1999-02-06 02:54:47 +00:00
|
|
|
extern struct mbuf *auth_ReadHeader(struct authinfo *, struct mbuf *);
|
|
|
|
extern struct mbuf *auth_ReadName(struct authinfo *, struct mbuf *, int);
|