freeRTOS + lwIP + ppp

nobody wrote on Wednesday, September 06, 2006:

Nice one.

nobody wrote on Wednesday, September 06, 2006:

Thanks a lot. Changes are merged into my codebase. From what I found looking at the sourcecode and verifying myself:

- The counting variables was wrong.
- a vPortFree was missing for the TCB
- call to vTaskSuspend is no longer necessary.

Did I miss anything? I left the ASSERT statements in as well as the call to THREAD_INIT in the remove function because it makes debugging easier. For example if some function illegaly holds a pointer to the TCB.

Kind regards,
  Christian Walter

rtel wrote on Wednesday, September 06, 2006:

I have not been able to keep up with this thread.  Is there anything in the SAM7X demo in the FreeRTOS.org download that needs changing?

Thanks and regards.

nobody wrote on Wednesday, September 06, 2006:

Hello,

I think the following code fragment is critical in sys_thread_new:


else
{
result = xTaskCreate( thread, ( signed portCHAR * ) “WEBSvr”, lwipBASIC_SERVER_STACK_SIZE, arg, prio, &CreatedTask );
}
// For each task created, store the task handle (pid) in the timers array.
// This scheme doesn’t allow for threads to be deleted
timeoutlist[nextthread++].pid = CreatedTask;

The problem in my opinion is that xTaskCreate might decide to switch the context and starts executing the thread ( at the bottom of xTaskCreate ). This happens when the priority of the caller is lower. In this case thread gets executed but its timeout list is not ready ( because the assignment comes later). This was the reason why I added a call to vTaskSuspendAll.

The next find I would like to point out is that most of the functions assume a TICK_RATE of 1000 because lwIP gives its arguments in microseconds. This is not a real problem and will propably not trigger a bug.

Kind regards,
  Christian Walter

nobody wrote on Wednesday, September 06, 2006:

you have found all bug which I corrected. I commented the ASSERTs for my custom code but only for this moment until I don’t get full working freeRTOS+lwIP+ppp. Now it looks very nice.
I think interesting here is thread about -O flag for GNU GCC users.

Janusz

nobody wrote on Monday, September 11, 2006:

next little "bugs" in sys_arch.c:

//unsigned long
u32_t
sys_jiffies( void )

is the field char            name[THREAD_NAME_LEN_MAX]; necessary in sys_tcb_t structure? I think it doesn’t bacuse you can use one variable in create task. What do you think about?

why did you use INIT_THREAD before free tcb in task remove?

it could be nice add to all asserts \r like everywhere…

ppp.c:  __attribute__((naked)) for pppMain is good idea…

Janusz

nobody wrote on Monday, September 11, 2006:

Hello,

1) Thanks a lot for the u32_t/unsigned long thing.

   Status: Fixed in CVS

2) I added the name fields to make debugging easier for myself. I think we can remove them now because they waste memory.

   Status: Fixed in CVS. Now uses stack space and the define configMAX_TASK_NAME_LEN from the FreeRTOS porting layer.

3) I always zero out variables which contain sensible information before passing them to free. This make sures that in case something else ( which in this case has a bug ) has a pointer to this memory I will notice it immediately. Maybe you can call it defensive programming. Again can be dropped for performance reasons.

  Status: Not removed.

4) I removed all \r or \n characters in the strings because I think they should not be in the assert message. This is also now consistent with lwIP where also no newlines are in the statements.

   Status: Fixed in CVS.

5) The attribute is a good. The only thing to consider is that this will add a GCC dependency.

   Status: Need to think about it how to do that in a portable way.

Thanks a lot for all your feedback,
  Christian Walter

nobody wrote on Monday, September 11, 2006:

sorry for  __attribute__((naked)) in ppp.c, it can cause the OS will crash!!! do not do it! I experiented that situation today.

Janusz

nobody wrote on Monday, September 11, 2006:

another hint in ppp.c

    /* Remove this thread from the running ones. */
    sys_arch_thread_remove( sys_arch_thread_current( ) );
    LWIP_ASSERT( "pppMain: sys_arch_thread_remove did return\n", 0 );

is it good order the last two lines?
why did you comment             /* PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d sio_read len=%d returned %d\n", pd, p->len, c)); */?

Janusz

nobody wrote on Monday, September 11, 2006:

Hello,

Yes this is intended. If the remove works as expected this line is never executed. In case it is it is a bug. The context switch is made within TaskDelete in FreeRTOS after the task has been removed from the ready list.

I commented the pppMainWakeup because at 115200 and high speed a lot of CPU time was spent within this debug calls.

Christian

nobody wrote on Tuesday, September 12, 2006:

ok, thanks for the explanation.
Have you ever thought about  #13315 bug:    PPP PAP authentication can result in erroneous callbacks? I didn’t noticed this bug. I tried to comment line     //if (u->us_clientstate == UPAPCS_AUTHREQ)    /* Timeout pending? */        // JU - bug #13315 in upap_lowerdown(). I’m not sure whether the bug is indeed. What do you think about?

Janusz

nobody wrote on Tuesday, September 12, 2006:

hi,

I have checked. I made some tests with connection/disconnection process. I tested with pppd and GPRS modem.
results (with the same software):
- pppd without authorization - it is ok
- GPRS modem with pap authorization - after 2-3 reconnections there is NO FREE MBUFS! message. It is after MAGIC NUMBER and upap_lowerdown! So the bug exists I think.

solution:
- I have tried to comment the line like before but without any effect (maybe little better, more reconnection but nothing more)
- ??? I have not idea now.

Janusz

nobody wrote on Tuesday, September 12, 2006:

I did check the bug report but I think he stated in its report that the problem actually ist that the auth code accesses resources which are no longer available (because the LCP has shutdown).

I think a good start to verify this claim is to find all blocks where the auth code allocates memory and where they are freed again. Then add a print statement around them and put a breakpoint somewhere. Or maybe it is not in the AUTH but the other code lacks memory when AUTH is enabled. I did not have any time but I assume that the AUTH code runs in the same thread the PPP main itself, right?

I would love to work on this issue but sadly I am quite short on time.

Kind regards,
  Christian Walter

nobody wrote on Wednesday, September 13, 2006:

You idea is very good. I have done that and now I am sure the reconnecting problem is inside ppp.c. pppInProc allocates pbuf’s but not always frees them! After about 5 reconnection wih 4000 lwIP cheap size you have NO FREE MBUFS message.

thanks a lot, I am still looking for the detail reason.
Janusz

nobody wrote on Wednesday, September 13, 2006:

ppp.c:
/*****************************************************************************
* ppp.c - Network Point to Point Protocol program file.
*
* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
* portions Copyright (c) 1997 by Global Election Systems Inc.
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice and the following disclaimer are included verbatim in any
* distributions. No written agreement, license, or royalty fee is required
* for any of the authorized uses.
*
* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
* REVISION HISTORY
*
* 06-08-04 Christian Walter <wolti@sil.at>
*   pppOpen code now checks if thread creation was successfull. If not returns
*   an error.
*   pppMain now correctly closes the thread if it exists.
* 03-01-01 Marc Boucher <marc@mbsi.ca>
*   Ported to lwIP.
* 97-11-05 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
*   Original.
*****************************************************************************/

/*
* ppp_defs.h - PPP definitions.
*
* if_pppvar.h - private structures and declarations for PPP.
*
* Copyright (c) 1994 The Australian National University.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation is hereby granted, provided that the above copyright
* notice appears in all copies.  This software is provided without any
* warranty, express or implied. The Australian National University
* makes no representations about the suitability of this software for
* any purpose.
*
* IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
* PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
* THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*/

/*
* if_ppp.h - Point-to-Point Protocol definitions.
*
* Copyright (c) 1989 Carnegie Mellon University.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by Carnegie Mellon University.  The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS’’ AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/

#include <string.h>

#include "ppp.h"
#if PPP_SUPPORT > 0
#include "randm.h"
#include "fsm.h"
#if PAP_SUPPORT > 0
#include "pap.h"
#endif
#if CHAP_SUPPORT > 0
#include "chap.h"
#endif
#include "ipcp.h"
#include "lcp.h"
#include "magic.h"
#include "auth.h"
#if VJ_SUPPORT > 0
#include "vj.h"
#endif

#include "pppdebug.h"

/*************************/
/*** LOCAL DEFINITIONS ***/
/*************************/

/*
* The basic PPP frame.
*/
#define PPP_ADDRESS(p)  (((u_char *)(p))[0])
#define PPP_CONTROL(p)  (((u_char *)(p))[1])
#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])

/* PPP packet parser states.  Current state indicates operation yet to be
* completed. */
typedef enum {
    PDIDLE = 0,                 /* Idle state - waiting. */
    PDSTART,                    /* Process start flag. */
    PDADDRESS,                  /* Process address field. */
    PDCONTROL,                  /* Process control field. */
    PDPROTOCOL1,                /* Process protocol field 1. */
    PDPROTOCOL2,                /* Process protocol field 2. */
    PDDATA                      /* Process data byte. */
} PPPDevStates;

#define ESCAPE_P(accm, c) ((accm)[(c) >> 3] & pppACCMMask[c & 0x07])

/************************/
/*** LOCAL DATA TYPES ***/
/************************/
/*
* PPP interface control block.
*/
typedef struct PPPControl_s {
    char openFlag;                      /* True when in use. */
    char oldFrame;                      /* Old framing character for fd. */
    sio_fd_t fd;                    /* File device ID of port. */
    int  kill_link;                     /* Shut the link down. */
    int  sig_hup;                       /* Carrier lost. */
    int  if_up;                         /* True when the interface is up. */
    int  errCode;                       /* Code indicating why interface is down. */
    struct pbuf *inHead, *inTail;       /* The input packet. */
    PPPDevStates inState;               /* The input process state. */
    char inEscaped;                     /* Escape next character. */
    u16_t inProtocol;                   /* The input protocol code. */
    u16_t inFCS;                        /* Input Frame Check Sequence value. */
    int  mtu;                           /* Peer’s mru */
    int  pcomp;                         /* Does peer accept protocol compression? */
    int  accomp;                        /* Does peer accept addr/ctl compression? */
    u_long lastXMit;                    /* Time of last transmission. */
    ext_accm inACCM;                    /* Async-Ctl-Char-Map for input. */
    ext_accm outACCM;                   /* Async-Ctl-Char-Map for output. */
#if VJ_SUPPORT > 0
    int  vjEnabled;                     /* Flag indicating VJ compression enabled. */
    struct vjcompress vjComp;           /* Van Jabobsen compression header. */
#endif

    struct netif netif;

    struct ppp_addrs addrs;

    void (*linkStatusCB)(void *ctx, int errCode, void *arg);
    void *linkStatusCtx;

} PPPControl;

/*
* Ioctl definitions.
*/

struct npioctl {
    int     protocol;           /* PPP procotol, e.g. PPP_IP */
    enum NPmode mode;
};

/***********************************/
/*** LOCAL FUNCTION DECLARATIONS ***/
/***********************************/
static void pppMain(void *pd);
static void pppDrop(PPPControl *pc);
static void pppInProc(int pd, u_char *s, int l);

