net: lib: config: Timeout when network interface is down

If the network interface is down, we should timeout properly
and let the application to handle the situation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2020-03-14 11:52:47 +02:00
commit 077b52c6f8

View file

@ -376,6 +376,14 @@ int net_config_init(const char *app_info, u32_t flags, s32_t timeout)
#endif #endif
} }
if (count == 0) {
/* Network interface did not come up. We will not try
* to setup things in that case.
*/
NET_ERR("Timeout while waiting network %s", "interface");
return -ENETDOWN;
}
if (flags & NET_CONFIG_NEED_IPV6) { if (flags & NET_CONFIG_NEED_IPV6) {
need++; need++;
} }
@ -402,7 +410,7 @@ int net_config_init(const char *app_info, u32_t flags, s32_t timeout)
} }
if (!count && timeout) { if (!count && timeout) {
NET_ERR("Timeout while waiting setup"); NET_ERR("Timeout while waiting network %s", "setup");
return -ETIMEDOUT; return -ETIMEDOUT;
} }