PPP, SERVER: statically define our name for authentication purposes

We don't need that in RAM nor a pointer to a string, a static
define is fine for embedded devices, saved ~257 bytes of RAM.
This commit is contained in:
Sylvain Rochet 2015-02-28 18:28:07 +01:00
parent 708e421ec3
commit 3686110ed2
3 changed files with 7 additions and 5 deletions

View File

@ -2054,6 +2054,11 @@
#ifndef PPP_SERVER
#define PPP_SERVER 0
#endif
#if PPP_SERVER
#ifndef PPP_OUR_NAME
#define PPP_OUR_NAME "lwIP" /* Our name for authentication purposes */
#endif
#endif /* PPP_SERVER */
/**
* VJ_SUPPORT==1: Support VJ header compression.

View File

@ -242,9 +242,6 @@ typedef struct ppp_settings_s {
/* auth data */
const char *user; /* Username for PAP */
const char *passwd; /* Password for PAP, secret for CHAP */
#if PPP_SERVER
char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */
#endif /* PPP_SERVER */
#if PPP_REMOTENAME
char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */
#endif /* PPP_REMOTENAME */

View File

@ -794,13 +794,13 @@ void link_established(ppp_pcb *pcb) {
#if PPP_SERVER
#if EAP_SUPPORT
if (go->neg_eap) {
eap_authpeer(pcb, pcb->settings.our_name);
eap_authpeer(pcb, PPP_OUR_NAME);
auth |= EAP_PEER;
} else
#endif /* EAP_SUPPORT */
#if CHAP_SUPPORT
if (go->neg_chap) {
chap_auth_peer(pcb, pcb->settings.our_name, CHAP_DIGEST(go->chap_mdtype));
chap_auth_peer(pcb, PPP_OUR_NAME, CHAP_DIGEST(go->chap_mdtype));
auth |= CHAP_PEER;
} else
#endif /* CHAP_SUPPORT */