mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 10:58:49 +08:00
Networking: Apply the same ARP fix for the Neighbor Solicitation logic
This commit is contained in:
parent
e4c602747b
commit
bba3fccd74
3 changed files with 20 additions and 6 deletions
|
@ -261,8 +261,9 @@ int icmpv6_wait_cancel(FAR struct icmpv6_notify_s *notify);
|
|||
* received, or (2) a timeout occurs.
|
||||
*
|
||||
* Assumptions:
|
||||
* This function is called from icmpv6_neighbor() and executes in the normal
|
||||
* tasking environment.
|
||||
* This function is called from icmpv6_neighbor() and must execute with
|
||||
* the network un-locked (interrupts may be disabled to keep the things
|
||||
* stable).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -283,7 +284,7 @@ int icmpv6_wait(FAR struct icmpv6_notify_s *notify,
|
|||
*
|
||||
* Assumptions:
|
||||
* This function is called from the MAC device driver indirectly through
|
||||
* icmpv6_icmpv6in() and may be execute from the interrupt level.
|
||||
* icmpv6_icmpv6in() will execute with the network locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
@ -210,6 +210,9 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
|
|||
struct timespec delay;
|
||||
struct icmpv6_neighbor_s state;
|
||||
FAR const uint16_t *lookup;
|
||||
#ifdef CONFIG_NET_NOINTS
|
||||
irqstate_t flags;
|
||||
#endif
|
||||
net_lock_t save;
|
||||
int ret;
|
||||
|
||||
|
@ -376,12 +379,21 @@ int icmpv6_neighbor(const net_ipv6addr_t ipaddr)
|
|||
|
||||
/* Now wait for response to the ARP response to be received. The
|
||||
* optimal delay would be the work case round trip time.
|
||||
* NOTE: The network is locked.
|
||||
*/
|
||||
|
||||
delay.tv_sec = CONFIG_ICMPv6_NEIGHBOR_DELAYSEC;
|
||||
delay.tv_nsec = CONFIG_ICMPv6_NEIGHBOR_DELAYNSEC;
|
||||
|
||||
#ifdef CONFIG_NET_NOINTS
|
||||
flags = irqsave(); /* Keep things stable */
|
||||
net_unlock(save); /* Unlock the network with interrupts disabled */
|
||||
#endif
|
||||
ret = icmpv6_wait(¬ify, &delay);
|
||||
#ifdef CONFIG_NET_NOINTS
|
||||
save = net_lock(); /* Re-lock the network with interrupts disabled */
|
||||
irqrestore(flags);
|
||||
#endif
|
||||
|
||||
/* icmpv6_wait will return OK if and only if the matching ARP response
|
||||
* is received. Otherwise, it will return -ETIMEDOUT.
|
||||
|
|
|
@ -169,8 +169,9 @@ int icmpv6_wait_cancel(FAR struct icmpv6_notify_s *notify)
|
|||
* received, or (2) a timeout occurs.
|
||||
*
|
||||
* Assumptions:
|
||||
* This function is called from icmpv6_neighbor() and executes in the normal
|
||||
* tasking environment.
|
||||
* This function is called from icmpv6_neighbor() and must execute with
|
||||
* the network un-locked (interrupts may be disabled to keep the things
|
||||
* stable).
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -225,7 +226,7 @@ int icmpv6_wait(FAR struct icmpv6_notify_s *notify,
|
|||
*
|
||||
* Assumptions:
|
||||
* This function is called from the MAC device driver indirectly through
|
||||
* icmpv6_icmpv6in() and may be execute from the interrupt level.
|
||||
* icmpv6_icmpv6in() will execute with the network locked.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in a new issue