I think the pppDrop is a reasonable fix.

pppLinkTerminated(int pd)
{..
    pppDrop(&pc->rx); /* bug fix #17726 */

}

My problem is happened when tcpip_thread has higher priority.

PPP thread received something, and indicate to tcpip_thread, the task switch
happen, and tcp_ip thread make ppp disconnect.  In pppLinkTerminal API, the
received package is discarded, due to the link is terminal.

After the tcpip_thread processed, the ppp_thread process its received
thread, and tried to process a received package which is freed by
pppLinkTerminal already.

static void
pppInput(void *arg)
{

out:
  /**
   *check the status again
   */
  if(pppControl[pd]->openFlag == 0)
      return;

  /**
   *end added
   */
  pbuf_free(nb);
  return;

}

The code seems working correct after I add this check.

Is it reasonable?

Why I changed the tcpip_thread priorities?
Because I am pulling the data from USB dongle, if the PPP thread has the
high priorities, the data always received, the tcip ip unable to be process
the coming package.

It is had to make USB host block in the sio_read, so I had to change the
priority.

Lee

On Fri, Aug 6, 2010 at 7:48 AM, yueyue papa <[email protected]> wrote:

> I found the problem:
>
> void
> pppLinkTerminated(int pd)
> {
>   PPPDEBUG(LOG_DEBUG, ("pppLinkTerminated: unit %d\n", pd));
> #if PPPOE_SUPPORT
>   if (pppControl[pd].ethif) {
>     pppoe_disconnect(pppControl[pd].pppoe_sc);
>   } else
> #endif /* PPPOE_SUPPORT */
>   {
> #if PPPOS_SUPPORT
>     PPPControl* pc;
>     pppRecvWakeup(pd);
>     pc = &pppControl[pd];
>     pppDrop(&pc->rx); /* bug fix #17726 */  《===
>
> Whether the pppDrop needs to call here?
>
> The frame is dropped, but is process later.
>
> In the log:
> pppInput[0]: packet processed
> I has not find the proper solution now.
>
> Lee
>
>
> On Thu, Aug 5, 2010 at 6:08 PM, yueyue papa <[email protected]> wrote:
>
>> Hi All,
>>
>> I meet the PPP disconnect error in different task configuration.
>>
>> If PPP task has higher priority, every thing is ok
>>
>> ########################
>> sifdown: unit 0: linkStatusCB=0x2013aabc errCode=-5
>> pppLinkStatusCallback: PPPERR_CONNECT
>> IPCP: lowerdown state 9 (LS_OPENED) -> 1 (LS_STARTING)
>> IPCP: close reason=LCP down state 1 (LS_STARTING) -> 0 (LS_INITIAL)
>> pppLinkDown: unit 0
>> pppRecvWakeup: unit 0
>> ppp_send_config[0]: outACCM=FF FF FF FF
>> ppp_recv_config[0]: inACCM=0 0 0 0
>> pppWrite[0]: len=29
>> fsm_sdata(LCP): Sent code 5,2,16.
>> LCP: close reason=User request state 9 (LS_OPENED) -> 4 (LS_CLOSING)
>> pppRecvWakeup: unit 0
>> pppInProc[0]: got 29 bytes
>> tcpip_thread: CALLBACK 0x201a0b08
>> pppInput[0]: LCP len=16
>> fsm_input(LCP):6,2,16
>> fsm_rtermack(LCP): state=4 (LS_CLOSING)
>> link_terminated: 0
>> Connection terminated.
>> pppLinkTerminated: unit 0
>> pppRecvWakeup: unit 0
>> pppLinkTerminated: unit 0: linkStatusCB=0x2013aabc errCode=-5
>> pppLinkStatusCallback: PPPERR_USER
>> pppLinkTerminated: finished.
>> pppInput[0]: packet processed
>> LOG_DEBUG |:SEND[ATH0
>> ]
>>
>> pppInProc[0]: got 14 bytes
>> LOG_DEBUG |:Re-Send[ATH0
>> ]
>>
>> LOG_DEBUG |:RECV[6]
>>
>> LOG_DEBUG |:201d4ed0 : 0d 0a 4f 4b 0d 0a                                |
>> ..OK.
>> ####################################
>>
>> If PPP task has lower  priority,  I meet the pbuf assert
>>
>> #####################
>> pppClose() called
>> pppClose: unit 0 kill_link -> pppStop
>> pppStop: unit 0
>> link_down: 0
>> upap_lowerdown: 0 s=4
>> ipcp: down
>> np_down: 0 proto=21
>> sifdown: unit 0: linkStatusCB=0x2013aabc errCode=-5
>> pppLinkStatusCallback: PPPERR_CONNECT
>> IPCP: lowerdown state 9 (LS_OPENED) -> 1 (LS_STARTING)
>> IPCP: close reason=LCP down state 1 (LS_STARTING) -> 0 (LS_INITIAL)
>> pppLinkDown: unit 0
>> pppRecvWakeup: unit 0
>> ppp_send_config[0]: outACCM=FF FF FF FF
>> ppp_recv_config[0]: inACCM=0 0 0 0
>> pppWrite[0]: len=29
>> fsm_sdata(LCP): Sent code 5,2,16.
>> LCP: close reason=User request state 9 (LS_OPENED) -> 4 (LS_CLOSING)
>> pppRecvWakeup: unit 0
>> pppInProc[0]: got 29 bytes
>> tcpip_thread: CALLBACK 0x201a0b08
>> pppInput[0]: LCP len=16
>> fsm_input(LCP):6,2,16
>> fsm_rtermack(LCP): state=4 (LS_CLOSING)
>> link_terminated: 0
>> Connection terminated.
>> pppLinkTerminated: unit 0
>> pppRecvWakeup: unit 0
>> pppDrop: pbuf len=16, addr 0x201c60d4
>> pppLinkTerminated: unit 0: linkStatusCB=0x2013aabc errCode=-5
>> pppLinkStatusCallback: PPPERR_USER
>> pppLinkTerminated: finished.
>> pppInput[0]: packet processed
>> Assertion "pbuf_free: p->ref > 0" failed at line 566 in pbuf.c
>> ############################
>>
>> lwIP 1.3.2 no problem.
>>
>> My version is an early   1.4.0 CVS version
>>
>> Is there any hint for me ?
>>
>>
>>
>>
>
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to