/******************************/
/*** PUBLIC DATA STRUCTURES ***/
/******************************/
u_long subnetMask;

static PPPControl pppControl[NUM_PPP]; /* The PPP interface control blocks. */

/*
* PPP Data Link Layer "protocol" table.
* One entry per supported protocol.
* The last entry must be NULL.
*/
struct protent *ppp_protocols[] = {
    &lcp_protent,
#if PAP_SUPPORT > 0
    &pap_protent,
#endif
#if CHAP_SUPPORT > 0
    &chap_protent,
#endif
#if CBCP_SUPPORT > 0
    &cbcp_protent,
#endif
    &ipcp_protent,
#if CCP_SUPPORT > 0
    &ccp_protent,
#endif
    NULL
};

/*
* Buffers for outgoing packets.  This must be accessed only from the appropriate
* PPP task so that it doesn’t need to be protected to avoid collisions.
*/
u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN]; 

/*****************************/
/*** LOCAL DATA STRUCTURES ***/
/*****************************/

/*
* FCS lookup table as calculated by genfcstab.
*/
static const u_short fcstab[256] = {
    0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
    0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
    0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
    0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876,
    0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd,
    0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5,
    0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c,
    0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974,
    0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb,
    0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3,
    0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a,
    0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72,
    0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9,
    0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1,
    0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738,
    0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70,
    0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7,
    0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff,
    0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036,
    0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e,
    0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5,
    0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd,
    0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134,
    0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c,
    0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3,
    0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb,
    0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232,
    0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a,
    0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1,
    0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9,
    0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
    0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
};

/* PPP’s Asynchronous-Control-Character-Map.  The mask array is used
* to select the specific bit for a character. */
static u_char pppACCMMask[] = {
    0x01,
    0x02,
    0x04,
    0x08,
    0x10,
    0x20,
    0x40,
    0x80
};

/***********************************/
/*** PUBLIC FUNCTION DEFINITIONS ***/
/***********************************/
/* Initialize the PPP subsystem. */

struct ppp_settings ppp_settings;

void pppInit(void)
{
    struct protent *protp;
    int i, j;
   
    memset(&ppp_settings, 0, sizeof(ppp_settings));
    ppp_settings.usepeerdns = 1;
    pppSetAuth(PPPAUTHTYPE_NONE, NULL, NULL);

    magicInit();

    for (i = 0; i < NUM_PPP; i++) {
        pppControl[i].openFlag = 0;

        subnetMask = htonl(0xffffff00);
   
        /*
         * Initialize to the standard option set.
         */
        for (j = 0; (protp = ppp_protocols[j]) != NULL; ++j)
            (*protp->init)(i);
    }

#if LINK_STATS
    /* Clear the statistics. */
    memset(&lwip_stats.link, 0, sizeof(lwip_stats.link));
#endif
}

void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd)
{
    switch(authType) {
    case PPPAUTHTYPE_NONE:
    default:
#ifdef LWIP_PPP_STRICT_PAP_REJECT
        ppp_settings.refuse_pap = 1;
#else
        /* some providers request pap and accept an empty login/pw */
        ppp_settings.refuse_pap = 0;
#endif
        ppp_settings.refuse_chap = 1;
        break;
    case PPPAUTHTYPE_ANY:
/* Warning: Using PPPAUTHTYPE_ANY might have security consequences.
* RFC 1994 says:
*
* In practice, within or associated with each PPP server, there is a
* database which associates "user" names with authentication
* information ("secrets").  It is not anticipated that a particular
* named user would be authenticated by multiple methods.  This would
* make the user vulnerable to attacks which negotiate the least secure
* method from among a set (such as PAP rather than CHAP).  If the same
* secret was used, PAP would reveal the secret to be used later with
* CHAP.
*
* Instead, for each user name there should be an indication of exactly
* one method used to authenticate that user name.  If a user needs to
* make use of different authentication methods under different
* circumstances, then distinct user names SHOULD be employed, each of
* which identifies exactly one authentication method.
*
*/
        ppp_settings.refuse_pap = 0;
        ppp_settings.refuse_chap = 0;
        break;
    case PPPAUTHTYPE_PAP:
        ppp_settings.refuse_pap = 0;
        ppp_settings.refuse_chap = 1;
        break;
    case PPPAUTHTYPE_CHAP:
        ppp_settings.refuse_pap = 1;
        ppp_settings.refuse_chap = 0;
        break;
    }

    if(user) {
    strncpy(ppp_settings.user, user, sizeof(ppp_settings.user)-1);
    ppp_settings.user[sizeof(ppp_settings.user)-1] = ‘\0’;
    } else
    ppp_settings.user[0] = ‘\0’;

    if(passwd) {
    strncpy(ppp_settings.passwd, passwd, sizeof(ppp_settings.passwd)-1);
    ppp_settings.passwd[sizeof(ppp_settings.passwd)-1] = ‘\0’;
    } else
    ppp_settings.passwd[0] = ‘\0’;
}

/* Open a new PPP connection using the given I/O device.
* This initializes the PPP control block but does not
* attempt to negotiate the LCP session.  If this port
* connects to a modem, the modem connection must be
* established before calling this.
* Return a new PPP connection descriptor on success or
* an error code (negative) on failure. */
int pppOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx)
{
    PPPControl *pc;
    int pd;

    /* Find a free PPP session descriptor. Critical region? */
    for (pd = 0; pd < NUM_PPP && pppControl[pd].openFlag != 0; pd++);
    if (pd >= NUM_PPP)
        pd = PPPERR_OPEN;
    else
        pppControl[pd].openFlag = !0;

    /* Launch a deamon thread. */
    if (pd >= 0) {

        pppControl[pd].openFlag = 1;

        lcp_init(pd);
        pc = &pppControl[pd];
        pc->fd = fd;
        pc->kill_link = 0;
        pc->sig_hup = 0;
        pc->if_up = 0;
        pc->errCode = 0;
        pc->inState = PDIDLE;
        pc->inHead = NULL;
        pc->inTail = NULL;
        pc->inEscaped = 0;
        pc->lastXMit = 0;

#if VJ_SUPPORT > 0
        pc->vjEnabled = 0;
        vj_compress_init(&pc->vjComp);
#endif

        /*
         * Default the in and out accm so that escape and flag characters
         * are always escaped.
         */
        memset(pc->inACCM, 0, sizeof(ext_accm));
        pc->inACCM[15] = 0x60;
        memset(pc->outACCM, 0, sizeof(ext_accm));
        pc->outACCM[15] = 0x60;

        pc->linkStatusCB = linkStatusCB;
        pc->linkStatusCtx = linkStatusCtx;

        if( sys_thread_new(pppMain, (void*)pd, PPP_THREAD_PRIO) != SYS_THREAD_NULL )
        {
            if(!linkStatusCB) {
                while(pd >= 0 && !pc->if_up) {
                    sys_msleep(500);
                    if (lcp_phase[pd] == PHASE_DEAD) {
                        pppClose(pd);
                        if (pc->errCode)
                            pd = pc->errCode;
                        else
                            pd = PPPERR_CONNECT;
                    }
                }
            }
        }
        else
        {
            pc->openFlag = 0;
            pd = PPPERR_ALLOC;
        }
    }
    return pd;
}

/* Close a PPP connection and release the descriptor.
* Any outstanding packets in the queues are dropped.
* Return 0 on success, an error code on failure. */
int pppClose(int pd)
{
    PPPControl *pc = &pppControl[pd];
    int st = 0;

    /* Disconnect */
    pc->kill_link = !0;
    pppMainWakeup(pd);
   
    if(!pc->linkStatusCB) {
        while(st >= 0 && lcp_phase[pd] != PHASE_DEAD) {
            sys_msleep(500);
            break;
        }
    }
    return st;
}

/* This function is called when carrier is lost on the PPP channel. */
void pppSigHUP(int pd)
{
    PPPControl *pc = &pppControl[pd];

    pc->sig_hup = 1;
    pppMainWakeup(pd);
}

static void nPut(PPPControl *pc, struct pbuf *nb)
{
    struct pbuf *b;
    int c;

    for(b = nb; b != NULL; b = b->next) {
        if((c = sio_write(pc->fd, b->payload, b->len)) != b->len) {
        PPPDEBUG((LOG_WARNING,
                "PPP nPut: incomplete sio_write(%d, %u) = %d\n", pc->fd, b->len, c));
#if LINK_STATS
        lwip_stats.link.err++;
#endif /* LINK_STATS */
        pc->lastXMit = 0; /* prepend PPP_FLAG to next packet */
        break;
        }
    }
    PPPDEBUG((LOG_WARNING, "nPut: pbuf free %08x\n", nb));    //JU
    pbuf_free(nb);

#if LINK_STATS
    lwip_stats.link.xmit++;
#endif /* LINK_STATS */
}

/*
* pppAppend - append given character to end of given pbuf.  If outACCM
* is not NULL and the character needs to be escaped, do so.
* If pbuf is full, append another.
* Return the current pbuf.
*/
static struct pbuf *pppAppend(u_char c, struct pbuf *nb, ext_accm *outACCM)
{
    struct pbuf *tb = nb;
   
    /* Make sure there is room for the character and an escape code.
     * Sure we don’t quite fill the buffer if the character doesn’t
     * get escaped but is one character worth complicating this? */
    /* Note: We assume no packet header. */
    if (nb && (PBUF_POOL_BUFSIZE - nb->len) < 2) {
    tb = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
    PPPDEBUG((LOG_WARNING, “pppAppend: pbuf alloc %08x\n”, tb));    //JU
    if (tb) {
        nb->next = tb;
        }
#if LINK_STATS
    else {
        lwip_stats.link.memerr++;
    }
#endif /* LINK_STATS */
    nb = tb;
    }
    if (nb) {
    if (outACCM && ESCAPE_P(*outACCM, c)) {
            *((u_char*)nb->payload + nb->len++) = PPP_ESCAPE;
            *((u_char*)nb->payload + nb->len++) = c ^ PPP_TRANS;
        }
        else
            *((u_char*)nb->payload + nb->len++) = c;
    }
       
    return tb;
}

/* Send a packet on the given connection. */
static err_t pppifOutput(struct netif *netif, struct pbuf *pb, struct ip_addr *ipaddr)
{
    int pd = (int)netif->state;
    u_short protocol = PPP_IP;
    PPPControl *pc = &pppControl[pd];
    u_int fcsOut = PPP_INITFCS;
    struct pbuf *headMB = NULL, *tailMB = NULL, *p;
    u_char c;

    (void)ipaddr;

    /* Validate parameters. */
    /* We let any protocol value go through - it can’t hurt us
     * and the peer will just drop it if it’s not accepting it. */
    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag || !pb) {
        PPPDEBUG((LOG_WARNING, “pppifOutput[%d]: bad parms prot=%d pb=%p\n”,
                    pd, protocol, pb));
#if LINK_STATS
        lwip_stats.link.opterr++;
        lwip_stats.link.drop++;
#endif
        return ERR_ARG;
    }

    /* Check that the link is up. */
    if (lcp_phase[pd] == PHASE_DEAD) {
        PPPDEBUG((LOG_ERR, "pppifOutput[%d]: link not up\n", pd));
#if LINK_STATS
        lwip_stats.link.rterr++;
        lwip_stats.link.drop++;
#endif
        return ERR_RTE;
    }

    /* Grab an output buffer. */
    headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
    PPPDEBUG((LOG_WARNING, "pppifOutput: pbuf alloc %08x\n", headMB));    //JU
    if (headMB == NULL) {
        PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: first alloc fail\n", pd));
#if LINK_STATS
        lwip_stats.link.memerr++;
        lwip_stats.link.drop++;
#endif /* LINK_STATS */
        return ERR_MEM;
    }
       
