lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] Some netifapi functions handle pointers to stale object


From: Mason
Subject: Re: [lwip-devel] Some netifapi functions handle pointers to stale objects
Date: Wed, 30 May 2012 17:46:22 +0200
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120429 Firefox/12.0 SeaMonkey/2.9.1

Mason wrote:

> Simon Goldschmidt wrote:
> 
>> That's no bug, because:
>>
>> - TCPIP_NETIFAPI() (as called by netifapi_netif_add()) waits for
>> tcpip_callback() to return, so when netif_add() is called, the address is
>> still valid.
>>
>> - both netif_add() and netif_set_addr() copy the address into ip_addr_t
>> members of struct netif, so the original pointers are not referenced after 
>> the
>> function returns.
> 
> Doh! Sorry for the noise :-(

Simon, I have a related question.

Is it "safe" to call netif functions such as

netif_set_link_up
netif_set_link_down
netif_set_up
netif_set_down
netif_add
netif_set_addr

from a thread other than tcpip_thread *IF* that thread is
holding the tcpip_core lock (using LOCK_TCPIP_CORE).

(NB: I've defined LWIP_TCPIP_CORE_LOCKING to 1)

Can a thread call any API function, as long as it is holding
the tcpip_core lock?

-- 
Regards.



reply via email to

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