netapp api init bug


Erwin Rol
 

Hallo All,

in zephyr/subsys/net/lib/app/init.c the following piece of code;

int net_app_init(const char *app_info, u32_t flags, s32_t timeout)
{
#define LOOP_DEVIDER 10
struct net_if *iface = net_if_get_default();
int loop = timeout / LOOP_DEVIDER;
int count = 0;

if (app_info) {
NET_INFO("%s", app_info);
}

if (flags & NET_APP_NEED_IPV6) {
count++;
}

if (flags & NET_APP_NEED_IPV4) {
count++;
}

k_sem_init(&counter, count, count);



causes and assert in k_sem_init when neither NET_APP_NEED_IPV6 or
NET_APP_NEED_IPV4 are selected, because count will be 0 and the sem
limit, 3rd arg of k_sem_init, is not allowed to be 0.


And shouldn't it be LOOP_DIVIDER instead of LOOP_DEVIDER?

- Erwin

Join devel@lists.zephyrproject.org to automatically receive all group messages.