Skip to content

Commit

Permalink
babeld: Free up memory on shutdown
Browse files Browse the repository at this point in the history
a) call vector_delete on created vector on shutdown.
b) Call babel_clean_routing_process on shutdown

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Aug 13, 2024
1 parent f01205b commit 68fff49
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions babeld/babel_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,11 @@ DEFUN (show_babel_parameters,
return CMD_SUCCESS;
}

void babel_if_terminate(void)
{
vector_free(babel_enable_if);
}

void
babel_if_init(void)
{
Expand Down
1 change: 1 addition & 0 deletions babeld/babel_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct buffered_update {

/* init function */
void babel_if_init(void);
void babel_if_terminate(void);

/* Callback functions for zebra client */
int babel_interface_up (int, struct zclient *, zebra_size_t, vrf_id_t);
Expand Down
4 changes: 2 additions & 2 deletions babeld/babel_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ babel_exit_properly(void)

/* Uninstall and flush all routes. */
debugf(BABEL_DEBUG_COMMON, "Uninstall routes.");
flush_all_routes();
babel_interface_close_all();
babel_clean_routing_process();
babel_zebra_close_connexion();
babel_if_terminate();
babel_save_state_file();
debugf(BABEL_DEBUG_COMMON, "Remove pid file.");
debugf(BABEL_DEBUG_COMMON, "Done.");
Expand Down
3 changes: 1 addition & 2 deletions babeld/babeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ babel_initial_noise(void)
}

/* Delete all the added babel routes, make babeld only speak to zebra. */
static void
babel_clean_routing_process(void)
void babel_clean_routing_process(void)
{
flush_all_routes();
babel_interface_close_all();
Expand Down
1 change: 1 addition & 0 deletions babeld/babeld.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ extern int redistribute_filter(const unsigned char *prefix, unsigned short plen,
extern int resize_receive_buffer(int size);
extern void schedule_neighbours_check(int msecs, int override);
extern struct babel *babel_lookup(void);
extern void babel_clean_routing_process(void);

#endif /* BABEL_BABELD_H */

0 comments on commit 68fff49

Please sign in to comment.