[Top][All Lists]
[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: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] UDP socket thread safe problem - arp proccess error if ARP_QUEUEING 1 |
Date: |
Fri, 23 Mar 2012 10:03:06 +0100 |
"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