net: Fix an error introduced when ICMP and ICMP6 socket support was added in NuttX-7.3. A gratuitous ARP (or solitication) was being sent after receive of the ECHO replay (advertisement).

This commit is contained in:
Gregory Nutt 2018-01-01 11:15:21 -06:00
parent 3c65be8c1a
commit 2a2cdb4df2
2 changed files with 26 additions and 18 deletions

View File

@ -116,7 +116,7 @@ static uint16_t icmp_datahandler(FAR struct net_driver_s *dev,
if (iob == NULL)
{
nerr("ERROR: Failed to create new I/O buffer chain\n");
return 0;
goto drop;
}
/* Put the IPv4 address at the beginning of the read-ahead buffer */
@ -143,8 +143,7 @@ static uint16_t icmp_datahandler(FAR struct net_driver_s *dev,
*/
nerr("ERROR: Failed to length to the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
offset = sizeof(uint8_t);
@ -158,8 +157,7 @@ static uint16_t icmp_datahandler(FAR struct net_driver_s *dev,
*/
nerr("ERROR: Failed to source address to the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
offset += sizeof(struct sockaddr_in);
@ -175,8 +173,7 @@ static uint16_t icmp_datahandler(FAR struct net_driver_s *dev,
*/
nerr("ERROR: Failed to add data to the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
/* Add the new I/O buffer chain to the tail of the read-ahead queue (again
@ -187,12 +184,19 @@ static uint16_t icmp_datahandler(FAR struct net_driver_s *dev,
if (ret < 0)
{
nerr("ERROR: Failed to queue the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
ninfo("Buffered %d bytes\n", buflen + addrsize + 1);
dev->d_len = 0;
return buflen;
drop_with_chain:
(void)iob_free_chain(iob);
drop:
dev->d_len = 0;
return 0;
}
#endif

View File

@ -126,7 +126,7 @@ static uint16_t icmpv6_datahandler(FAR struct net_driver_s *dev,
if (iob == NULL)
{
nerr("ERROR: Failed to create new I/O buffer chain\n");
return 0;
goto drop;
}
/* Put the IPv6 address at the beginning of the read-ahead buffer */
@ -150,8 +150,7 @@ static uint16_t icmpv6_datahandler(FAR struct net_driver_s *dev,
*/
nerr("ERROR: Failed to length to the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
offset = sizeof(uint8_t);
@ -165,8 +164,7 @@ static uint16_t icmpv6_datahandler(FAR struct net_driver_s *dev,
*/
nerr("ERROR: Failed to source address to the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
offset += sizeof(struct sockaddr_in6);
@ -182,8 +180,7 @@ static uint16_t icmpv6_datahandler(FAR struct net_driver_s *dev,
*/
nerr("ERROR: Failed to add data to the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
/* Add the new I/O buffer chain to the tail of the read-ahead queue (again
@ -194,12 +191,19 @@ static uint16_t icmpv6_datahandler(FAR struct net_driver_s *dev,
if (ret < 0)
{
nerr("ERROR: Failed to queue the I/O buffer chain: %d\n", ret);
(void)iob_free_chain(iob);
return 0;
goto drop_with_chain;
}
ninfo("Buffered %d bytes\n", buflen + addrsize + 1);
dev->d_len = 0;
return buflen;
drop_with_chain:
(void)iob_free_chain(iob);
drop:
dev->d_len = 0;
return 0;
}
#endif