#if VJ_SUPPORT > 0
    /*
     * Attempt Van Jacobson header compression if VJ is configured and
     * this is an IP packet.
     */
    if (protocol == PPP_IP && pc->vjEnabled) {
        switch (vj_compress_tcp(&pc->vjComp, pb)) {
        case TYPE_IP:
            /* No change…
            protocol = PPP_IP_PROTOCOL;
             */
            break;
        case TYPE_COMPRESSED_TCP:
            protocol = PPP_VJC_COMP;
            break;
        case TYPE_UNCOMPRESSED_TCP:
            protocol = PPP_VJC_UNCOMP;
            break;
        default:
            PPPDEBUG((LOG_WARNING, "pppifOutput[%d]: bad IP packet\n", pd));
#if LINK_STATS
            lwip_stats.link.proterr++;
            lwip_stats.link.drop++;
#endif
            PPPDEBUG((LOG_WARNING, "pppifOutput: pbuf free %08x\n", headMB));    //JU
            pbuf_free(headMB);
            return ERR_VAL;
        }
    }
#endif
       
    tailMB = headMB;
       
    /* Build the PPP header. */
    if ((sys_jiffies() - pc->lastXMit) >= PPP_MAXIDLEFLAG)
        tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
    pc->lastXMit = sys_jiffies();
    if (!pc->accomp) {
        fcsOut = PPP_FCS(fcsOut, PPP_ALLSTATIONS);
        tailMB = pppAppend(PPP_ALLSTATIONS, tailMB, &pc->outACCM);
        fcsOut = PPP_FCS(fcsOut, PPP_UI);
        tailMB = pppAppend(PPP_UI, tailMB, &pc->outACCM);
    }
    if (!pc->pcomp || protocol > 0xFF) {
        c = (protocol >> 8) & 0xFF;
        fcsOut = PPP_FCS(fcsOut, c);
        tailMB = pppAppend(c, tailMB, &pc->outACCM);
    }
    c = protocol & 0xFF;
    fcsOut = PPP_FCS(fcsOut, c);
    tailMB = pppAppend(c, tailMB, &pc->outACCM);
   
    /* Load packet. */
    for(p = pb; p; p = p->next) {
        int n;
        u_char *sPtr;

        sPtr = (u_char*)p->payload;
        n = p->len;
        while (n-- > 0) {
            c = *sPtr++;
           
            /* Update FCS before checking for special characters. */
            fcsOut = PPP_FCS(fcsOut, c);
           
            /* Copy to output buffer escaping special characters. */
            tailMB = pppAppend(c, tailMB, &pc->outACCM);
        }
    }

    /* Add FCS and trailing flag. */
    c = ~fcsOut & 0xFF;
    tailMB = pppAppend(c, tailMB, &pc->outACCM);
    c = (~fcsOut >> 8) & 0xFF;
    tailMB = pppAppend(c, tailMB, &pc->outACCM);
    tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
       
    /* If we failed to complete the packet, throw it away. */
    if (!tailMB) {
        PPPDEBUG((LOG_WARNING,
                    "pppifOutput[%d]: Alloc err - dropping proto=%d\n",
                    pd, protocol));
        PPPDEBUG((LOG_WARNING, "pppifOutput: pbuf free %08x\n", headMB));    //JU
        pbuf_free(headMB);
#if LINK_STATS
        lwip_stats.link.memerr++;
        lwip_stats.link.drop++;
#endif
        return ERR_MEM;
    }

    /* Send it. */
    PPPDEBUG((LOG_INFO, "pppifOutput[%d]: proto=0x%04X\n", pd, protocol));

    nPut(pc, headMB);

    return ERR_OK;
}

/* Get and set parameters for the given connection.
* Return 0 on success, an error code on failure. */
int  pppIOCtl(int pd, int cmd, void *arg)
{
    PPPControl *pc = &pppControl[pd];
    int st = 0;

    if (pd < 0 || pd >= NUM_PPP)
        st = PPPERR_PARAM;
    else {
        switch(cmd) {
        case PPPCTLG_UPSTATUS:      /* Get the PPP up status. */
            if (arg)
                *(int *)arg = (int)(pc->if_up);
            else
                st = PPPERR_PARAM;
            break;
        case PPPCTLS_ERRCODE:       /* Set the PPP error code. */
            if (arg)
                pc->errCode = *(int *)arg;
            else
                st = PPPERR_PARAM;
            break;
        case PPPCTLG_ERRCODE:       /* Get the PPP error code. */
            if (arg)
                *(int *)arg = (int)(pc->errCode);
            else
                st = PPPERR_PARAM;
            break;
        case PPPCTLG_FD:
            if (arg)
                *(sio_fd_t *)arg = pc->fd;
            else
                st = PPPERR_PARAM;
            break;
        default:
            st = PPPERR_PARAM;
            break;
        }
    }
   
    return st;
}

/*
* Return the Maximum Transmission Unit for the given PPP connection.
*/
u_int pppMTU(int pd)
{
    PPPControl *pc = &pppControl[pd];
    u_int st;
   
    /* Validate parameters. */
    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag)
        st = 0;
    else
        st = pc->mtu;
       
    return st;
}

/*
* Write n characters to a ppp link.
*  RETURN: >= 0 Number of characters written
*           -1 Failed to write to device
*/
int pppWrite(int pd, const u_char *s, int n)
{
    PPPControl *pc = &pppControl[pd];
    u_char c;
    u_int fcsOut = PPP_INITFCS;
    struct pbuf *headMB = NULL, *tailMB;
    headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
    PPPDEBUG((LOG_WARNING, "pppWrite: pbuf alloc %08x\n", headMB));    //JU
    if (headMB == NULL) {
#if LINK_STATS
        lwip_stats.link.memerr++;
        lwip_stats.link.proterr++;
#endif /* LINK_STATS */
        return PPPERR_ALLOC;
    }

    tailMB = headMB;
       
    /* If the link has been idle, we’ll send a fresh flag character to
     * flush any noise. */
    if ((sys_jiffies() - pc->lastXMit) >= PPP_MAXIDLEFLAG)
        tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
    pc->lastXMit = sys_jiffies();
    
    /* Load output buffer. */
    while (n-- > 0) {
        c = *s++;
       
        /* Update FCS before checking for special characters. */
        fcsOut = PPP_FCS(fcsOut, c);
       
        /* Copy to output buffer escaping special characters. */
        tailMB = pppAppend(c, tailMB, &pc->outACCM);
    }
   
    /* Add FCS and trailing flag. */
    c = ~fcsOut & 0xFF;
    tailMB = pppAppend(c, tailMB, &pc->outACCM);
    c = (~fcsOut >> 8) & 0xFF;
    tailMB = pppAppend(c, tailMB, &pc->outACCM);
    tailMB = pppAppend(PPP_FLAG, tailMB, NULL);
       
    /* If we failed to complete the packet, throw it away.
     * Otherwise send it. */
    if (!tailMB) {
        PPPDEBUG((LOG_WARNING,
                “pppWrite[%d]: Alloc err - dropping pbuf len=%d\n”, pd, headMB->len));
/*                “pppWrite[%d]: Alloc err - dropping %d:%.*H”, pd, headMB->len, LWIP_MIN(headMB->len * 2, 40), headMB->payload)); */
        PPPDEBUG((LOG_WARNING, “pppWrite: pbuf free %08x\n”, headMB));    //JU
        pbuf_free(headMB);
#if LINK_STATS
        lwip_stats.link.memerr++;
        lwip_stats.link.proterr++;
#endif /* LINK_STATS */
        return PPPERR_ALLOC;
    }

    PPPDEBUG((LOG_INFO, "pppWrite[%d]: len=%d\n", pd, headMB->len));
/*     "pppWrite[%d]: %d:%.*H", pd, headMB->len, LWIP_MIN(headMB->len * 2, 40), headMB->payload)); */
    nPut(pc, headMB);

    return PPPERR_NONE;
}

/*
* ppp_send_config - configure the transmit characteristics of
* the ppp interface.
*/
void ppp_send_config(
    int unit,
    int mtu,
    u32_t asyncmap,
    int pcomp,
    int accomp
)
{
    PPPControl *pc = &pppControl[unit];
    int i;
   
    pc->mtu = mtu;
    pc->pcomp = pcomp;
    pc->accomp = accomp;
   
    /* Load the ACCM bits for the 32 control codes. */
    for (i = 0; i < 32/8; i++)
        pc->outACCM[i] = (u_char)((asyncmap >> (8 * i)) & 0xFF);
    PPPDEBUG((LOG_INFO, "ppp_send_config[%d]: outACCM=%X %X %X %X\n",
                unit,
                pc->outACCM[0], pc->outACCM[1], pc->outACCM[2], pc->outACCM[3]));
}

/*
* ppp_set_xaccm - set the extended transmit ACCM for the interface.
*/
void ppp_set_xaccm(int unit, ext_accm *accm)
{
    memcpy(pppControl[unit].outACCM, accm, sizeof(ext_accm));
    PPPDEBUG((LOG_INFO, "ppp_set_xaccm[%d]: outACCM=%X %X %X %X\n",
                unit,
                pppControl[unit].outACCM[0],
                pppControl[unit].outACCM[1],
                pppControl[unit].outACCM[2],
                pppControl[unit].outACCM[3]));
}

/*
* ppp_recv_config - configure the receive-side characteristics of
* the ppp interface.
*/
void ppp_recv_config(
    int unit,
    int mru,
    u32_t asyncmap,
    int pcomp,
    int accomp
)
{
    PPPControl *pc = &pppControl[unit];
    int i;
   
    (void)accomp;
    (void)pcomp;
    (void)mru;

    /* Load the ACCM bits for the 32 control codes. */
    for (i = 0; i < 32 / 8; i++)
        pc->inACCM[i] = (u_char)(asyncmap >> (i * 8));
    PPPDEBUG((LOG_INFO, "ppp_recv_config[%d]: inACCM=%X %X %X %X\n",
                unit,
                pc->inACCM[0], pc->inACCM[1], pc->inACCM[2], pc->inACCM[3]));
}

#if 0
/*
* ccp_test - ask kernel whether a given compression method
* is acceptable for use.  Returns 1 if the method and parameters
* are OK, 0 if the method is known but the parameters are not OK
* (e.g. code size should be reduced), or -1 if the method is unknown.
*/
int ccp_test(
    int unit,
    int opt_len,
    int for_transmit,
    u_char *opt_ptr
)
{
    return 0;   /* XXX Currently no compression. */
}

/*
* ccp_flags_set - inform kernel about the current state of CCP.
*/
void ccp_flags_set(int unit, int isopen, int isup)
{
    /* XXX */
}

/*
* ccp_fatal_error - returns 1 if decompression was disabled as a
* result of an error detected after decompression of a packet,
* 0 otherwise.  This is necessary because of patent nonsense.
*/
int ccp_fatal_error(int unit)
{
    /* XXX */
    return 0;
}
#endif

/*
* get_idle_time - return how long the link has been idle.
*/
int get_idle_time(int u, struct ppp_idle *ip)
{  
    /* XXX */
    (void)u;
    (void)ip;

    return 0;
}

/*
* Return user specified netmask, modified by any mask we might determine
* for address `addr’ (in network byte order).
* Here we scan through the system’s list of interfaces, looking for
* any non-point-to-point interfaces which might appear to be on the same
* network as `addr’.  If we find any, we OR in their netmask to the
* user-specified netmask.
*/
u32_t GetMask(u32_t addr)
{
    u32_t mask, nmask;
   
    htonl(addr);
    if (IN_CLASSA(addr))    /* determine network mask for address class */
        nmask = IN_CLASSA_NET;
    else if (IN_CLASSB(addr))
        nmask = IN_CLASSB_NET;
    else
        nmask = IN_CLASSC_NET;
    /* class D nets are disallowed by bad_ip_adrs */
    mask = subnetMask | htonl(nmask);
   
    /* XXX
     * Scan through the system’s network interfaces.
     * Get each netmask and OR them into our mask.
     */
   
    return mask;
}

/*
* sifvjcomp - config tcp header compression
*/
int sifvjcomp(
    int pd,
    int vjcomp,
    int cidcomp,
    int maxcid
)
{
#if VJ_SUPPORT > 0
    PPPControl *pc = &pppControl[pd];
   
    pc->vjEnabled = vjcomp;
    pc->vjComp.compressSlot = cidcomp;
    pc->vjComp.maxSlotIndex = maxcid;
    PPPDEBUG((LOG_INFO, "sifvjcomp: VJ compress enable=%d slot=%d max slot=%d\n",
                vjcomp, cidcomp, maxcid));
#endif

    return 0;
}

/*
* pppifNetifInit - netif init callback
*/
static err_t pppifNetifInit(struct netif *netif)
{
    netif->name[0] = ‘p’;
    netif->name[1] = ‘p’;
    netif->output = pppifOutput;
    netif->mtu = pppMTU((int)netif->state);
    return ERR_OK;
}

/*
* 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;
            /* bug #16602 */
            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;
}

/*
* sifnpmode - Set the mode for handling packets for a given NP.
*/
int sifnpmode(int u, int proto, enum NPmode mode)
{
    (void)u;
    (void)proto;
    (void)mode;
    return 0;
}

/*
* sifdown - Config the interface down and disable IP.
*/
int sifdown(int pd)
{
    PPPControl *pc = &pppControl[pd];
    int st = 1;
   
    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
        st = 0;
        PPPDEBUG((LOG_WARNING, "sifdown[%d]: bad parms\n", pd));
    } else {
        pc->if_up = 0;
    netif_remove(&pc->netif);
    PPPDEBUG((LOG_DEBUG, "sifdown: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
    if(pc->linkStatusCB)
        pc->linkStatusCB(pc->linkStatusCtx, PPPERR_CONNECT, NULL);
    }
    return st;
}

/*
* sifaddr - Config the interface IP addresses and netmask.
*/
int sifaddr(
    int pd,             /* Interface unit ??? */
    u32_t o,        /* Our IP address ??? */
    u32_t h,        /* His IP address ??? */
    u32_t m,        /* IP subnet mask ??? */
    u32_t ns1,      /* Primary DNS */
    u32_t ns2       /* Secondary DNS */
)
{
    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 {
        memcpy(&pc->addrs.our_ipaddr, &o, sizeof(o));
        memcpy(&pc->addrs.his_ipaddr, &h, sizeof(h));
        memcpy(&pc->addrs.netmask, &m, sizeof(m));
        memcpy(&pc->addrs.dns1, &ns1, sizeof(ns1));
        memcpy(&pc->addrs.dns2, &ns2, sizeof(ns2));
    }
    return st;
}

/*
* cifaddr - Clear the interface IP addresses, and delete routes
* through the interface if possible.
*/
int cifaddr(
    int pd,         /* Interface unit ??? */
    u32_t o,    /* Our IP address ??? */
    u32_t h     /* IP broadcast address ??? */
)
{
    PPPControl *pc = &pppControl[pd];
    int st = 1;
   
    (void)o;
    (void)h;
    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
        st = 0;
        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
    } else {
        IP4_ADDR(&pc->addrs.our_ipaddr, 0,0,0,0);
        IP4_ADDR(&pc->addrs.his_ipaddr, 0,0,0,0);
        IP4_ADDR(&pc->addrs.netmask, 255,255,255,0);
        IP4_ADDR(&pc->addrs.dns1, 0,0,0,0);
        IP4_ADDR(&pc->addrs.dns2, 0,0,0,0);
    }
    return st;
}

/*
* sifdefaultroute - assign a default route through the address given.
*/
int sifdefaultroute(int pd, u32_t l, u32_t g)
{
    PPPControl *pc = &pppControl[pd];
    int st = 1;
   
    (void)l;
    (void)g;
    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
        st = 0;
        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
    } else {
        netif_set_default(&pc->netif);
    }

    /* TODO: check how PPP handled the netMask, previously not set by ipSetDefault */

    return st;
}

/*
* cifdefaultroute - delete a default route through the address given.
*/
int cifdefaultroute(int pd, u32_t l, u32_t g)
{
    PPPControl *pc = &pppControl[pd];
    int st = 1;
   
    (void)l;
    (void)g;
    if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) {
        st = 0;
        PPPDEBUG((LOG_WARNING, "sifup[%d]: bad parms\n", pd));
    } else {
        netif_set_default(NULL);
    }

    return st;
}

void
pppMainWakeup(int pd)
{
    PPPDEBUG((LOG_DEBUG, "pppMainWakeup: unit %d\n", pd));
    sio_read_abort( pppControl[pd].fd );
}

/* these callbacks are necessary because lcp_* functions
   must be called in the same context as pppInput(),
   namely the tcpip_thread(), essentially because
   they manipulate timeouts which are thread-private
*/

static void
pppStartCB(void *arg)
{
    int pd = (int)arg;

    PPPDEBUG((LOG_DEBUG, "pppStartCB: unit %d\n", pd));
    lcp_lowerup(pd);
    lcp_open(pd);      /* Start protocol */
}

static void
pppStopCB(void *arg)
{
    int pd = (int)arg;

    PPPDEBUG((LOG_DEBUG, "pppStopCB: unit %d\n", pd));
    lcp_close(pd, "User request");
}

static void
pppHupCB(void *arg)
{
    int pd = (int)arg;

    PPPDEBUG((LOG_DEBUG, "pppHupCB: unit %d\n", pd));
    lcp_lowerdown(pd);
    link_terminated(pd);
}
/**********************************/
/*** LOCAL FUNCTION DEFINITIONS ***/
/**********************************/
/* The main PPP process function.  This implements the state machine according
* to section 4 of RFC 1661: The Point-To-Point Protocol. */
static void pppMain(void *arg)
{
    err_t   err;
    int pd = (int)arg;
    struct pbuf *p;
    PPPControl* pc;

    pc = &pppControl[pd];

    p = pbuf_alloc(PBUF_RAW, PPP_MRU+PPP_HDRLEN, PBUF_RAM);
    PPPDEBUG((LOG_WARNING, "pppMain: pbuf alloc %08x\n", p));    //JU
    if(!p) {
        LWIP_ASSERT("p != NULL", p);
        pc->errCode = PPPERR_ALLOC;
        goto out;
    }

    /*
     * Start the connection and handle incoming events (packet or timeout).
     */
    PPPDEBUG((LOG_INFO, “pppMain: unit %d: Connecting\n”, pd));
    err = tcpip_callback(pppStartCB, arg);
    LWIP_ASSERT( “pppMain: can’t install callback handler\n”, err == ERR_OK );
    while (lcp_phase[pd] != PHASE_DEAD) {
        if (pc->kill_link) {
            PPPDEBUG((LOG_DEBUG, “pppMainWakeup: unit %d kill_link -> pppStopCB\n”, pd));
        pc->errCode = PPPERR_USER;
        /* This will leave us at PHASE_DEAD. */
            tcpip_callback(pppStopCB, arg);
        pc->kill_link = 0;
        }
        else if (pc->sig_hup) {
            PPPDEBUG((LOG_DEBUG, “pppMainWakeup: unit %d sig_hup -> pppHupCB\n”, pd));
        pc->sig_hup = 0;
            tcpip_callback(pppHupCB, arg);
        } else {
        int c = sio_read(pc->fd, p->payload, p->len);
        if(c > 0) {
            pppInProc(pd, p->payload, c);
        } else {
            /* PPPDEBUG((LOG_DEBUG, “pppMainWakeup: unit %d sio_read len=%d returned %d\n”, pd, p->len, c)); */
        }
        }
    }
    PPPDEBUG((LOG_INFO, “pppMain: unit %d: PHASE_D EAD\n”, pd));
    PPPDEBUG((LOG_WARNING, “pppMain: pbuf free %08x\n”, p));    //JU
    pbuf_free(p);

out:
    PPPDEBUG((LOG_DEBUG, "pppMain: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
    if(pc->linkStatusCB)
        pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode : PPPERR_PROTOCOL, NULL);

    pc->openFlag = 0;

    /* Remove this thread from the running ones. */
    sys_arch_thread_remove( sys_arch_thread_current( ) );
    LWIP_ASSERT( "pppMain: sys_arch_thread_remove did return\n", 0 );
}

static struct pbuf *pppSingleBuf(struct pbuf *p)
{
    struct pbuf *q, *b;
    u_char *pl;

    if(p->tot_len == p->len)
        return p;

    q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
    PPPDEBUG((LOG_WARNING, "pppSingleBuf: pbuf alloc %08x\n", q));    //JU
    if(!q) {
        PPPDEBUG((LOG_ERR,
                        "pppSingleBuf: unable to alloc new buf (%d)\n", p->tot_len));
        return p; /* live dangerously */
    }

    for(b = p, pl = q->payload; b != NULL; b = b->next) {
        memcpy(pl, b->payload, b->len);
        pl += b->len;
    }
    PPPDEBUG((LOG_WARNING, "pppSingleBuf: pbuf free %08x\n", p));    //JU
    pbuf_free(p);

    return q;
}

struct pppInputHeader {
    int unit;
    u16_t proto;
};

/*
* Pass the processed input packet to the appropriate handler.
* This function and all handlers run in the context of the tcpip_thread
*/
static void pppInput(void *arg)
{
    struct pbuf *nb = (struct pbuf *)arg;
    u16_t protocol;
    int pd;

    pd = ((struct pppInputHeader *)nb->payload)->unit;
    protocol = ((struct pppInputHeader *)nb->payload)->proto;

    pbuf_header(nb, -(int)sizeof(struct pppInputHeader));

#if LINK_STATS
    lwip_stats.link.recv++;
#endif /* LINK_STATS */

    /*
     * Toss all non-LCP packets unless LCP is OPEN.
     * Until we get past the authentication phase, toss all packets
     * except LCP, LQR and authentication packets.
     */
    if((lcp_phase[pd] <= PHASE_AUTHENTICATE) && (protocol != PPP_LCP)) {
        if(!((protocol == PPP_LQR) || (protocol == PPP_PAP) || (protocol == PPP_CHAP)) ||
            (lcp_phase[pd] != PHASE_AUTHENTICATE)) {
        PPPDEBUG((LOG_INFO, "pppInput: discarding proto 0x%04X in phase %d\n", protocol, lcp_phase[pd]));
        goto drop;
        }
    }

    switch(protocol) {
    case PPP_VJC_COMP:      /* VJ compressed TCP */
#if VJ_SUPPORT > 0
        PPPDEBUG((LOG_INFO, “pppInput[%d]: vj_comp in pbuf len=%d\n”, pd, nb->len));
        /*
         * Clip off the VJ header and prepend the rebuilt TCP/IP header and
         * pass the result to IP.
         */
        if (vj_uncompress_tcp(&nb, &pppControl[pd].vjComp) >= 0) {
            pppControl[pd].netif.input(nb, &pppControl[pd].netif);
            return;
        }
    /* Something’s wrong so drop it. */
    PPPDEBUG((LOG_WARNING, “pppInput[%d]: Dropping VJ compressed\n”, pd));
#else
        /* No handler for this protocol so drop the packet. */
        PPPDEBUG((LOG_INFO, “pppInput[%d]: drop VJ Comp in %d:%s\n”, pd, nb->len, nb->payload));
#endif /* VJ_SUPPORT > 0 */
    break;
    case PPP_VJC_UNCOMP:    /* VJ uncompressed TCP */
#if VJ_SUPPORT > 0
        PPPDEBUG((LOG_INFO, “pppInput[%d]: vj_un in pbuf len=%d\n”, pd, nb->len));
        /*
         * Process the TCP/IP header for VJ header compression and then pass
         * the packet to IP.
         */
        if (vj_uncompress_uncomp(nb, &pppControl[pd].vjComp) >= 0) {
            pppControl[pd].netif.input(nb, &pppControl[pd].netif);
            return;
        }
    /* Something’s wrong so drop it. */
    PPPDEBUG((LOG_WARNING, “pppInput[%d]: Dropping VJ uncompressed\n”, pd));
#else
        /* No handler for this protocol so drop the packet. */
        PPPDEBUG((LOG_INFO,
                    “pppInput[%d]: drop VJ UnComp in %d:.*H\n”,
                    pd, nb->len, LWIP_MIN(nb->len * 2, 40), nb->payload));
#endif /* VJ_SUPPORT > 0 */
    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);
        return;
    default:
    {
        struct protent *protp;
        int i;

        /*
         * Upcall the proper protocol input routine.
         */
        for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) {
            if (protp->protocol == protocol && protp->enabled_flag) {
                PPPDEBUG((LOG_INFO, "pppInput[%d]: %s len=%d\n", pd, protp->name, nb->len));
                nb = pppSingleBuf(nb);
                (*protp->input)(pd, nb->payload, nb->len);
                goto out;
            }
        }

        /* No handler for this protocol so reject the packet. */
        PPPDEBUG((LOG_INFO, "pppInput[%d]: rejecting unsupported proto 0x%04X len=%d\n", pd, protocol, nb->len));
        pbuf_header(nb, sizeof(protocol));
#if BYTE_ORDER == LITTLE_ENDIAN
        protocol = htons(protocol);
        memcpy(nb->payload, &protocol, sizeof(protocol));
#endif
        lcp_sprotrej(pd, nb->payload, nb->len);
    }
    break;
    }

