Skip to content
Snippets Groups Projects
Commit 34509a9a authored by Gregory Nutt's avatar Gregory Nutt
Browse files

UDP should use dev=NULL if the address in the lookup is INADDR_ANY

parent 75346a4f
No related branches found
No related tags found
No related merge requests found
......@@ -79,6 +79,19 @@ FAR struct net_driver_s *udp_find_ipv4_device(FAR struct udp_conn_s *conn,
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct net_driver_s *dev;
/* Return NULL if the address is INADDR_ANY. In this case, there is
* there may be multiple devices that can provide data so the exceptional
* events from any particular device are not important.
*
* Of course, it would be a problem if this is the remote address of
* sendto().
*/
if (ipv4addr == INADDR_ANY)
{
return NULL;
}
/* There are multiple network devices. We need to select the device that
* is going to route the UDP packet based on the provided IP address.
*/
......@@ -86,6 +99,8 @@ FAR struct net_driver_s *udp_find_ipv4_device(FAR struct udp_conn_s *conn,
return netdev_findby_ipv4addr(conn->u.ipv4.laddr, ipv4addr);
#else
/* Return NULL if the address is IN6ADDR_ANY */
/* There is only a single network device... the one at the head of the
* g_netdevices list.
*/
......@@ -116,6 +131,19 @@ FAR struct net_driver_s *udp_find_ipv6_device(FAR struct udp_conn_s *conn,
#ifdef CONFIG_NETDEV_MULTINIC
FAR struct net_driver_s *dev;
/* Return NULL if the address is IN6ADDR_ANY. In this case, there is
* there may be multiple devices that can provide data so the exceptional
* events from any particular device are not important.
*
* Of course, it would be a problem if this is the remote address of
* sendto().
*/
if (net_ipv4addr_cmp(conn->u.ipv4.laddr, g_ipv4_allzeroaddr))
{
return NULL;
}
/* There are multiple network devices. We need to select the device that
* is going to route the UDP packet based on the provided IP address.
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment