mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
PPP: introduce ppp_set_auth_required macro
PPP auth required flag is currently hardcoded to true if PPP is acting as a server and set to false if PPP is acting as a client. This is probably the most wanted behavior, but since we now have the ability to change that at runtime, allow users to do it. It means we can now have a server which asks the client to authenticate or vice versa. This is pretty unusual thought. What we don't support yet is mutual authentication with a different set of user and password per direction which is even less usual.
This commit is contained in:
parent
8b9886bfe2
commit
96296947fc
@ -323,6 +323,9 @@ ppp_set_ipcp_dnsaddr(ppp, 1, &addr);
|
|||||||
/* Auth configuration, this is pretty self-explanatory */
|
/* Auth configuration, this is pretty self-explanatory */
|
||||||
ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password");
|
ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password");
|
||||||
|
|
||||||
|
/* Require peer to authenticate */
|
||||||
|
ppp_set_auth_required(ppp, 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initiate PPP listener (i.e. wait for an incoming connection), can only
|
* Initiate PPP listener (i.e. wait for an incoming connection), can only
|
||||||
* be called if PPP session is in the dead state (i.e. disconnected).
|
* be called if PPP session is in the dead state (i.e. disconnected).
|
||||||
|
@ -453,6 +453,13 @@ struct ppp_pcb_s {
|
|||||||
#define PPPAUTHTYPE_ANY 0xff
|
#define PPPAUTHTYPE_ANY 0xff
|
||||||
void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
|
void ppp_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
|
||||||
|
|
||||||
|
#if PPP_AUTH_SUPPORT
|
||||||
|
/*
|
||||||
|
* Whether peer is required to authenticate. This is mostly necessary for PPP server support.
|
||||||
|
*/
|
||||||
|
#define ppp_set_auth_required(ppp, boolval) (ppp->settings.auth_required = boolval)
|
||||||
|
#endif /* PPP_AUTH_SUPPORT */
|
||||||
|
|
||||||
#if PPP_IPV4_SUPPORT
|
#if PPP_IPV4_SUPPORT
|
||||||
/*
|
/*
|
||||||
* Set PPP interface "our" and "his" IPv4 addresses. This is mostly necessary for PPP server
|
* Set PPP interface "our" and "his" IPv4 addresses. This is mostly necessary for PPP server
|
||||||
|
@ -351,12 +351,6 @@ pppos_listen(ppp_pcb *ppp, void *ctx)
|
|||||||
lcp_wo = &ppp->lcp_wantoptions;
|
lcp_wo = &ppp->lcp_wantoptions;
|
||||||
lcp_wo->silent = 1;
|
lcp_wo->silent = 1;
|
||||||
|
|
||||||
#if PPP_AUTH_SUPPORT
|
|
||||||
if (ppp->settings.user && ppp->settings.passwd) {
|
|
||||||
ppp->settings.auth_required = 1;
|
|
||||||
}
|
|
||||||
#endif /* PPP_AUTH_SUPPORT */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default the in and out accm so that escape and flag characters
|
* Default the in and out accm so that escape and flag characters
|
||||||
* are always escaped.
|
* are always escaped.
|
||||||
|
Loading…
Reference in New Issue
Block a user