mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-28 14:54:05 +00:00
PPP, PPPoE: rename PPPOE_TODO to PPPOE_SCNAME_SUPPORT, prepare service name and concentrator support
Rename PPPOE_TODO to PPPOE_SCNAME_SUPPORT because this is the only feature enclosed by them. Prepare for proper service name and concentrator name support by moving PPPOE_SCNAME_SUPPORT define to ppp_opts.h. Signed-off-by: Sylvain Rochet <gradator@gradator.net>
This commit is contained in:
parent
2ff0db9a9b
commit
96548ede2b
@ -44,6 +44,13 @@
|
||||
#define PPPOE_SUPPORT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* PPPOE_SCNAME_SUPPORT==1: Enable PPP Over Ethernet Service Name and Concentrator Name support
|
||||
*/
|
||||
#ifndef PPPOE_SCNAME_SUPPORT
|
||||
#define PPPOE_SCNAME_SUPPORT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* PPPOL2TP_SUPPORT==1: Enable PPP Over L2TP
|
||||
*/
|
||||
|
@ -149,10 +149,10 @@ struct pppoe_softc {
|
||||
u16_t sc_session; /* PPPoE session id */
|
||||
u8_t sc_state; /* discovery phase or session connected */
|
||||
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
u8_t *sc_service_name; /* if != NULL: requested name of service */
|
||||
u8_t *sc_concentrator_name; /* if != NULL: requested concentrator id */
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
u8_t sc_ac_cookie[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */
|
||||
u8_t sc_ac_cookie_len; /* length of cookie data */
|
||||
#ifdef PPPOE_SERVER
|
||||
|
@ -301,14 +301,14 @@ pppoe_destroy(ppp_pcb *ppp, void *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
if (sc->sc_concentrator_name) {
|
||||
mem_free(sc->sc_concentrator_name);
|
||||
}
|
||||
if (sc->sc_service_name) {
|
||||
mem_free(sc->sc_service_name);
|
||||
}
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
LWIP_MEMPOOL_FREE(PPPOE_IF, sc);
|
||||
|
||||
return ERR_OK;
|
||||
@ -757,13 +757,13 @@ pppoe_send_padi(struct pppoe_softc *sc)
|
||||
struct pbuf *pb;
|
||||
u8_t *p;
|
||||
int len;
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
int l1 = 0, l2 = 0; /* XXX: gcc */
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
|
||||
/* calculate length of frame (excluding ethernet header + pppoe header) */
|
||||
len = 2 + 2 + 2 + 2 + sizeof sc; /* service name tag is required, host unique is send too */
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
if (sc->sc_service_name != NULL) {
|
||||
l1 = (int)strlen(sc->sc_service_name);
|
||||
len += l1;
|
||||
@ -772,7 +772,7 @@ pppoe_send_padi(struct pppoe_softc *sc)
|
||||
l2 = (int)strlen(sc->sc_concentrator_name);
|
||||
len += 2 + 2 + l2;
|
||||
}
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
LWIP_ASSERT("sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len <= 0xffff",
|
||||
sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len <= 0xffff);
|
||||
|
||||
@ -787,24 +787,24 @@ pppoe_send_padi(struct pppoe_softc *sc)
|
||||
/* fill in pkt */
|
||||
PPPOE_ADD_HEADER(p, PPPOE_CODE_PADI, 0, (u16_t)len);
|
||||
PPPOE_ADD_16(p, PPPOE_TAG_SNAME);
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
if (sc->sc_service_name != NULL) {
|
||||
PPPOE_ADD_16(p, l1);
|
||||
MEMCPY(p, sc->sc_service_name, l1);
|
||||
p += l1;
|
||||
} else
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
{
|
||||
PPPOE_ADD_16(p, 0);
|
||||
}
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
if (sc->sc_concentrator_name != NULL) {
|
||||
PPPOE_ADD_16(p, PPPOE_TAG_ACNAME);
|
||||
PPPOE_ADD_16(p, l2);
|
||||
MEMCPY(p, sc->sc_concentrator_name, l2);
|
||||
p += l2;
|
||||
}
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE);
|
||||
PPPOE_ADD_16(p, sizeof(sc));
|
||||
MEMCPY(p, &sc, sizeof sc);
|
||||
@ -982,17 +982,17 @@ pppoe_send_padr(struct pppoe_softc *sc)
|
||||
struct pbuf *pb;
|
||||
u8_t *p;
|
||||
size_t len;
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
size_t l1 = 0; /* XXX: gcc */
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
|
||||
len = 2 + 2 + 2 + 2 + sizeof(sc); /* service name, host unique */
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
if (sc->sc_service_name != NULL) { /* service name tag maybe empty */
|
||||
l1 = strlen(sc->sc_service_name);
|
||||
len += l1;
|
||||
}
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
if (sc->sc_ac_cookie_len > 0) {
|
||||
len += 2 + 2 + sc->sc_ac_cookie_len; /* AC cookie */
|
||||
}
|
||||
@ -1006,13 +1006,13 @@ pppoe_send_padr(struct pppoe_softc *sc)
|
||||
p = (u8_t*)pb->payload;
|
||||
PPPOE_ADD_HEADER(p, PPPOE_CODE_PADR, 0, len);
|
||||
PPPOE_ADD_16(p, PPPOE_TAG_SNAME);
|
||||
#ifdef PPPOE_TODO
|
||||
#if PPPOE_SCNAME_SUPPORT
|
||||
if (sc->sc_service_name != NULL) {
|
||||
PPPOE_ADD_16(p, l1);
|
||||
MEMCPY(p, sc->sc_service_name, l1);
|
||||
p += l1;
|
||||
} else
|
||||
#endif /* PPPOE_TODO */
|
||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||
{
|
||||
PPPOE_ADD_16(p, 0);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user