Fixes bug #13807: slipif_input() garbles large (i.e. multiple pbufs) inbound datagrams.

This commit is contained in:
likewise 2005-07-17 15:13:34 +00:00
parent baf377679a
commit e11d57c883

View File

@ -32,8 +32,8 @@
*/
/*
* This is an arch independent SLIP netif. The specific serial hooks must be provided
* by another file.They are sio_open, sio_recv and sio_send
* This is an arch independent SLIP netif. The specific serial hooks must be
* provided by another file. They are sio_open, sio_recv and sio_send
*/
#include "netif/slipif.h"
@ -66,8 +66,8 @@ slipif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
/* Send pbuf out on the serial I/O device. */
sio_send(SLIP_END, netif->state);
for(q = p; q != NULL; q = q->next) {
for(i = 0; i < q->len; i++) {
for (q = p; q != NULL; q = q->next) {
for (i = 0; i < q->len; i++) {
c = ((u8_t *)q->payload)[i];
switch (c) {
case SLIP_END:
@ -96,7 +96,7 @@ slipif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
* @return The IP packet when SLIP_END is received
*/
static struct pbuf *
slipif_input( struct netif * netif )
slipif_input(struct netif *netif)
{
u8_t c;
struct pbuf *p, *q;
@ -156,6 +156,9 @@ slipif_input( struct netif * netif )
i++;
if (i >= p->len) {
i = 0;
if (p->next != NULL && p->next->len > 0)
p = p->next;
else
p = NULL;
}
}