net/udp/udp_finddev.c: Fallback to netdev_default device if the device is not found, rather than arbitrary using the device at the head of the list of devices.

This commit is contained in:
Xiang Xiao 2018-11-09 11:05:45 -06:00 committed by Gregory Nutt
parent 0d13cb5055
commit 9e42bede2f
1 changed files with 4 additions and 6 deletions

View File

@ -96,16 +96,14 @@ static FAR struct net_driver_s *upd_bound_device(FAR struct udp_conn_s *conn)
} }
} }
/* REVISIT: If no device was bound or the bound device is no longer valid, /* If no device was bound or the bound device is no longer valid,
* then just return the arbitrary device at the head of the list of * then let's try the default network device.
* registered devices. This is lunacy if there are multiple, registered
* network devices but makes perfectly good since if there is only one.
*/ */
return dev == NULL ? g_netdevices : dev; return dev == NULL ? netdev_default() : dev;
} }
#else #else
# define upd_bound_device(c) g_netdevices # define upd_bound_device(c) netdev_default();
#endif #endif