--- a/lib/quagga/Makefile
+++ b/lib/quagga/Makefile
-@@ -40,21 +40,19 @@ OLSRD_PLUGIN = true
+@@ -40,21 +40,19 @@
PLUGIN_NAME = olsrd_quagga
PLUGIN_VER = 0.2.2
default_target: $(PLUGIN_FULLNAME)
$(PLUGIN_FULLNAME): $(OBJS) version-script.txt
-@@ -66,4 +64,5 @@ install: $(PLUGIN_FULLNAME)
+@@ -66,4 +64,5 @@
clean:
rm -f $(OBJS) $(SRCS:%.c=%.d) $(PLUGIN_FULLNAME)
---------------------------------------------------------------------
PLUGIN PARAMETERS (PlParam)
-@@ -27,22 +27,22 @@ PlParam "redistribute" "<protocol>"
+@@ -27,22 +27,22 @@
May be used more then once
PlParam "ExportRoutes" "<only/both>"
LoadPlugin "olsrd_quagga.so.0.2.2"
{
-@@ -55,4 +55,4 @@ LoadPlugin "olsrd_quagga.so.0.2.2"
+@@ -55,4 +55,4 @@
---------------------------------------------------------------------
#include "net_olsr.h"
#define PLUGIN_NAME "OLSRD quagga plugin"
-@@ -41,120 +43,94 @@ static set_plugin_parameter set_exportro
+@@ -41,120 +43,94 @@
static set_plugin_parameter set_distance;
static set_plugin_parameter set_localpref;
route.metric = 0;
if (zebra.distance) {
-@@ -868,36 +557,23 @@ zebra_del_olsr_v4_route(const struct rt_
+@@ -868,36 +557,23 @@
route.distance = zebra.distance;
}
+++ /dev/null
---- a/lib/httpinfo/src/olsrd_httpinfo.c
-+++ b/lib/httpinfo/src/olsrd_httpinfo.c
-@@ -673,9 +673,16 @@
- void
- olsr_plugin_exit(void)
- {
-+ struct allowed_net *a, *next;
- if (http_socket >= 0) {
- CLOSE(http_socket);
- }
-+
-+ for (a = allowed_nets; a != NULL; a = next) {
-+ next = a->next;
-+
-+ free(a);
-+ }
- }
-
- static void
---- a/src/interfaces.h
-+++ b/src/interfaces.h
-@@ -187,6 +187,7 @@
- extern struct interface *ifnet;
-
- int ifinit(void);
-+void olsr_delete_interfaces(void);
-
- void run_ifchg_cbs(struct interface *, int);
-
---- a/src/linux/kernel_routes.c
-+++ b/src/linux/kernel_routes.c
-@@ -84,6 +84,8 @@
- OLSR_PRINTF(1,"could not create rtnetlink socket! %d",sock);
- }
- else {
-+ memset(&addr, 0, sizeof(addr));
-+
- addr.nl_family = AF_NETLINK;
- addr.nl_pid = 0; //kernel will assign appropiate number instead of pid (which is already used by primaray rtnetlink socket to add/delete routes)
- addr.nl_groups = rtnl_mgrp;
---- a/src/main.c
-+++ b/src/main.c
-@@ -57,6 +57,7 @@
- #include "net_os.h"
- #include "build_msg.h"
- #include "net_olsr.h"
-+#include "mid_set.h"
-
- #if LINUX_POLICY_ROUTING
- #include <linux/types.h>
-@@ -514,6 +515,7 @@
- #endif
- {
- struct interface *ifn;
-+ int exit_value;
-
- OLSR_PRINTF(1, "Received signal %d - shutting down\n", (int)signo);
-
-@@ -530,6 +532,12 @@
-
- olsr_delete_all_kernel_routes();
-
-+ olsr_delete_all_tc_entries();
-+
-+ olsr_delete_all_mid_entries();
-+
-+ olsr_destroy_parser();
-+
- OLSR_PRINTF(1, "Closing sockets...\n");
-
- /* front-end IPC socket */
-@@ -537,7 +545,6 @@
- shutdown_ipc();
- }
-
-- /* OLSR sockets */
- for (ifn = ifnet; ifn; ifn = ifn->int_next)
- close(ifn->olsr_socket);
-
-@@ -565,13 +572,17 @@
- #endif
-
- /* Free cookies and memory pools attached. */
-+ OLSR_PRINTF(0, "Free all memory...\n");
- olsr_delete_all_cookies();
-
- olsr_syslog(OLSR_LOG_INFO, "%s stopped", olsrd_version);
-
- OLSR_PRINTF(1, "\n <<<< %s - terminating >>>>\n http://www.olsr.org\n", olsrd_version);
-
-- exit(olsr_cnf->exit_value);
-+ exit_value = olsr_cnf->exit_value;
-+ free (olsr_cnf);
-+
-+ exit(exit_value);
- }
-
- /**
---- a/src/mid_set.c
-+++ b/src/mid_set.c
-@@ -38,6 +38,7 @@
- * the copyright holders.
- *
- */
-+#include <assert.h>
-
- #include "ipcalc.h"
- #include "defs.h"
-@@ -79,6 +80,15 @@
- return 1;
- }
-
-+void olsr_delete_all_mid_entries(void) {
-+ int hash;
-+
-+ for (hash = 0; hash < HASHSIZE; hash++) {
-+ while (mid_set[hash].next != &mid_set[hash]) {
-+ olsr_delete_mid_entry(mid_set[hash].next);
-+ }
-+ }
-+}
- /**
- * Wrapper for the timer callback.
- */
-@@ -124,10 +134,10 @@
- *
- * @param m_addr the main address of the node
- * @param alias the alias address to insert
-- * @return nada
-+ * @return false if mid_address is unnecessary, true otherwise
- */
-
--void
-+static bool
- insert_mid_tuple(union olsr_ip_addr *m_addr, struct mid_address *alias, olsr_reltime vtime)
- {
- struct mid_entry *tmp;
-@@ -147,9 +157,8 @@
- /* Check if alias is already registered with m_addr */
- registered_m_addr = mid_lookup_main_addr(&alias->alias);
- if (registered_m_addr != NULL && ipequal(registered_m_addr, m_addr)) {
--
- /* Alias is already registered with main address. Nothing to do here. */
-- return;
-+ return false;
- }
-
- /*
-@@ -223,6 +232,7 @@
- }
- tmp_adr = tmp_adr->next_alias;
- }
-+ return true;
- }
-
- /**
-@@ -284,7 +294,9 @@
- }
- }
-
-- insert_mid_tuple(main_add, adr, vtime);
-+ if (!insert_mid_tuple(main_add, adr, vtime)) {
-+ free(adr);
-+ }
-
- /*
- *Recalculate topology
---- a/src/mid_set.h
-+++ b/src/mid_set.h
-@@ -75,7 +75,7 @@
- struct mid_alias;
-
- int olsr_init_mid_set(void);
--void insert_mid_tuple(union olsr_ip_addr *, struct mid_address *, olsr_reltime);
-+void olsr_delete_all_mid_entries(void);
- void insert_mid_alias(union olsr_ip_addr *, const union olsr_ip_addr *, olsr_reltime);
- union olsr_ip_addr *mid_lookup_main_addr(const union olsr_ip_addr *);
- struct mid_address *mid_lookup_aliases(const union olsr_ip_addr *);
---- a/src/parser.c
-+++ b/src/parser.c
-@@ -102,6 +102,26 @@
- }
-
- void
-+olsr_destroy_parser(void) {
-+ struct parse_function_entry *pe, *pe_next;
-+ struct preprocessor_function_entry *ppe, *ppe_next;
-+ struct packetparser_function_entry *pae, *pae_next;
-+
-+ for (pe = parse_functions; pe; pe = pe_next) {
-+ pe_next = pe->next;
-+ free (pe);
-+ }
-+ for (ppe = preprocessor_functions; ppe; ppe = ppe_next) {
-+ ppe_next = ppe->next;
-+ free (ppe);
-+ }
-+ for (pae = packetparser_functions; pae; pae = pae_next) {
-+ pae_next = pae->next;
-+ free(pae);
-+ }
-+}
-+
-+void
- olsr_parser_add_function(parse_function * function, uint32_t type)
- {
- struct parse_function_entry *new_entry;
---- a/src/parser.h
-+++ b/src/parser.h
-@@ -74,6 +74,8 @@
-
- void olsr_init_parser(void);
-
-+void olsr_destroy_parser(void);
-+
- void olsr_input(int);
-
- void olsr_input_hostemu(int);
---- a/src/scheduler.c
-+++ b/src/scheduler.c
-@@ -40,6 +40,8 @@
- *
- */
-
-+#include <assert.h>
-+
- #include "defs.h"
- #include "scheduler.h"
- #include "log.h"
---- a/src/tc_set.c
-+++ b/src/tc_set.c
-@@ -205,6 +205,14 @@
- tc_myself = olsr_add_tc_entry(&olsr_cnf->main_addr);
- }
-
-+void olsr_delete_all_tc_entries(void) {
-+ struct tc_entry *tc;
-+
-+ OLSR_FOR_ALL_TC_ENTRIES(tc) {
-+ olsr_delete_tc_entry(tc);
-+ } OLSR_FOR_ALL_TC_ENTRIES_END(tc)
-+}
-+
- /**
- * The main ip address has changed.
- * Do the needful.
---- a/src/tc_set.h
-+++ b/src/tc_set.h
-@@ -142,6 +142,7 @@
- extern struct tc_entry *tc_myself;
-
- void olsr_init_tc(void);
-+void olsr_delete_all_tc_entries(void);
- void olsr_change_myself_tc(void);
- void olsr_print_tc_table(void);
- void olsr_time_out_tc_set(void);