From 0c68fc409e80dcd36df94d2f7b266bf54b13c9dc Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 17 Jun 2012 00:33:02 +0200 Subject: [PATCH] fixed pppoe_find_softc_by_session() when we have the same PPPoE session id on 2 ethif --- src/netif/ppp/ppp_oe.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/netif/ppp/ppp_oe.c b/src/netif/ppp/ppp_oe.c index 4f1aed31..6bb21e24 100644 --- a/src/netif/ppp/ppp_oe.c +++ b/src/netif/ppp/ppp_oe.c @@ -134,8 +134,8 @@ static err_t pppoe_send_pads(struct pppoe_softc *); static err_t pppoe_send_padt(struct netif *, u_int, const u8_t *); /* internal helper functions */ -static struct pppoe_softc * pppoe_find_softc_by_session(u_int, struct netif *); -static struct pppoe_softc * pppoe_find_softc_by_hunique(u8_t *, size_t, struct netif *); +static struct pppoe_softc* pppoe_find_softc_by_session(u_int session, struct netif *rcvif); +static struct pppoe_softc* pppoe_find_softc_by_hunique(u8_t *token, size_t len, struct netif *rcvif); /** linked list of created pppoe interfaces */ static struct pppoe_softc *pppoe_softc_list; @@ -211,9 +211,7 @@ pppoe_destroy(struct netif *ifp) * and lean implementation, so number of open sessions typically should * be 1. */ -static struct pppoe_softc * -pppoe_find_softc_by_session(u_int session, struct netif *rcvif) -{ +static struct pppoe_softc* pppoe_find_softc_by_session(u_int session, struct netif *rcvif) { struct pppoe_softc *sc; if (session == 0) { @@ -222,22 +220,17 @@ pppoe_find_softc_by_session(u_int session, struct netif *rcvif) for (sc = pppoe_softc_list; sc != NULL; sc = sc->next) { if (sc->sc_state == PPPOE_STATE_SESSION - && sc->sc_session == session) { - if (sc->sc_ethif == rcvif) { - return sc; - } else { - return NULL; + && sc->sc_session == session + && sc->sc_ethif == rcvif) { + return sc; } - } } return NULL; } /* Check host unique token passed and return appropriate softc pointer, * or NULL if token is bogus. */ -static struct pppoe_softc * -pppoe_find_softc_by_hunique(u8_t *token, size_t len, struct netif *rcvif) -{ +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) {