drop:
#if LINK_STATS
    lwip_stats.link.drop++;
#endif

out:
    PPPDEBUG((LOG_WARNING, "pppInput: pbuf free %08x\n", nb));    //JU
    pbuf_free(nb);
    return;
}

/*
* Drop the input packet.
*/
static void pppDrop(PPPControl *pc)
{
    if (pc->inHead != NULL) {
#if 0       
        PPPDEBUG((LOG_INFO, "pppDrop: %d:%.*H\n", pc->inHead->len, min(60, pc->inHead->len * 2), pc->inHead->payload));
#endif   
        PPPDEBUG((LOG_INFO, "pppDrop: pbuf len=%d\n", pc->inHead->len));
    if (pc->inTail && (pc->inTail != pc->inHead))
        PPPDEBUG((LOG_WARNING, "pppDrop: pbuf free %08x & %08x\n", pc->inTail, pc->inHead));    //JU
        pbuf_free(pc->inTail);
        pbuf_free(pc->inHead);
        pc->inHead = NULL;
        pc->inTail = NULL;
    }
#if VJ_SUPPORT > 0
    vj_uncompress_err(&pc->vjComp);
#endif

#if LINK_STATS
    lwip_stats.link.drop++;
#endif /* LINK_STATS */
}

/*
* Process a received octet string.
*/
static void pppInProc(int pd, u_char *s, int l)
{
    PPPControl *pc = &pppControl[pd];
    struct pbuf *nextNBuf;
    u_char curChar;

    PPPDEBUG((LOG_DEBUG, “pppInProc[%d]: got %d bytes\n”, pd, l));
    while (l-- > 0) {
        curChar = *s++;
       
        /* Handle special characters. */
        if (ESCAPE_P(pc->inACCM, curChar)) {
            /* Check for escape sequences. */
            /* XXX Note that this does not handle an escaped 0x5d character which
             * would appear as an escape character.  Since this is an ASCII ‘]’
             * and there is no reason that I know of to escape it, I won’t complicate
             * the code to handle this case. GLL */
            if (curChar == PPP_ESCAPE)
                pc->inEscaped = 1;
            /* Check for the flag character. */
            else if (curChar == PPP_FLAG) {
                /* If this is just an extra flag character, ignore it. */
                if (pc->inState <= PDADDRESS)
                    ;
                /* If we haven’t received the packet header, drop what has come in. */
                else if (pc->inState < PDDATA) {
                    PPPDEBUG((LOG_WARNING,
                                “pppInProc[%d]: Dropping incomplete packet %d\n”,
                                pd, pc->inState));
#if LINK_STATS
                    lwip_stats.link.lenerr++;
#endif
                    pppDrop(pc);
                }
                /* If the fcs is invalid, drop the packet. */
                else if (pc->inFCS != PPP_GOODFCS) {
                    PPPDEBUG((LOG_INFO,
                                “pppInProc[%d]: Dropping bad fcs 0x%04X proto=0x%04X\n”,
                                pd, pc->inFCS, pc->inProtocol));
#if LINK_STATS
                    lwip_stats.link.chkerr++;
#endif
                    pppDrop(pc);
                }
                /* Otherwise it’s a good packet so pass it on. */
                else {
                   
                    /* Trim off the checksum. */
            if(pc->inTail->len >= 2) {
            pc->inTail->len -= 2;

            pc->inTail->tot_len = pc->inTail->len;
            if (pc->inTail != pc->inHead) {
                pbuf_cat(pc->inHead, pc->inTail);
            }
            } else {
            pc->inTail->tot_len = pc->inTail->len;
            if (pc->inTail != pc->inHead) {
                pbuf_cat(pc->inHead, pc->inTail);
            }

            pbuf_realloc(pc->inHead, pc->inHead->tot_len - 2);
            }

                    /* Dispatch the packet thereby consuming it. */
            if(tcpip_callback(pppInput, pc->inHead) != ERR_OK) {
                        PPPDEBUG((LOG_ERR,
                    “pppInProc[%d]: tcpip_callback() failed, dropping packet\n”, pd));
            PPPDEBUG((LOG_WARNING, “pppInProc: pbuf free %08x\n”, pc->inHead));    //JU
            pbuf_free(pc->inHead);
#if LINK_STATS
            lwip_stats.link.drop++;
#endif
            }
                    pc->inHead = NULL;
                    pc->inTail = NULL;
                }
                   
                /* Prepare for a new packet. */
                pc->inFCS = PPP_INITFCS;
                pc->inState = PDADDRESS;
                pc->inEscaped = 0;
            }
            /* Other characters are usually control characters that may have
             * been inserted by the physical layer so here we just drop them. */
            else {
                PPPDEBUG((LOG_WARNING,
                            “pppInProc[%d]: Dropping ACCM char <%d>\n”, pd, curChar));
            }
        }
        /* Process other characters. */
        else {
            /* Unencode escaped characters. */
            if (pc->inEscaped) {
                pc->inEscaped = 0;
                curChar ^= PPP_TRANS;
            }
           
            /* Process character relative to current state. */
            switch(pc->inState) {
            case PDIDLE:                    /* Idle state - waiting. */
                /* Drop the character if it’s not 0xff
                 * we would have processed a flag character above. */
                if (curChar != PPP_ALLSTATIONS) {
                    break;
                }

                /* Fall through */
            case PDSTART:                   /* Process start flag. */
                /* Prepare for a new packet. */
                pc->inFCS = PPP_INITFCS;

                /* Fall through */
            case PDADDRESS:                 /* Process address field. */
                if (curChar == PPP_ALLSTATIONS) {
                    pc->inState = PDCONTROL;
                    break;
                }
                /* Else assume compressed address and control fields so
                 * fall through to get the protocol… */
            case PDCONTROL:                 /* Process control field. */
                /* If we don’t get a valid control code, restart. */
                if (curChar == PPP_UI) {
                    pc->inState = PDPROTOCOL1;
                    break;
                }
#if 0
                else {
                    PPPDEBUG((LOG_WARNING,
                                “pppInProc[%d]: Invalid control <%d>\n”, pd, curChar));
                    pc->inState = PDSTART;
                }
#endif
            case PDPROTOCOL1:               /* Process protocol field 1. */
                /* If the lower bit is set, this is the end of the protocol
                 * field. */
                if (curChar & 1) {
                    pc->inProtocol = curChar;
                    pc->inState = PDDATA;
                }
                else {
                    pc->inProtocol = (u_int)curChar << 8;
                    pc->inState = PDPROTOCOL2;
                }
                break;
            case PDPROTOCOL2:               /* Process protocol field 2. */
                pc->inProtocol |= curChar;
                pc->inState = PDDATA;
                break;
            case PDDATA:                    /* Process data byte. */
                /* Make space to receive processed data. */
                if (pc->inTail == NULL || pc->inTail->len == PBUF_POOL_BUFSIZE) {
            if(pc->inTail) {
            pc->inTail->tot_len = pc->inTail->len;
            if (pc->inTail != pc->inHead) {
                pbuf_cat(pc->inHead, pc->inTail);
            }
            }
                    /* If we haven’t started a packet, we need a packet header. */
                    nextNBuf = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
                    PPPDEBUG((LOG_WARNING, “pppInProc: pbuf alloc %08x\n”, nextNBuf));    //JU
                    if (nextNBuf == NULL) {
                        /* No free buffers.  Drop the input packet and let the
                         * higher layers deal with it.  Continue processing
                         * the received pbuf chain in case a new packet starts. */
                        PPPDEBUG((LOG_ERR, “pppInProc[%d]: NO FREE MBUFS!\n”, pd));
#if LINK_STATS
                        lwip_stats.link.memerr++;
#endif /* LINK_STATS */
                        pppDrop(pc);
                        pc->inState = PDSTART;  /* Wait for flag sequence. */
            break;
                    }
            if (pc->inHead == NULL) {
            struct pppInputHeader *pih = nextNBuf->payload;

            pih->unit = pd;
            pih->proto = pc->inProtocol;

            nextNBuf->len += sizeof(*pih);

            pc->inHead = nextNBuf;
            }
            pc->inTail = nextNBuf;
                }
                /* Load character into buffer. */
                ((u_char*)pc->inTail->payload)[pc->inTail->len++] = curChar;
                break;
            }

            /* update the frame check sequence number. */
            pc->inFCS = PPP_FCS(pc->inFCS, curChar);
        }
    }
    avRandomize();
}

