[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] SLIP bug
From: |
marek |
Subject: |
[lwip-users] SLIP bug |
Date: |
Wed, 9 Feb 2005 16:47:52 +0100 (CET) |
User-agent: |
SquirrelMail/1.4.3a |
Hello
I have used two network interfaces: ETHERNET and SLIP, I pinging them both
with large data size (about 1k to 1,4kB) and I think that function
slipif_input lose pbufs.
That is old code (from splip_input):
[...]
default:
if (p == NULL) {
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: alloc\n"));
p = pbuf_alloc(PBUF_LINK, PBUF_POOL_BUFSIZE, PBUF_POOL);
if (p == NULL) {
LINK_STATS_INC(link.drop);
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: no new pbuf! (DROP)\n"));
}
if (q != NULL) {
pbuf_cat(q, p);
} else {
q = p;
}
}
if (p != NULL && recved < MAX_SIZE) {
((u8_t *)p->payload)[i] = c;
recved++;
i++;
if (i >= p->len) {
i = 0;
p = NULL;
}
[...]
what if the first pbuf was allocted, but the others could not ?
In that code it seem happy with that.
I think that If we cannot alloc the pbuf we have to free previously
allocated (q) pbufs and return from function with NULL.
that's my code:
[...]
default:
if (p == NULL) {
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: alloc\n"));
p = pbuf_alloc(PBUF_LINK, PBUF_POOL_BUFSIZE, PBUF_POOL);
if (p == NULL) {
LINK_STATS_INC(link.drop);
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: no new pbuf! (DROP)\n"));
pbuf_free(q);
return NULL;
}
if (q != NULL) {
pbuf_cat(q, p);
} else {
q = p;
}
}
if (p != NULL && recved < MAX_SIZE) {
((u8_t *)p->payload)[i] = c;
recved++;
i++;
if (i >= p->len) {
i = 0;
p = NULL;
}
[...]
Is I am right Leon ?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] SLIP bug,
marek <=