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>
This commit is contained in:
Philippe Guibert 2019-02-14 14:06:41 +01:00
parent c8b9f5fb12
commit d51884e6e1
3 changed files with 12 additions and 0 deletions

View File

@ -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();

View File

@ -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)
{

View File

@ -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 *,