lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] arp reply, no ping


From: Charles-Christophe Thomart
Subject: RE: [lwip-users] arp reply, no ping
Date: Tue, 16 Aug 2005 09:52:45 +0200

Thanks Chris, this helped me solve one of my problems.

I am using lwIP/ppp on home phones, and had a problem with packets not redirected to the ppp stack. The reason was that netif->flags was not set with NETIF_FLAG_UP. For what I see in lwip/ppp code, the netif_set_up function is never called (my version is CVS, two weeks old).

I suggest the following change:
===== ppp/ppp.c line 996 =====
/*
 * sifup - Config the interface up and enable IP packets to pass.
 */
int sifup(int pd)
{
    PPPControl *pc = &pppControl[pd];
    int st = 1;

    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
        st = 0;
        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", 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);

PPPDEBUG((LOG_DEBUG, "sifup: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
   if(pc->linkStatusCB)
    pc->linkStatusCB(pc->linkStatusCtx, pc->errCode, &pc->addrs);
  } else {
         st = 0;
         PPPDEBUG((LOG_ERR, "sifup[%d]: netif_add failed\n", pd));
  }
    }

    return st;
}
==========

There is no need for error checking since it is just a flag to set.
I do not see a better place to put it since the netif structure is not given to the user callback function. PPP could just want to create interface and let user set it up, but then the comment of this function seems wrong to me.
Please correct me if you think I did not get the catch.

Cheers,
Charles-Christophe

I found and fixed the problem that I earlier reported.>
After setting my ethernet interface as the default interface with netif_set_default(ethif), I apparently needed to bring it up with >netif_set_up(ethif). This was not done in the contrib/ports/unix/minimal/main.c code. Is this code outdated?


Cheers,
Chris





reply via email to

[Prev in Thread] Current Thread [Next in Thread]