Re: [lwip-users] lwIP 1.4.1 server's SYN flood hang, no backlog

2014-09-03 Thread Tomek
In lwip_stats.tcp I see (non zero values):
- xmit 2478
- recv 2341

but in 'sys.mbox' section:
- used 21
- max  22
- err782

Could you tell me if you see anything incorrect in my opts (maybe any other
opts needed)?
#define TCPIP_MBOX_SIZE  64
#define DEFAULT_RAW_RECVMBOX_SIZE  0
#define DEFAULT_UDP_RECVMBOX_SIZE  8
#define DEFAULT_TCP_RECVMBOX_SIZE  16
#define DEFAULT_ACCEPTMBOX_SIZE 16



--
View this message in context: 
http://lwip.100.n7.nabble.com/lwIP-1-4-1-server-s-SYN-flood-hang-no-backlog-tp23116p23164.html
Sent from the lwip-users mailing list archive at Nabble.com.

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] lwIP 1.4.1 server's SYN flood hang, no backlog

2014-09-03 Thread Simon Goldschmidt
Tomek wrote:
 but in 'sys.mbox' section:
 - used 21
 - max 22
 - err 782

The meaning of that stats depends on your port. I don't know if it means mbox 
full wehn trying to put something in the mbox or no more mboxes left when 
creating a new mbox (every socket/netconn needs one).

In the latter case, that would mean either there are sockets/netconns left that 
are not closed correctly (or not accepted) or there is a bug in freeing the 
mboxes somewhere (which could be in the port or in lwIP core code).


Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] lwIP hangs after some data transferred

2014-09-03 Thread Sergio R. Caprile
Hi Grzegorz,
let's make this a kickstarter for the FAQ ;^)
single thread applies mostly to raw API users and/or vendor code; they
use an RTOS and the raw API and forget to call the lwIP stack from a
single thread. I've seen some vendor code which also calls the stack
from within interrupt code. Not your case, since you are using the
sockets API.
The ST rx handler bug is the winner this August: The interrupt routine
takes the first frame off the controller and forgets to ask if there are
any others waiting, so fast consecutive frames cause lost frames. IIRC,
there is also a task running every second that somehow gets frames out
of the chip (?), so some people notice this issue by observing a 500ms
average ping delay, constantly changing (but I might be confusing it
with other bug I read on the list). I'm glad you found it in the list
and fixed it. Fortunately I don't use vendor code so I can't tell you if
there are any other serious bugs, I prefer to deal with my own bugs
(which keeps me very busy indeed ;^)).
Sorry for hijacking your thread, should I start a new one or do you
prefer to elaborate on the FAQ here ? You are the OP

Best regards



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] DHCP callback was removed - Correct way to obtain new address?

2014-09-03 Thread Sergio R. Caprile
According to the wiki, the correct way to initialize a DHCP interface is
to call dhcp_start() and not netif_set_up(). So, summarizing:
you can poll for netif.dhcp-state == DHCP_BOUND
you can define LWIP_NETIF_STATUS_CALLBACK,  and call
void netif_set_status_callback(struct netif *netif,
netif_status_callback_fn status_callback);
your 'status_callback' function will be called when the interface comes
up after the DHCP state machine reached the DHCP_BOUND state and
netif_set_up() has been called by the dhcp code.


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] RIP and OSPF support

2014-09-03 Thread Sergio R. Caprile
There is a thread on a guy needing something like source routing last
month, in which Simon discussed some hooks to provide routing.
As far as I can see, you are better off using embedded Linux. Even
though nothing forbids you from runnig RIP or OSPF on top of lwIP and
build a routing table and routing hooks, my (probably educated) guess is
that the amount of resources you'll need to run the Dijkstra algorithm
in OSPF (which depends on the size of the visible network) will probably
justify the usage of something closer to a full-blown OS.


___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] RIP and OSPF support

2014-09-03 Thread Wendel Assis
Hi Sergio,

   thanks for the reply, you are probably talking about the LWIP_HOOK_IP4_ROUTE
and this sounds like a yes to my first question! We do have to implement
our own stack per a customer requirement (even though it will be running on
top of a Linux OS, they have their reasons for that, but running a stack in
user space is something really odd). Nevertheless, your point about
resource usage for the routing algorithms is something I will bring up to
their attention, thanks a lot!

