Skip to content

Commit

Permalink
Merge pull request #3802 from pguibert6WIND/ospfv3_misc_fixes
Browse files Browse the repository at this point in the history
Ospfv3 misc fixes
  • Loading branch information
eqvinox committed Feb 18, 2019
2 parents b57442d + 18f286a commit 5243b75
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 1 deletion.
13 changes: 13 additions & 0 deletions ospf6d/ospf6_area.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,3 +1022,16 @@ void ospf6_area_init(void)
install_element(OSPF6_NODE, &area_filter_list_cmd);
install_element(OSPF6_NODE, &no_area_filter_list_cmd);
}

void ospf6_area_interface_delete(struct ospf6_interface *oi)
{
struct ospf6_area *oa;
struct listnode *node, *nnode;

if (!ospf6)
return;
for (ALL_LIST_ELEMENTS(ospf6->area_list, node, nnode, oa))
if(listnode_lookup(oa->if_list, oi))
listnode_delete(oa->if_list, oi);

}
2 changes: 2 additions & 0 deletions ospf6d/ospf6_area.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,7 @@ extern void ospf6_area_show(struct vty *, struct ospf6_area *);
extern void ospf6_area_plist_update(struct prefix_list *plist, int add);
extern void ospf6_area_config_write(struct vty *vty);
extern void ospf6_area_init(void);
struct ospf6_interface;
extern void ospf6_area_interface_delete(struct ospf6_interface *oi);

#endif /* OSPF_AREA_H */
3 changes: 3 additions & 0 deletions ospf6d/ospf6_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ void ospf6_interface_delete(struct ospf6_interface *oi)

ospf6_bfd_info_free(&(oi->bfd_info));

/* disable from area list if possible */
ospf6_area_interface_delete(oi);

XFREE(MTYPE_OSPF6_IF, oi);
}

Expand Down
6 changes: 5 additions & 1 deletion ospf6d/ospf6_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -84,8 +85,10 @@ static void __attribute__((noreturn)) ospf6_exit(int status)

frr_early_fini();

if (ospf6)
if (ospf6) {
ospf6_delete(ospf6);
ospf6 = NULL;
}

bfd_gbl_exit();

Expand All @@ -97,6 +100,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();

Expand Down
10 changes: 10 additions & 0 deletions ospf6d/ospf6_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -163,6 +172,7 @@ int ospf6_sendmsg(struct in6_addr *src, struct in6_addr *dst,
assert(dst);
assert(*ifindex);

memset(&cmsgbuf, 0, sizeof(cmsgbuf));
scmsgp = (struct cmsghdr *)&cmsgbuf;
pktinfo = (struct in6_pktinfo *)(CMSG_DATA(scmsgp));
memset(&dst_sin6, 0, sizeof(struct sockaddr_in6));
Expand Down
1 change: 1 addition & 0 deletions ospf6d/ospf6_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *,
Expand Down

0 comments on commit 5243b75

Please sign in to comment.