From 108f0846d6c2f6f563aff1fe8f5b442aadd45937 Mon Sep 17 00:00:00 2001 From: lemoer Date: Thu, 1 Dec 2016 01:09:49 +0100 Subject: [PATCH] respondd: the iface info is only inserted if if_nametoindex() was successful --- net/respondd/src/respondd.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/net/respondd/src/respondd.c b/net/respondd/src/respondd.c index 3be8731..47cf6e2 100644 --- a/net/respondd/src/respondd.c +++ b/net/respondd/src/respondd.c @@ -621,14 +621,17 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } - // insert the interface delay info at the beginning of the list - struct interface_delay_info **head = &if_delay_info_list; - struct interface_delay_info *old_head = if_delay_info_list; + if (last_ifindex) { + // insert the interface delay info at the beginning of the list + struct interface_delay_info **head = &if_delay_info_list; + struct interface_delay_info *old_head = if_delay_info_list; + + *head = malloc(sizeof(*if_delay_info_list)); + (*head)->ifindex = last_ifindex; + (*head)->max_multicast_delay = max_multicast_delay; + (*head)->next = old_head; + } - *head = malloc(sizeof(*if_delay_info_list)); - (*head)->ifindex = last_ifindex; - (*head)->max_multicast_delay = max_multicast_delay; - (*head)->next = old_head; break;