mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-04 05:39:53 +00:00
PPP, PPPoE: use service name and concentrator name
Make pppoe_create() actually store the passed service name and concentrator name, so that they are passed in the PADI/PADR/PADS packets. Assume that the user application won't be freeing the strings and just copy the string pointers, therefore remove the mem_free() in pppoe_destroy(). Since only the pointers are copied now, make them 'const' in pppoe_softc. Signed-off-by: Sylvain Rochet <gradator@gradator.net>
This commit is contained in:
parent
48615984c7
commit
c02fea0961
@ -150,8 +150,8 @@ struct pppoe_softc {
|
|||||||
u8_t sc_state; /* discovery phase or session connected */
|
u8_t sc_state; /* discovery phase or session connected */
|
||||||
|
|
||||||
#if PPPOE_SCNAME_SUPPORT
|
#if PPPOE_SCNAME_SUPPORT
|
||||||
char *sc_service_name; /* if != NULL: requested name of service */
|
const char *sc_service_name; /* if != NULL: requested name of service */
|
||||||
char *sc_concentrator_name; /* if != NULL: requested concentrator id */
|
const char *sc_concentrator_name; /* if != NULL: requested concentrator id */
|
||||||
#endif /* PPPOE_SCNAME_SUPPORT */
|
#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[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */
|
||||||
u8_t sc_ac_cookie_len; /* length of cookie data */
|
u8_t sc_ac_cookie_len; /* length of cookie data */
|
||||||
|
@ -175,8 +175,10 @@ ppp_pcb *pppoe_create(struct netif *pppif,
|
|||||||
{
|
{
|
||||||
ppp_pcb *ppp;
|
ppp_pcb *ppp;
|
||||||
struct pppoe_softc *sc;
|
struct pppoe_softc *sc;
|
||||||
|
#if !PPPOE_SCNAME_SUPPORT
|
||||||
LWIP_UNUSED_ARG(service_name);
|
LWIP_UNUSED_ARG(service_name);
|
||||||
LWIP_UNUSED_ARG(concentrator_name);
|
LWIP_UNUSED_ARG(concentrator_name);
|
||||||
|
#endif /* !PPPOE_SCNAME_SUPPORT */
|
||||||
LWIP_ASSERT_CORE_LOCKED();
|
LWIP_ASSERT_CORE_LOCKED();
|
||||||
|
|
||||||
sc = (struct pppoe_softc *)LWIP_MEMPOOL_ALLOC(PPPOE_IF);
|
sc = (struct pppoe_softc *)LWIP_MEMPOOL_ALLOC(PPPOE_IF);
|
||||||
@ -193,6 +195,10 @@ ppp_pcb *pppoe_create(struct netif *pppif,
|
|||||||
memset(sc, 0, sizeof(struct pppoe_softc));
|
memset(sc, 0, sizeof(struct pppoe_softc));
|
||||||
sc->pcb = ppp;
|
sc->pcb = ppp;
|
||||||
sc->sc_ethif = ethif;
|
sc->sc_ethif = ethif;
|
||||||
|
#if PPPOE_SCNAME_SUPPORT
|
||||||
|
sc->sc_service_name = service_name;
|
||||||
|
sc->sc_concentrator_name = concentrator_name;
|
||||||
|
#endif /* PPPOE_SCNAME_SUPPORT */
|
||||||
/* put the new interface at the head of the list */
|
/* put the new interface at the head of the list */
|
||||||
sc->next = pppoe_softc_list;
|
sc->next = pppoe_softc_list;
|
||||||
pppoe_softc_list = sc;
|
pppoe_softc_list = sc;
|
||||||
@ -300,15 +306,6 @@ pppoe_destroy(ppp_pcb *ppp, void *ctx)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#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_SCNAME_SUPPORT */
|
|
||||||
LWIP_MEMPOOL_FREE(PPPOE_IF, sc);
|
LWIP_MEMPOOL_FREE(PPPOE_IF, sc);
|
||||||
|
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user