From d51884e6e1efb98e01fd8839be426c767f375092 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Thu, 14 Feb 2019 14:06:41 +0100 Subject: [PATCH] ospf6d: closing server socket when leaving ospf6d this commit brings consistency as it closes the socket used to carry ospfv3 messages. Signed-off-by: Philippe Guibert --- ospf6d/ospf6_main.c | 2 ++ ospf6d/ospf6_network.c | 9 +++++++++ ospf6d/ospf6_network.h | 1 + 3 files changed, 12 insertions(+) diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 046badc824..289c7dc18c 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -43,6 +43,7 @@ #include "ospf6d.h" #include "ospf6_top.h" #include "ospf6_message.h" +#include "ospf6_network.h" #include "ospf6_asbr.h" #include "ospf6_lsa.h" #include "ospf6_interface.h" @@ -97,6 +98,7 @@ static void __attribute__((noreturn)) ospf6_exit(int status) ospf6_asbr_terminate(); ospf6_lsa_terminate(); + ospf6_serv_close(); /* reverse access_list_init */ access_list_reset(); diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 136e931d3d..625ad884f2 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -73,6 +73,15 @@ static void ospf6_set_checksum(void) #endif /* DISABLE_IPV6_CHECKSUM */ } +void ospf6_serv_close(void) +{ + if (ospf6_sock > 0) { + close(ospf6_sock); + ospf6_sock = -1; + return; + } +} + /* Make ospf6d's server socket. */ int ospf6_serv_sock(void) { diff --git a/ospf6d/ospf6_network.h b/ospf6d/ospf6_network.h index 7c7c155fbf..7fe6e33ff2 100644 --- a/ospf6d/ospf6_network.h +++ b/ospf6d/ospf6_network.h @@ -26,6 +26,7 @@ extern struct in6_addr allspfrouters6; extern struct in6_addr alldrouters6; extern int ospf6_serv_sock(void); +extern void ospf6_serv_close(void); extern int ospf6_sso(ifindex_t ifindex, struct in6_addr *group, int option); extern int ospf6_sendmsg(struct in6_addr *, struct in6_addr *, ifindex_t *, -- 2.39.5