#endif /* PPP_SUPPORT */

nobody wrote on Wednesday, September 13, 2006:

debug output (after some pppClose and pppSigHUP):

dbg uart ok

lcp_init: xmit_accm=0 0 0 0

upap_init: 0

at

at

sys_arch_timeouts: ptask != NULL
http serv lev 0b

sys_arch_timeouts: ptask != NULL
tcp_bind: bind to port 80

sys_arch_timeouts: ptask != NULL
sys_arch_timeouts: ptask != NULL
http serv lev 3

sys_arch_timeouts: ptask != NULL
ate0

pin entering

free heap: 5632

connecting…

ppp starting 1 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 52181044

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 0020791c

pppWrite[0]: len=47

nPut: pbuf free 0020791c

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 100 bytes

pppInProc: pbuf alloc 0020791c

pppInput[0]: LCP len=24

fsm_input(LCP):1,3,24

fsm_rconfreq(LCP): Rcvd id 3 state=6

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (69C92C) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=52

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 2,3,24.

pppInput: pbuf free 0020791c

pppInProc: pbuf alloc 0020791c

pppInProc[0]: got 2 bytes

pppInProc[0]: Dropping bad fcs 0x7207 proto=0xC021

pppDrop: pbuf len=17

pppDrop: pbuf free 0020791c & 0020791c

pppInProc[0]: got 52 bytes

pppInProc: pbuf alloc 0020791c

pppInput[0]: LCP len=24

fsm_input(LCP):1,2,24

fsm_rconfreq(LCP): Rcvd id 2 state=8

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6A6E14) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=53

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 2,2,24.

pppInput: pbuf free 0020791c

LCP: timeout resending Config-Request state=8

lcp_addci: L opt=2 0

lcp_addci: L opt=5 52181044

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 0020791c

pppWrite[0]: len=47

nPut: pbuf free 0020791c

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

pppInProc[0]: got 35 bytes

pppInProc: pbuf alloc 0020791c

pppInProc[0]: got 64 bytes

pppInput[0]: LCP len=20

fsm_input(LCP):2,1,20

fsm_rconfack(LCP): Rcvd id 1 state=8

lcp_acki: Ack

ppp_send_config[0]: outACCM=0 0 0 0

ppp_recv_config[0]: inACCM=0 0 0 0

link_established: 0

upap_lowerup: 0 s=0

IPCP: lowerup state 0 -> 2

upap_authwithpeer: 0 user=none password=none s=1

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=22

nPut: pbuf free 00207f08

pap_sauth: Sent id 1

pppInput: pbuf free 0020791c

pppInProc: pbuf alloc 0020791c            <= possible the memory leak!!!

pppInput[0]: LCP len=24

fsm_input(LCP):1,1,24

fsm_rconfreq(LCP): Rcvd id 1 state=9

link_down: 0

upap_lowerdown: 0 s=3

IPCP: lowerdown state 2 -> 0

IPCP: close reason=LCP down state 0 -> 0

pppMainWakeup: unit 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: iupap_timeout: 0 timeout 6 expired s=4

IPCP: timeout resending Config-Request state=6

pppWrite: pbuf alloc 0020791c

pppWrite[0]: len=30

nPut: pbuf free 0020791c

fsm_sdata(IPCP): Sent code 1,1,22.

IPCP: sending Configure-Request, id 1

pppInProc[0]: got 28 bytes

pppInProc: pbuf alloc 0020791c            <= I can’t understand that

pppInput[0]: IPCP len=22

fsm_input(IPCP):3,1,22

fsm_rconfnakrej(IPCP): Rcvd id 1 state=6

local IP address 172.23.27.231

primary DNS address 212.2.96.51

secondary DNS address 212.2.96.52

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=29

nPut: pbuf free 00207f08

fsm_sdata(IPCP): Sent code 1,2,22.

IPCP: sending Configure-Request, id 2

pppInput: pbuf free 0020791c

pppInProc[0]: got 44 bytes

pppInProc: pbuf alloc 0020791c

pppInput[0]: IPCP len=22

fsm_input(IPCP):2,2,22

fsm_rconfack(IPCP): Rcvd id 2 state=6

pppInput: pbuf free 0020791c

pppInProc: pbuf alloc 0020791c

pppInput[0]: IPCP len=10

fsm_input(IPCP):1,2,10

fsm_rconfreq(IPCP): Rcvd id 2 state=7

ipcp_reqci: ADDR 192.168.100.101

ipcp_reqci: returning Configure-ACK

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=18

nPut: pbuf free 00207f08

fsm_sdata(IPCP): Sent code 2,2,10.

np_up: 0 proto=21

np_up: maxconnect=0 idle_time_limit=0

ipcp: up

sifup: unit 0: linkStatusCB=10911d errCode=0

connected

adr our: 172.23.27.231 ip: 192.168.100.101 mask: 255.255.255.0

dns1: 212.2.96.51 dns2: 212.2.96.52

local  IP address 172.23.27.231

remote IP address 192.168.100.101

primary   DNS address 212.2.96.51

secondary DNS address 212.2.96.52

pppInput: pbuf free 0020791c

free heap: 1416

pppMainWakeup: unit 0

disconnecting by closing…

pppMainWakeup: unit 0 kill_link -> pppStopCB

pppStopCB: unit 0

link_down: 0

upap_lowerdown: 0 s=4

ipcp: down

np_down: 0 proto=21

sifdown: unit 0: linkStatusCB=10911d errCode=-5

error: -6

IPCP: lowerdown state 9 -> 1

IPCP: close reason=LCP down state 1 -> 0

pppMainWakeup: unit 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

pppWrite: pbuf alloc 0020791c

pppWrite[0]: len=29

nPut: pbuf free 0020791c

fsm_sdata(LCP): Sent code 5,3,16.

LCP: close reason=User request state 9 -> 4

free heap: 1416

pppInProc[0]: got 29 bytes

pppInProc: pbuf alloc 0020791c

pppInput[0]: LCP len=16

fsm_input(LCP):6,3,16

fsm_rtermack(LCP): state=4

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppInput: pbuf free 0020791c

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=-5

error: -5

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

ppp starting 2 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 0020791c

pppWrite[0]: len=46

nPut: pbuf free 0020791c

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 100 bytes

pppInProc: pbuf alloc 0020791c

pppInput[0]: LCP len=14

fsm_input(LCP):5,3,14

fsm_rtermreq(LCP): Rcvd id 3 state=6

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=16

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 6,3,4.

pppInput: pbuf free 0020791c

pppInProc: pbuf alloc 0020791c                    <= here is the leak!!!

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 99208214

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout sending Config-Requests state=6

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=0

error: -8

free heap: 1444

free heap: 1444

connecting…

ppp starting 3 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 3D3054FA

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 100 bytes

pppInProc: pbuf alloc 00207f08

pppInput[0]: LCP len=24

fsm_input(LCP):1,1,24

fsm_rconfreq(LCP): Rcvd id 1 state=6

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6C6260) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=51

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 2,1,24.

pppInput: pbuf free 00207f08

pppInProc: pbuf alloc 00207f08

LCP: timeout resending Config-Request state=8

lcp_addci: L opt=2 0

lcp_addci: L opt=5 3D3054FA

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=46

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

pppInProc[0]: got 33 bytes

pppInProc[0]: Dropping bad fcs 0x290B proto=0xC021

pppDrop: pbuf len=25

pppDrop: pbuf free 00207f08 & 00207f08

pppInProc: pbuf alloc 00207f08

pppInProc[0]: got 65 bytes

pppInput[0]: LCP len=20

fsm_input(LCP):2,1,20

fsm_rconfack(LCP): Rcvd id 1 state=8

lcp_acki: Ack

ppp_send_config[0]: outACCM=0 0 0 0

ppp_recv_config[0]: inACCM=0 0 0 0

link_established: 0

upap_lowerup: 0 s=0

IPCP: lowerup state 0 -> 2

upap_authwithpeer: 0 user=none password=none s=1

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=22

nPut: pbuf free 002084f4

pap_sauth: Sent id 3

pppInput: pbuf free 00207f08

pppInProc: pbuf alloc 00207f08

pppInput[0]: LCP len=24

fsm_input(LCP):1,1,24

fsm_rconfreq(LCP): Rcvd id 1 state=9

link_down: 0

upap_lowerdown: 0 s=3

IPCP: lowerdown state 2 -> 0

IPCP: close reason=LCP down state 0 -> 0

pppMainWakeup: unit 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 37B3E401

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=46

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,2,20.

LCP: sending Configure-Request, id 2

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6C7A94) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=52

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 2,1,24.

pppInput: pbuf free 00207f08

pppInProc[0]: got 46 bytes

pppInProc: pbuf alloc 00207f08

pppInput[0]: LCP len=20

fsm_input(LCP):2,2,20

fsm_rconfack(LCP): Rcvd id 2 state=8

lcp_acki: Ack

ppp_send_config[0]: outACCM=0 0 0 0

ppp_recv_config[0]: inACCM=0 0 0 0

link_established: 0

upap_lowerup: 0 s=0

IPCP: lowerup state 0 -> 2

upap_authwithpeer: 0 user=none password=none s=1

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=21

nPut: pbuf free 002084f4

pap_sauth: Sent id 4

pppInput: pbuf free 00207f08

pppInProc[0]: got 11 bytes

pppInProc: pbuf alloc 00207f08

pppInput[0]: PAP len=5

pap_rauthack: Rcvd id 4 s=3

Remote message:

auth_withpeer_success: 0 proto=C023

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=29

nPut: pbuf free 002084f4

fsm_sdata(IPCP): Sent code 1,3,22.

IPCP: sending Configure-Request, id 3

IPCP: open statupap_timeout: 0 timeout 6 expired s=4

IPCP: timeout resending Config-Request state=6

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=30

nPut: pbuf free 00207f08

fsm_sdata(IPCP): Sent code 1,3,22.

IPCP: sending Configure-Request, id 3

