add: in_if_detach(ifp);    for(index = 0; index < if_index; index++) { if(found) { --ifnet_addrs[index]->ifa_ifp->if_index; ifnet_addrs[index - 1] = ifnet_addrs[index]; }  if(ifnet_addrs[index]->ifa_ifp == ifp) { found = true; free(ifnet_addrs[index]); } }  if(found) --if_index;
context: void if_detach(struct ifnet *ifp){	struct ifnet *p = devices, *q = NULL;		for(; p && p != ifp; p = p->if_next)		q = p;		if(!p)		return;		if(q)		q->if_next = p->if_next;	else		devices = p->if_next;		free(p->if_name);}