Detach IP from source list before reattaching to destination and
decrement ipcount. This prevents list corruption and counter mismatch.
}
if (!found) {
- /* This ip is not in the seen list. Add it. */
- dlinkAddTail(&new_ipdata->node, &ipdata->node, &ip_list);
- ++ipcount;
/* remove from the source list */
dlinkDelete(&new_ipdata->node, &(from->ip_list));
- ++from->ipcount;
+ assert(from->ipcount);
+ --from->ipcount;
+ /* This ip is not in the seen list. Add it. */
+ dlinkAddTail(new_ipdata, &new_ipdata->node, &ip_list);
+ ++ipcount;
}
}
}