pppInProc[0]: got 28 bytes

pppInProc: pbuf alloc 00207f08

pppInput[0]: IPCP len=22

fsm_input(IPCP):3,3,22

fsm_rconfnakrej(IPCP): Rcvd id 3 state=6

local IP address 172.24.167.88

primary DNS address 212.2.96.51

secondary DNS address 212.2.96.52

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=29

nPut: pbuf free 002084f4

fsm_sdata(IPCP): Sent code 1,4,22.

IPCP: sending Configure-Request, id 4

pppInput: pbuf free 00207f08

pppInProc[0]: got 44 bytes

pppInProc: pbuf alloc 00207f08

pppInput[0]: IPCP len=22

fsm_input(IPCP):2,4,22

fsm_rconfack(IPCP): Rcvd id 4 state=6

pppInput: pbuf free 00207f08

pppInProc: pbuf alloc 00207f08

pppInput[0]: IPCP len=10

fsm_input(IPCP):1,2,10

fsm_rconfreq(IPCP): Rcvd id 2 state=7

ipcp_reqci: ADDR 192.168.100.101

ipcp_reqci: returning Configure-ACK

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=18

nPut: pbuf free 002084f4

fsm_sdata(IPCP): Sent code 2,2,10.

np_up: 0 proto=21

np_up: maxconnect=0 idle_time_limit=0

ipcp: up

sifup: unit 0: linkStatusCB=10911d errCode=0

connected

adr our: 172.24.167.88 ip: 192.168.100.101 mask: 255.255.255.0

dns1: 212.2.96.51 dns2: 212.2.96.52

local  IP address 172.24.167.88

remote IP address 192.168.100.101

primary   DNS address 212.2.96.51

secondary DNS address 212.2.96.52

pppInput: pbuf free 00207f08

free heap: 1416

pppMainWakeup: unit 0

disconnecting by closing…

pppMainWakeup: unit 0 kill_link -> pppStopCB

pppStopCB: unit 0

link_down: 0

upap_lowerdown: 0 s=4

ipcp: down

np_down: 0 proto=21

sifdown: unit 0: linkStatusCB=10911d errCode=-5

error: -6

IPCP: lowerdown state 9 -> 1

IPCP: close reason=LCP down state 1 -> 0

pppMainWakeup: unit 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=29

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 5,3,16.

LCP: close reason=User request state 9 -> 4

free heap: 1416

pppInProc[0]: got 29 bytes

pppInProc: pbuf alloc 00207f08

pppInput[0]: LCP len=16

fsm_input(LCP):6,3,16

fsm_rtermack(LCP): state=4

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppInput: pbuf free 00207f08

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=-5

error: -5

connecting…

ppp starting 4 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 19C8B4A3

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00207f08

pppWrite[0]: len=46

nPut: pbuf free 00207f08

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 60 bytes

pppInProc: pbuf alloc 00207f08

pppInput[0]: LCP len=14

fsm_input(LCP):5,3,14

fsm_rtermreq(LCP): Rcvd id 3 state=6

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=16

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 6,3,4.

pppInput: pbuf free 00207f08

pppInProc: pbuf alloc 00207f08                <= here is the leak!!!

pppMainWakeup: unit 0

disconnecting by signal…

pppMainWakeup: unit 0 sig_hup -> pppHupCB

pppHupCB: unit 0

LCP: lowerdown state 6 -> 1

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=0

error: -8

free heap: 1444

free heap: 1444

connecting…

ppp starting 5 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 917D3A37

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=46

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 9 bytes

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 917D3A37

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=46

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 917D3A37

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=46

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 917D3A37

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=46

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 917D3A37

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=46

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

pppMainWakeup: unit 0

disconnecting by signal…

pppMainWakeup: unit 0 sig_hup -> pppHupCB

pppHupCB: unit 0

LCP: lowerdown state 6 -> 1

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=0

error: -8

free heap: 1444

free heap: 1444

connecting…

ppp starting 6 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 11DF1176

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=47

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 100 bytes

pppInProc: pbuf alloc 002084f4

pppInput[0]: LCP len=24

fsm_input(LCP):1,1,24

fsm_rconfreq(LCP): Rcvd id 1 state=6

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6D371B) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=52

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 2,1,24.

pppInput: pbuf free 002084f4

pppInProc: pbuf alloc 002084f4

LCP: timeout resending Config-Request state=8

lcp_addci: L opt=2 0

lcp_addci: L opt=5 11DF1176

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=47

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

pppInProc[0]: got 32 bytes

pppInProc[0]: Dropping bad fcs 0x6414 proto=0xC021

pppDrop: pbuf len=24

pppDrop: pbuf free 002084f4 & 002084f4

pppInProc: pbuf alloc 002084f4

pppInProc[0]: got 67 bytes

pppInput[0]: LCP len=20

fsm_input(LCP):2,1,20

fsm_rconfack(LCP): Rcvd id 1 state=8

lcp_acki: Ack

ppp_send_config[0]: outACCM=0 0 0 0

ppp_recv_config[0]: inACCM=0 0 0 0

link_established: 0

upap_lowerup: 0 s=0

IPCP: lowerup state 0 -> 2

upap_authwithpeer: 0 user=none password=none s=1

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=22

nPut: pbuf free 00208ae0

pap_sauth: Sent id 5

pppInput: pbuf free 002084f4

pppInProc: pbuf alloc 002084f4            <= possible leak!!!

pppInput[0]: LCP len=24

fsm_input(LCP):1,1,24

fsm_rconfreq(LCP): Rcvd id 1 state=9

link_down: 0

upap_lowerdown: 0 s=3

IPCP: loupap_timeout: 0 timeout 6 expired s=4

IPCP: timeout resending Config-Request state=6

pppWrite: pbuf alloc 002084f4            <= I can’t understand that

pppWrite[0]: len=30

nPut: pbuf free 002084f4

fsm_sdata(IPCP): Sent code 1,5,22.

IPCP: sending Configure-Request, id 5

pppInProc[0]: got 28 bytes

pppInProc: pbuf alloc 002084f4

pppInput[0]: IPCP len=22

fsm_input(IPCP):3,5,22

fsm_rconfnakrej(IPCP): Rcvd id 5 state=6

local IP address 172.19.60.85

primary DNS address 212.2.96.51

secondary DNS address 212.2.96.52

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=29

nPut: pbuf free 00208ae0

fsm_sdata(IPCP): Sent code 1,6,22.

IPCP: sending Configure-Request, id 6

pppInput: pbuf free 002084f4

pppInProc[0]: got 44 bytes

pppInProc: pbuf alloc 002084f4

pppInput[0]: IPCP len=22

fsm_input(IPCP):2,6,22

fsm_rconfack(IPCP): Rcvd id 6 state=6

pppInput: pbuf free 002084f4

pppInProc: pbuf alloc 002084f4

pppInput[0]: IPCP len=10

fsm_input(IPCP):1,2,10

fsm_rconfreq(IPCP): Rcvd id 2 state=7

ipcp_reqci: ADDR 192.168.100.101

ipcp_reqci: returning Configure-ACK

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=18

nPut: pbuf free 00208ae0

fsm_sdata(IPCP): Sent code 2,2,10.

np_up: 0 proto=21

np_up: maxconnect=0 idle_time_limit=0

ipcp: up

sifup: unit 0: linkStatusCB=10911d errCode=0

connected

adr our: 172.19.60.85 ip: 192.168.100.101 mask: 255.255.255.0

dns1: 212.2.96.51 dns2: 212.2.96.52

local  IP address 172.19.60.85

remote IP address 192.168.100.101

primary   DNS address 212.2.96.51

secondary DNS address 212.2.96.52

pppInput: pbuf free 002084f4

free heap: 1416

pppMainWakeup: unit 0

disconnecting by closing…

pppMainWakeup: unit 0 kill_link -> pppStopCB

pppStopCB: unit 0

link_down: 0

upap_lowerdown: 0 s=4

ipcp: down

np_down: 0 proto=21

sifdown: unit 0: linkStatusCB=10911d errCode=-5

error: -6

IPCP: lowerdown state 9 -> 1

IPCP: close reason=LCP down state 1 -> 0

pppMainWakeup: unit 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=29

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 5,3,16.

LCP: close reason=User request state 9 -> 4

free heap: 1416

pppInProc[0]: got 29 bytes

pppInProc: pbuf alloc 002084f4

pppInput[0]: LCP len=16

fsm_input(LCP):6,3,16

fsm_rtermack(LCP): state=4

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppInput: pbuf free 002084f4

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=-5

error: -5

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

connecting…

ppp starting 7 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 78DE6B3A

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=45

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppMainWakeup: unit 0 sig_hup -> pppHupCB

disconnecting by signal…

pppMainWakeup: unit 0 sig_hup -> pppHupCB

pppHupCB: unit 0

LCP: lowerdown state 6 -> 1

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=0

error: -8

free heap: 1444

free heap: 1444

connecting…

ppp starting 8 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 D2E3DFA2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 002084f4

pppWrite[0]: len=45

nPut: pbuf free 002084f4

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 100 bytes

pppInProc: pbuf alloc 002084f4

pppInput[0]: LCP len=14

fsm_input(LCP):5,3,14

fsm_rtermreq(LCP): Rcvd id 3 state=6

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=16

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 6,3,4.

pppInput: pbuf free 002084f4

pppInProc: pbuf alloc 002084f4                <= here is the leak!!!

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 D2E3DFA2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=45

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 D2E3DFA2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=45

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 D2E3DFA2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=45

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 D2E3DFA2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=45

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

pppMainWakeup: unit 0

disconnecting by signal…

pppMainWakeup: unit 0 sig_hup -> pppHupCB

pppHupCB: unit 0

LCP: lowerdown state 6 -> 1

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=0

error: -8

free heap: 1444

free heap: 1444

connecting…

ppp starting 9 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 F51160C1

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=46

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 100 bytes

pppInProc: pbuf alloc 00208ae0

pppInput[0]: LCP len=24

fsm_input(LCP):1,1,24

fsm_rconfreq(LCP): Rcvd id 1 state=6

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6E13DB) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00000000            <= the first effect / syndrom of leaks!!!

fsm_sdata(LCP): Sent code 2,1,24.

pppInput: pbuf free 00208ae0

pppInProc: pbuf alloc 00208ae0

pppInProc[0]: got 1 bytes

pppInProc[0]: Dropping bad fcs 0x90DB proto=0xC021

pppDrop: pbuf len=24

pppDrop: pbuf free 00208ae0 & 00208ae0

pppInProc[0]: got 51 bytes

pppInProc: pbuf alloc 00208ae0

pppInput[0]: LCP len=24

fsm_input(LCP):1,2,24

fsm_rconfreq(LCP): Rcvd id 2 state=8

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6E256F) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 2,2,24.

pppInput: pbuf free 00208ae0

LCP: timeout resending Config-Request state=8

lcp_addci: L opt=2 0

lcp_addci: L opt=5 F51160C1

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=46

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

pppInProc[0]: got 39 bytes

pppInProc: pbuf alloc 00208ae0

pppInProc[0]: got 7 bytes