Best Regards,
Wendel


2014-09-03 15:46 GMT-03:00 Sergio R. Caprile scapr...@gmail.com:

 There is a thread on a guy needing something like source routing last
 month, in which Simon discussed some hooks to provide routing.
 As far as I can see, you are better off using embedded Linux. Even
 though nothing forbids you from runnig RIP or OSPF on top of lwIP and
 build a routing table and routing hooks, my (probably educated) guess is
 that the amount of resources you'll need to run the Dijkstra algorithm
 in OSPF (which depends on the size of the visible network) will probably
 justify the usage of something closer to a full-blown OS.


 ___
 lwip-users mailing list
 lwip-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/lwip-users

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Re: [lwip-users] lwIP hangs after some data transferred

2014-09-03 Thread Grzegorz Niemirowski
It can be some problem with memory management but there is no place I should 
free memory. There are just automatic variables (allocated on stack) and 
public variables (allocated on heap). There are also four FreeRTOS queues, 
but they are created only once, when one of tasks starts. I don't use malloc 
or similar functions. Here is the source code of the task:


#include lwip/sockets.h
#include stm32f4xx_hal.h
#include cmsis_os.h
#include stdint.h
#include string.h
#include flash_settings.h

void serve(int conn);

uint16_t RX_BUFFER[50];
uint16_t TX_BUFFER[50];
extern struct settings_struct settings;
uint8_t changePort = 0;
extern xQueueHandle appQueueRx;
extern xQueueHandle appQueueTx;

void appTask(void const * argument)
{
appQueueRx = xQueueCreate(1, 100);

 int newconn, size;
 struct sockaddr_in address, remotehost;
 int appSocket;

/* create a TCP socket */
 if ((appSocket = socket(AF_INET, SOCK_STREAM, 0))  0)
 {
   return;
 }
 fcntl(appSocket, F_SETFL, lwip_fcntl(appSocket, F_GETFL, 0) | O_NONBLOCK);

 /* bind to port 2324 at any interface */
 memset(address, 0, sizeof(address));
 address.sin_family = AF_INET;
 address.sin_port = htons(settings.appPort);
 address.sin_addr.s_addr = INADDR_ANY;

 if (bind(appSocket, (struct sockaddr *)address, sizeof(address))  0)
 {
   return;
 }

 /* listen for incoming connections (TCP listen backlog = 5) */
 listen(appSocket, 5);

 size = sizeof(remotehost);

 while(1)
 {
   newconn = accept(appSocket, (struct sockaddr *)remotehost, (socklen_t 
*)size);

   if (changePort){
changePort = 0;
close(appSocket);
appSocket = socket(AF_INET, SOCK_STREAM, 0);
fcntl(appSocket, F_SETFL, lwip_fcntl(appSocket, F_GETFL, 0) | 
O_NONBLOCK);

address.sin_port = htons(settings.appPort);
bind(appSocket, (struct sockaddr *)address, sizeof (address));
listen(appSocket, 5);
continue;
   }
   if (newconn = 0) serve(newconn); else vTaskDelay(100);
 }
}

void serve(int conn)
{
int ret;
ret = read(conn, TX_BUFFER, sizeof(TX_BUFFER));
if (ret0) {
 xQueueSend(appQueueTx, TX_BUFFER, 100);
 xQueueReceive(appQueueRx, RX_BUFFER, 100);
 write(conn, (const unsigned char*)RX_BUFFER, (size_t)sizeof(RX_BUFFER));
}
close(conn);
}


Noam weissman n...@silrd.com napisaƂ(a):

Hi,
Please check if you free memory properly. It sounds like a memory leak?
BR,
Noam.
-Original Message-
From: lwip-users-bounces+noam=silrd@nongnu.org on behalf of Grzegorz
Niemirowski Sent: Tue 9/2/2014 8:34 PM
To: Mailing list for lwIP users
Subject: Re: [lwip-users] lwIP hangs after some data transferred
Thanks Noam. I have interrupt priorities set exactly as you have written.
The problem must be somewhere else. 



___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users