From fe1bea9538a827015177c9db0deb04f7e83dcbde Mon Sep 17 00:00:00 2001 From: christiaans Date: Thu, 2 Nov 2006 12:25:57 +0000 Subject: [PATCH] Added netif_set_up and call protection for NULL function pointers. Bug #16602 and #17777. --- src/netif/ppp/ppp.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index df402189..5295f6a0 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -1007,8 +1007,10 @@ int sifup(int pd) } else { netif_remove(&pc->netif); if (netif_add(&pc->netif, &pc->addrs.our_ipaddr, &pc->addrs.netmask, &pc->addrs.his_ipaddr, (void *)pd, pppifNetifInit, ip_input)) { - pc->if_up = 1; - pc->errCode = PPPERR_NONE; + + netif_set_up(&pc->netif); + pc->if_up = 1; + pc->errCode = PPPERR_NONE; PPPDEBUG((LOG_DEBUG, "sifup: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode)); if(pc->linkStatusCB) @@ -1322,7 +1324,9 @@ static void pppInput(void *arg) * pass the result to IP. */ if (vj_uncompress_tcp(&nb, &pppControl[pd].vjComp) >= 0) { - pppControl[pd].netif.input(nb, &pppControl[pd].netif); + if (pppControl[pd].netif.input != NULL) { + pppControl[pd].netif.input(nb, &pppControl[pd].netif); + } return; } /* Something's wrong so drop it. */ @@ -1340,7 +1344,9 @@ static void pppInput(void *arg) * the packet to IP. */ if (vj_uncompress_uncomp(nb, &pppControl[pd].vjComp) >= 0) { - pppControl[pd].netif.input(nb, &pppControl[pd].netif); + if (pppControl[pd].netif.input != NULL) { + pppControl[pd].netif.input(nb, &pppControl[pd].netif); + } return; } /* Something's wrong so drop it. */ @@ -1354,7 +1360,9 @@ static void pppInput(void *arg) break; case PPP_IP: /* Internet Protocol */ PPPDEBUG((LOG_INFO, "pppInput[%d]: ip in pbuf len=%d\n", pd, nb->len)); - pppControl[pd].netif.input(nb, &pppControl[pd].netif); + if (pppControl[pd].netif.input != NULL) { + pppControl[pd].netif.input(nb, &pppControl[pd].netif); + } return; default: {