pppInput[0]: LCP len=20

fsm_input(LCP):2,1,20

fsm_rconfack(LCP): Rcvd id 1 state=8

lcp_acki: Ack

ppp_send_config[0]: outACCM=0 0 0 0

ppp_recv_config[0]: inACCM=0 0 0 0

link_established: 0

upap_lowerup: 0 s=0

IPCP: lowerup state 0 -> 2

upap_authwithpeer: 0 user=none password=none s=1

pppWrite: pbuf alloc 00000000

pap_sauth: Sent id 7

pppInput: pbuf free 00208ae0

pppInProc[0]: got 5 bytes

pppInProc[0]: got 46 bytes

pppInProc: pbuf alloc 00208ae0

pppInProc[0]: got 2 bytes

pppInput[0]: LCP len=24

fsm_input(LCP):1,3,24

fsm_rconfreq(LCP): Rcvd id 3 state=9

link_down: 0

upap_lowerdown: 0 s=3

IPCP: lowerdown state 2 -> 0

IPCP: close reason=LCP down state 0 -> 0

pppMainWakeup: unit 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 937D6BD7

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 1,2,20.

LCP: sending Configure-Request, id 2

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6E3703) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 2,3,24.

pppInput: pbuf free 00208ae0

pppInProc[0]: got 2 bytes

pppInProc[0]: got 47 bytes

pppInProc: pbuf alloc 00208ae0

pppInProc[0]: got 3 bytes

pppInput[0]: LCP len=24

fsm_input(LCP):1,4,24

fsm_rconfreq(LCP): Rcvd id 4 state=8

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6E4897) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 2,4,24.

pppInput: pbuf free 00208ae0

LCP: timeout resending Config-Request state=8

lcp_addci: L opt=2 0

lcp_addci: L opt=5 937D6BD7

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00208ae0

pppWrite[0]: len=46

nPut: pbuf free 00208ae0

fsm_sdata(LCP): Sent code 1,2,20.

LCP: sending Configure-Request, id 2

pppInProc[0]: got 36 bytes

pppInProc: pbuf alloc 00208ae0

pppInProc[0]: got 10 bytes

pppInput[0]: LCP len=20

fsm_input(LCP):2,2,20

fsm_rconfack(LCP): Rcvd id 2 state=8

lcp_acki: Ack

ppp_send_config[0]: outACCM=0 0 0 0

ppp_recv_config[0]: inACCM=0 0 0 0

link_established: 0

upap_lowerup: 0 s=0

IPCP: lowerup state 0 -> 2

upap_authwithpeer: 0 user=none password=none s=1

pppWrite: pbuf alloc 00000000

pap_sauth: Sent id 8

pppInput: pbuf free 00208ae0

pppInProc[0]: got 6 bytes

pppInProc[0]: got 46 bytes

pppInProc: pbuf alloc 00208ae0

pppInput[0]: LCP len=24

fsm_input(LCP):1,5,24

fsm_rconfreq(LCP): Rcvd id 5 state=9

link_down: 0

upap_lowerdown: 0 s=3

IPCP: lowerdown state 2 -> 0

IPCP: close reason=LCP down state 0 -> 0

pppMainWakeup: unit 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 22F90AF2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 1,3,20.

LCP: sending Configure-Request, id 3

lcp_reqci: rcvd ASYNCMAP=0 PAP (C023) MAGICNUMBER (6E5A2B) PCOMPRESSION

lcp_reqci:  ACCOMPRESSION

lcp_reqci: returning CONFACK.

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 2,5,24.

pppInput: pbuf free 00208ae0

pppInProc[0]: got 4 bytes

pppInProc[0]: got 33 bytes

pppInProc: pbuf alloc 00208ae0

pppInput[0]: LCP len=14

fsm_input(LCP):5,6,14

fsm_rtermreq(LCP): Rcvd id 6 state=8

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 6,6,4.

pppInput: pbuf free 00208ae0

pppInProc[0]: got 14 bytes

pppInProc: pbuf alloc 00208ae0

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 22F90AF2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 1,3,20.

LCP: sending Configure-Request, id 3

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 22F90AF2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 1,3,20.

LCP: sending Configure-Request, id 3

LCP: timeout resending Config-Request state=6

lcp_addci: L opt=2 0

lcp_addci: L opt=5 22F90AF2

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 1,3,20.

LCP: sending Configure-Request, id 3

pppMainWakeup: unit 0

disconnecting by signal…

pppMainWakeup: unit 0 sig_hup -> pppHupCB

pppHupCB: unit 0

LCP: lowerdown state 6 -> 1

link_terminated: 0

Connection terminated.

pppMainWakeup: unit 0

pppMain: unit 0: PHASE_DEAD

pppMain: pbuf free 00205b58

pppMain: unit 0: linkStatusCB=10911d errCode=0

error: -8

free heap: 1444

free heap: 1444

connecting…

connecting…

ppp starting 10 time

top stack2: 2110531

lcp_init: xmit_accm=0 0 0 0

top stack3: 2110531

ppp started

pppMain: pbuf alloc 00205b58

pppMain: unit 0: Connecting

pppStartCB: unit 0

ppp_set_xaccm[0]: outACCM=0 0 0 0

ppp_send_config[0]: outACCM=FF FF FF FF

ppp_recv_config[0]: inACCM=0 0 0 0

lcp_lowerup: asyncmap=0 0 0 0

LCP: lowerup state 0 -> 2

auth_reset: 0

lcp_addci: L opt=2 0

lcp_addci: L opt=5 B968D522

lcp_addci: opt=7

lcp_addci: opt=8

pppWrite: pbuf alloc 00000000

fsm_sdata(LCP): Sent code 1,1,20.

LCP: sending Configure-Request, id 1

LCP: open state 2 -> 6

pppInProc[0]: got 63 bytes

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc[0]: Dropping bad fcs 0x5DD3 proto=0x202A

pppInProc[0]: got 2 bytes

pppInProc[0]: got 46 bytes

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc[0]: got 4 bytes

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

pppInProc: pbuf alloc 00000000

pppInProc[0]: NO FREE MBUFS!

nobody wrote on Wednesday, September 13, 2006:

a lot of protocols of the PPP do not free pbuf from pppInProc!!! Ib pppInput functions ip_input and pppDrop are doing that.

It looks ok:
    default:
    {
        struct protent *protp;
        int i;

        /*
         * Upcall the proper protocol input routine.
         */
        for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) {
            if (protp->protocol == protocol && protp->enabled_flag) {
                PPPDEBUG((LOG_INFO, "pppInput[%d]: %s len=%d\n", pd, protp->name, nb->len));
                nb = pppSingleBuf(nb);
                (*protp->input)(pd, nb->payload, nb->len);
                goto out;
            }
        }

        /* No handler for this protocol so reject the packet. */
        PPPDEBUG((LOG_INFO, "pppInput[%d]: rejecting unsupported proto 0x%04X len=%d\n", pd, protocol, nb->len));
        pbuf_header(nb, sizeof(protocol));
#if BYTE_ORDER == LITTLE_ENDIAN
        protocol = htons(protocol);
        memcpy(nb->payload, &protocol, sizeof(protocol));
#endif
        lcp_sprotrej(pd, nb->payload, nb->len);
    }
    break;
    }

drop:
#if LINK_STATS
    lwip_stats.link.drop++;
#endif

out:
    PPPDEBUG((LOG_WARNING, "pppInput: pbuf free %08x\n", nb));    //JU
    pbuf_free(nb);
    return;
}

so I haven’t idea again where is the bug :confused:
Janusz

nobody wrote on Wednesday, September 13, 2006:

interesting things:
http://www.mail-archive.com/lwip-users@nongnu.org/msg00177.html
http://www.archivum.info/lwip-users@nongnu.org/2004-10/msg00001.html

I think I have found bug in the ppp.c. pppInProc allocates memory but after finish pppMain the memory is still allocated and wasted! Solution is pppDrop(pc) - I will try to do it and tell you about results.

best regards
Janusz

nobody wrote on Wednesday, September 13, 2006:

This is solution (pppDrop is necessary, I placed it at the finish for to be sure):
static void pppMain(void *arg)
{
    err_t   err;
    int pd = (int)arg;
    struct pbuf *p;
    PPPControl* pc;

    pc = &pppControl[pd];

    p = pbuf_alloc(PBUF_RAW, PPP_MRU+PPP_HDRLEN, PBUF_RAM);
    PPPDEBUG((LOG_WARNING, "pppMain: pbuf alloc %08x\n", p));    //JU
    if(!p) {
        LWIP_ASSERT("p != NULL", p);
        pc->errCode = PPPERR_ALLOC;
        goto out;
    }

    /*
     * Start the connection and handle incoming events (packet or timeout).
     */
    PPPDEBUG((LOG_INFO, “pppMain: unit %d: Connecting\n”, pd));
    err = tcpip_callback(pppStartCB, arg);
    LWIP_ASSERT( “pppMain: can’t install callback handler\n”, err == ERR_OK );
    while (lcp_phase[pd] != PHASE_DEAD) {
        if (pc->kill_link) {
            PPPDEBUG((LOG_DEBUG, “pppMainWakeup: unit %d kill_link -> pppStopCB\n”, pd));
        pc->errCode = PPPERR_USER;
        /* This will leave us at PHASE_DEAD. */
            tcpip_callback(pppStopCB, arg);
        pc->kill_link = 0;
        }
        else if (pc->sig_hup) {
            PPPDEBUG((LOG_DEBUG, “pppMainWakeup: unit %d sig_hup -> pppHupCB\n”, pd));
        pc->sig_hup = 0;
            tcpip_callback(pppHupCB, arg);
        } else {
        int c = sio_read(pc->fd, p->payload, p->len);
        if(c > 0) {
            pppInProc(pd, p->payload, c);
        } else {
            /* PPPDEBUG((LOG_DEBUG, “pppMainWakeup: unit %d sio_read len=%d returned %d\n”, pd, p->len, c)); */
        }
        }
    }
    PPPDEBUG((LOG_INFO, “pppMain: unit %d: PHASE_D EAD\n”, pd));
    pppDrop(pc);    // or in line after PPPDEBUG((LOG_DEBUG, “pppMainWakeup: unit %d sio_read len=%d returned %d\n”, pd, p->len, c));
    PPPDEBUG((LOG_WARNING, “pppMain: pbuf free %08x\n”, p));    //JU
    pbuf_free(p);

out:
    PPPDEBUG((LOG_DEBUG, "pppMain: unit %d: linkStatusCB=%lx errCode=%d\n", pd, pc->linkStatusCB, pc->errCode));
    if(pc->linkStatusCB)
        pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode : PPPERR_PROTOCOL, NULL);

    pc->openFlag = 0;

    /* Remove this thread from the running ones. */
    sys_arch_thread_remove( sys_arch_thread_current( ) );
    LWIP_ASSERT( "pppMain: sys_arch_thread_remove did return\n", 0 );

kind regards
Janusz Uzycki

nobody wrote on Wednesday, September 13, 2006:

I have noticed the bug #17726 at http://savannah.nongnu.org/bugs/index.php

Janusz