From 936c6c0d5ccbee0892f766cdfa7a193372204370 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sun, 15 Jul 2012 15:12:40 +0200 Subject: [PATCH] reduced call stack by one when receiving a PPPoE disc packet --- src/netif/ppp/ppp_oe.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/netif/ppp/ppp_oe.c b/src/netif/ppp/ppp_oe.c index c18f67a2..b78ec301 100644 --- a/src/netif/ppp/ppp_oe.c +++ b/src/netif/ppp/ppp_oe.c @@ -112,9 +112,6 @@ static char pppoe_error_tmp[PPPOE_ERRORSTRING_LEN]; -/* input routines */ -static void pppoe_dispatch_disc_pkt(struct netif *, struct pbuf *); - /* management routines */ static int pppoe_do_disconnect(struct pppoe_softc *); static void pppoe_abort_connect(struct pppoe_softc *); @@ -273,8 +270,8 @@ pppoe_linkstatus_up(struct pppoe_softc *sc) } /* analyze and handle a single received packet while not in session state */ -static void -pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb) +void +pppoe_disc_input(struct netif *netif, struct pbuf *pb) { u16_t tag, len; u16_t session, plen; @@ -292,6 +289,12 @@ pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb) int off, err; struct eth_hdr *ethhdr; + /* don't do anything if there is not a single PPPoE instance */ + if (pppoe_softc_list == NULL) { + pbuf_free(pb); + return; + } + pb = ppp_singlebuf(pb); strcpy(devname, "pppoe"); /* as long as we don't know which instance */ @@ -534,18 +537,6 @@ done: return; } -/* FIXME: is this shit really necessary, why we don't call pppoe_dispatch_disc_pkt() instead !? */ -void -pppoe_disc_input(struct netif *netif, struct pbuf *p) -{ - /* avoid error messages if there is not a single pppoe instance */ - if (pppoe_softc_list != NULL) { - pppoe_dispatch_disc_pkt(netif, p); - } else { - pbuf_free(p); - } -} - void pppoe_data_input(struct netif *netif, struct pbuf *pb) {