I.e. when calling list_del() and list_add(). We have a list of struct ifindex_node but the fns want struct list_head which is at the head of struct ifindex_node. Also audit counter loops to count downwards (c/w 0 is faster). Signed-off-by: Duncan Roe <duncan_roe@xxxxxxxxxxxxxxx> --- src/iftable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/iftable.c b/src/iftable.c index 1a53893..7eada24 100644 --- a/src/iftable.c +++ b/src/iftable.c @@ -192,7 +192,7 @@ struct nlif_handle *nlif_open(void) if (h == NULL) goto err; - for (i=0; i < NUM_NLIF_ENTRIES; i++) + for (i = NUM_NLIF_ENTRIES - 1; i>= 0; i--) INIT_LIST_HEAD(&h->ifindex_hash[i]); h->nl = mnl_socket_open(NETLINK_ROUTE); @@ -226,9 +226,9 @@ void nlif_close(struct nlif_handle *h) mnl_socket_close(h->nl); - for (i=0; i < NUM_NLIF_ENTRIES; i++) { + for (i = NUM_NLIF_ENTRIES - 1; i>= 0; i--) { list_for_each_entry_safe(this, tmp, &h->ifindex_hash[i], head) { - list_del(&this->head); + list_del((struct list_head *)this); free(this); } } @@ -359,7 +359,7 @@ static int data_cb(const struct nlmsghdr *nlh, void *data) this->index = ifi_msg->ifi_index; this->type = ifi_msg->ifi_type; this->flags = ifi_msg->ifi_flags; - list_add(&this->head, &h->ifindex_hash[hash]); + list_add((struct list_head *)this, &h->ifindex_hash[hash]); found: mnl_attr_for_each(attr, nlh, sizeof(*ifi_msg)) { /* All we want is the interface name */ -- 2.35.8