lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] UDP socket thread safe problem - arp proccess error if


From: Darius Babrauskas
Subject: Re: [lwip-users] UDP socket thread safe problem - arp proccess error if ARP_QUEUEING 1
Date: Fri, 23 Mar 2012 14:03:22 +0200

Maybe in LWIP 1.4v  tcp and udp sockets working ok in  tcpip_thread context.

To resolve this problem, posible need use semaphores to protect arp table.
No, the complete stack (all modules including UDP, IP, ARP and others) need to be accessed from one thread at a time only. While this is fixed in 1.4.0 by letting the tcpip_thread check if input packets need to be passed to ARP (the netif driver just calls netif->input(p) >for all packets), you can implement this in your 1.2.0 driver by calling tcpip_callback() to get the ARP input packets into tcpip_thread.

But how raw api? It must working in  tcpip_thread context?
In LWIP 1.2v my aplication main task using udp_sendto function, which internaly use etharp_output, which use etharp_query which using not protected ARP table.
So problem leave same.  2 task using  one not protected APR table.

Darius

----- Original Message ----- From: "Simon Goldschmidt" <address@hidden>
To: "Mailing list for lwIP users" <address@hidden>
Sent: Friday, March 23, 2012 11:03 AM
Subject: Re: [lwip-users] UDP socket thread safe problem - arp proccess error if ARP_QUEUEING 1


"Darius Babrauskas" <address@hidden> wrote:
Problem are, that etharp_request  very fast - and it executed before  udp
packet queued. So queued packet not send, when get arp response. It send
later, maybe after arp timer, or when receiving other packet.

That bug doesn't exist in 1.4.0. It even doesn't really exist in 1.2.0: the actual bug is that the netif driver passes incoming packets into the ARP module from its input context instead of getting into tcpip_thread first (this was however a bug in the example ethernetif.c, so many people copied it).

To resolve this problem, posible need use semaphores to protect arp table.

No, the complete stack (all modules including UDP, IP, ARP and others) need to be accessed from one thread at a time only. While this is fixed in 1.4.0 by letting the tcpip_thread check if input packets need to be passed to ARP (the netif driver just calls netif->input(p) for all packets), you can implement this in your 1.2.0 driver by calling tcpip_callback() to get the ARP input packets into tcpip_thread.

Upgrading to 1.4.0 (or 1.4.1 RC1) is of course the cleaner solution - 1.2.0 is really old and includes many other bugs that are fixed by now.


Simon

--
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]