diff --git a/sys/net/crosslayer/ng_netif/ng_netif.c b/sys/net/crosslayer/ng_netif/ng_netif.c index 29fef6ba37c14c77523ca7a8abd93862de62ea7d..fe70a0381e90642b492c4c1cf2a2dd4ff8cf0397 100644 --- a/sys/net/crosslayer/ng_netif/ng_netif.c +++ b/sys/net/crosslayer/ng_netif/ng_netif.c @@ -60,7 +60,9 @@ int ng_netif_add(kernel_pid_t pid) void ng_netif_remove(kernel_pid_t pid) { - for (int i = 0; i < NG_NETIF_NUMOF; i++) { + int i; + + for (i = 0; i < NG_NETIF_NUMOF; i++) { if (ifs[i] == pid) { ifs[i] = KERNEL_PID_UNDEF; @@ -68,10 +70,15 @@ void ng_netif_remove(kernel_pid_t pid) if_handler[j].remove(pid); } - return; + break; } } + for (; (i < (NG_NETIF_NUMOF - 1)) && (ifs[i + 1] != KERNEL_PID_UNDEF); i++) { + ifs[i] = ifs[i + 1]; + } + + ifs[i] = KERNEL_PID_UNDEF; /* set in case of i == (NG_NETIF_NUMOF - 1) */ } kernel_pid_t *ng_netif_get(size_t *size)