Problem with the KSDK lwip http server example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with the KSDK lwip http server example

3,279 Views
vinced
Contributor I

Hi,

 

I have a problem when I try to quickly refresh the HTTP server page with my browser. When I refresh few times the web page, there is no problem at all, everything is working just fine. But when the refresh rate appear to be too high, then the web server just stop.

 

I'm using the FRDM-K64F with the lwip_http_server_demo provided for my board in the KSDK 1.1.0 with no modification at all. I use Kinetis Design Studio 2.0.0. I tried with the FreeRTOS and the MQX, but the same problem is still there. I tried it with BareMetal and it work just fine.

 

I activated the debug traces and when the problem is active, then the trace shows : memp_malloc: out of memory in pool TCPIP_MSG_INPKT. So I tried to increase the MEMP_NUM_TCPIP_MSG_INPKT from 8 to 16.

 

But the problem change to : memp_malloc: out of memory in pool PBUF_POOL. So I tried to increase the PBUF_POOL_SIZE from 10 to 20, but it return to : memp_malloc: out of memory in pool TCPIP_MSG_INPKT.

 

I investigated and it seems that the tcpip_thread is in blocking state. I activated the STATS but I don't see any memory problems, only the INPKT that is at the maximum allowed and has an error.

 

Any help would be really appreciated.

 

Regards,

Vince

Labels (1)
Tags (1)
0 Kudos
Reply
8 Replies

1,838 Views
cmheia
Contributor I

Hi Vincent

You just need set SYS_LIGHTWEIGHT_PROT to 1 on lwipopts.h.

Since our customer had encountered a similar problem with you, and I solve it with this.

After doing this, lwip@KSDK bacame a strong stack that can hold on UDP flood attack instead of went to HARD fault.

Pls forget my chinglish...

2015-04-20_200040.png

0 Kudos
Reply

1,838 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Vincent,

Can you please explain what changes you made when you say "But when the refresh rate appear to be too high, then the web server just stop."?

Regards,

Carlos

0 Kudos
Reply

1,838 Views
vinced
Contributor I

Hi Carlos,

I didn't made any change on the source code. I just changed the way I was doing my tests. At the first time, I was just accessing normally to the web server with my Google Chrome browser. But I tried to flood the web server with my browser pressing F5 (refresh) on my keyboard. After few seconds, the web server became down. The same thing happened when I started a dos SYN attack on the web server.

How can I protect the LWIP stack from this kind of attack ?

Regards,

Vincent

0 Kudos
Reply

1,838 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Vincent,

I have investigated and talked with some colleagues and it looks like a hard task to block this attacks in the HTML side without using Java. Unfortunately Kinetis devices dont support it.

Probably modifying lwIP source code you can be able but there we have no example and we have not run tests on this.

I will let you know if I find something that can help.

Or if someone else has modified lwIP source and could provide guidelines it would be highly appreciated.

Regards,

Carlos

0 Kudos
Reply

1,838 Views
vinced
Contributor I

Hi Carlos,

I decided to move ahead with the MQX RTCS stack. I did the same tests with only one PC and the web server demo is working just fine. But when I have a small network : two PC and one Kinetis web server demo, I have the same problem, the web server just stop working if I try to access through one google chrome browser on each PC.

Do you have the same results ?

thanks for your support,

Vincent

0 Kudos
Reply

1,838 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Vincent,

I have run tests using a small Linksys router and I am able to access from many devices including wireless. Please see attached document.

Regards,

Carlos

0 Kudos
Reply

1,838 Views
mjbcswitzerland
Specialist V

Hi Vincent

If you don't find a solution you can also check out the following.

http://www.utasker.com/kinetis/FRDM-K64F.html

It is a very low memory footprint solution and allows (theoretically) up to about 2'000 parallel web server connections on the FRDM-K64F without memory problems.

Web content can be served from the SD card, an internal FAT file system or uFileSystem (also in internal Flash or SPI based Flash, but faster that FAT).

The operation can be tested in VisualStudio in real-time (simulates the FRDM-K64F) and builds with KDS.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html

K64: µTasker Kinetis FRDM-K64F support / µTasker Kinetis TWR-K64F120M support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos
Reply

1,838 Views
vinced
Contributor I

Thanks for your suggestion Mark. I'm gonna try your stack for test.

Anyone else could help me ?

0 Kudos
Reply