From 2bc089798fb76265d5861ee3ff5beff2623ea726 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 17 Jan 2010 17:57:24 +0000 Subject: [PATCH 1/1] [packages] olsrd: update to v0.5.6-r8 git-svn-id: svn://svn.openwrt.org/openwrt/packages/net/olsrd@19192 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- Makefile | 6 +- patches/100-no_forwarding_override.patch | 8 +- patches/150-olsrd_quagga_backport.patch | 12 +- patches/200-mid_memory_cleanup.patch | 256 ----------------------- 4 files changed, 13 insertions(+), 269 deletions(-) delete mode 100644 patches/200-mid_memory_cleanup.patch diff --git a/Makefile b/Makefile index 71f78b4..0cdee21 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=olsrd -PKG_VERSION:=0.5.6-r7 -PKG_RELEASE:=2 +PKG_VERSION:=0.5.6-r8 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=http://www.olsr.org/releases/0.5 -PKG_MD5SUM:=dde8cb45a10f0cad2010ab2e8ad55146 +PKG_MD5SUM:=aef6f4350c44fd0ad015a26621ef9607 include $(INCLUDE_DIR)/package.mk diff --git a/patches/100-no_forwarding_override.patch b/patches/100-no_forwarding_override.patch index 1ef2552..c6e1b4e 100644 --- a/patches/100-no_forwarding_override.patch +++ b/patches/100-no_forwarding_override.patch @@ -1,6 +1,6 @@ --- a/src/linux/net.c +++ b/src/linux/net.c -@@ -107,6 +107,7 @@ bind_socket_to_device(int sock, char *de +@@ -115,6 +115,7 @@ int enable_ip_forwarding(int version) { @@ -8,7 +8,7 @@ FILE *proc_fwd; const char *const procfile = version == AF_INET ? "/proc/sys/net/ipv4/ip_forward" : "/proc/sys/net/ipv6/conf/all/forwarding"; -@@ -142,6 +143,7 @@ enable_ip_forwarding(int version) +@@ -150,6 +151,7 @@ } fclose(proc_fwd); } @@ -16,7 +16,7 @@ return 1; } -@@ -268,6 +270,7 @@ restore_settings(int version) +@@ -276,6 +278,7 @@ OLSR_PRINTF(1, "Restoring network state\n"); /* Restore IP forwarding to "off" */ @@ -24,7 +24,7 @@ if (orig_fwd_state == '0') { const char *const procfile = version == AF_INET ? "/proc/sys/net/ipv4/ip_forward" : "/proc/sys/net/ipv6/conf/all/forwarding"; FILE *proc_fd; -@@ -280,6 +283,7 @@ restore_settings(int version) +@@ -288,6 +291,7 @@ fclose(proc_fd); } } diff --git a/patches/150-olsrd_quagga_backport.patch b/patches/150-olsrd_quagga_backport.patch index 59eac71..a8ff830 100644 --- a/patches/150-olsrd_quagga_backport.patch +++ b/patches/150-olsrd_quagga_backport.patch @@ -1,6 +1,6 @@ --- 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 @@ -27,7 +27,7 @@ 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) @@ -928,7 +928,7 @@ --------------------------------------------------------------------- PLUGIN PARAMETERS (PlParam) -@@ -27,22 +27,22 @@ PlParam "redistribute" "" +@@ -27,22 +27,22 @@ May be used more then once PlParam "ExportRoutes" "" @@ -956,7 +956,7 @@ LoadPlugin "olsrd_quagga.so.0.2.2" { -@@ -55,4 +55,4 @@ LoadPlugin "olsrd_quagga.so.0.2.2" +@@ -55,4 +55,4 @@ --------------------------------------------------------------------- @@ -1010,7 +1010,7 @@ #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; @@ -2935,7 +2935,7 @@ 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; } diff --git a/patches/200-mid_memory_cleanup.patch b/patches/200-mid_memory_cleanup.patch deleted file mode 100644 index 513fc68..0000000 --- a/patches/200-mid_memory_cleanup.patch +++ /dev/null @@ -1,256 +0,0 @@ ---- 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 -@@ -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 - - #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 -+ - #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); -- 2.30.2