diff options
| author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-02-14 14:06:41 +0100 | 
|---|---|---|
| committer | Philippe Guibert <philippe.guibert@6wind.com> | 2019-02-14 18:24:01 +0100 | 
| commit | d51884e6e1efb98e01fd8839be426c767f375092 (patch) | |
| tree | 9c8ae081d6218f9b1831e23ab573808aaaadd2af | |
| parent | c8b9f5fb1271a5b02fd0abc9b3f55c6c5bf9e4de (diff) | |
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 <philippe.guibert@6wind.com>
| -rw-r--r-- | ospf6d/ospf6_main.c | 2 | ||||
| -rw-r--r-- | ospf6d/ospf6_network.c | 9 | ||||
| -rw-r--r-- | ospf6d/ospf6_network.h | 1 | 
3 files changed, 12 insertions, 0 deletions
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 *,  | 
