PPP, PPPoE: remove useless checks

pppoe_softc_list is always not null when pppoe_find_softc_by_session is
called, furthermore pppoe_softc_list being null here does not hurt.

session is still checked whatsoever in pppoe_find_softc_by_session,
prechecking the session value for a value which can't really happen
except for forged frames does not add any value.
This commit is contained in:
Sylvain Rochet 2016-08-08 00:14:45 +02:00
parent 455a41822e
commit 953dd5b628

View File

@ -321,10 +321,6 @@ pppoe_destroy(ppp_pcb *ppp, void *ctx)
static struct pppoe_softc* pppoe_find_softc_by_session(u_int session, struct netif *rcvif) {
struct pppoe_softc *sc;
if (session == 0) {
return NULL;
}
for (sc = pppoe_softc_list; sc != NULL; sc = sc->next) {
if (sc->sc_state == PPPOE_STATE_SESSION
&& sc->sc_session == session
@ -340,10 +336,6 @@ static struct pppoe_softc* pppoe_find_softc_by_session(u_int session, struct net
static struct pppoe_softc* pppoe_find_softc_by_hunique(u8_t *token, size_t len, struct netif *rcvif) {
struct pppoe_softc *sc, *t;
if (pppoe_softc_list == NULL) {
return NULL;
}
if (len != sizeof sc) {
return NULL;
}