[package] quagga: add upstream patches fixing memory leaks
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 4 Apr 2012 14:13:50 +0000 (14:13 +0000)
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 4 Apr 2012 14:13:50 +0000 (14:13 +0000)
Signed-off-by: Oliver Smith <olipro@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
git-svn-id: svn://svn.openwrt.org/openwrt/packages@31190 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/quagga/Makefile
net/quagga/patches/180-fix-lib-connect-memleak.patch [new file with mode: 0644]
net/quagga/patches/181-ospf-null-ptr-fix.patch [new file with mode: 0644]
net/quagga/patches/182-fix-bgpd-memleak.patch [new file with mode: 0644]

index 3f5255a..94d2c54 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=quagga
 PKG_VERSION:=0.99.20
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_MD5SUM:=64cc29394eb8a4e24649d19dac868f64
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/net/quagga/patches/180-fix-lib-connect-memleak.patch b/net/quagga/patches/180-fix-lib-connect-memleak.patch
new file mode 100644 (file)
index 0000000..85b6c10
--- /dev/null
@@ -0,0 +1,61 @@
+From b24b19f719fdd9c3d61a0c93552cd64d832d964c Mon Sep 17 00:00:00 2001
+From: Stephen Hemminger <shemminger@vyatta.com>
+Date: Tue, 6 Dec 2011 14:09:18 +0400
+Subject: [PATCH] lib: fix memory leak on connect() failure
+
+Change sockunion_log() to not use strdup(). This fixes a small memory
+leak that occurs on every failed connect(), and is simpler/cleaner.
+---
+ lib/sockunion.c |   23 +++++++++++------------
+ 1 files changed, 11 insertions(+), 12 deletions(-)
+
+--- a/lib/sockunion.c
++++ b/lib/sockunion.c
+@@ -297,27 +297,24 @@ sockunion_sizeof (union sockunion *su)
+ }
+ /* return sockunion structure : this function should be revised. */
+-static char *
+-sockunion_log (union sockunion *su)
++static const char *
++sockunion_log (union sockunion *su, char *buf, size_t len)
+ {
+-  static char buf[SU_ADDRSTRLEN];
+-
+   switch (su->sa.sa_family) 
+     {
+     case AF_INET:
+-      snprintf (buf, SU_ADDRSTRLEN, "%s", inet_ntoa (su->sin.sin_addr));
+-      break;
++      return inet_ntop(AF_INET, &su->sin.sin_addr, buf, len);
++
+ #ifdef HAVE_IPV6
+     case AF_INET6:
+-      snprintf (buf, SU_ADDRSTRLEN, "%s",
+-              inet_ntop (AF_INET6, &(su->sin6.sin6_addr), buf, SU_ADDRSTRLEN));
++      return inet_ntop(AF_INET6, &(su->sin6.sin6_addr), buf, len);
+       break;
+ #endif /* HAVE_IPV6 */
++
+     default:
+-      snprintf (buf, SU_ADDRSTRLEN, "af_unknown %d ", su->sa.sa_family);
+-      break;
++      snprintf (buf, len, "af_unknown %d ", su->sa.sa_family);
++      return buf;
+     }
+-  return (XSTRDUP (MTYPE_TMP, buf));
+ }
+ /* sockunion_connect returns
+@@ -379,8 +376,10 @@ sockunion_connect (int fd, union sockuni
+     {
+       if (errno != EINPROGRESS)
+       {
++        char str[SU_ADDRSTRLEN];
+         zlog_info ("can't connect to %s fd %d : %s",
+-                   sockunion_log (&su), fd, safe_strerror (errno));
++                   sockunion_log (&su, str, sizeof str),
++                   fd, safe_strerror (errno));
+         return connect_error;
+       }
+     }
diff --git a/net/quagga/patches/181-ospf-null-ptr-fix.patch b/net/quagga/patches/181-ospf-null-ptr-fix.patch
new file mode 100644 (file)
index 0000000..9ae47cf
--- /dev/null
@@ -0,0 +1,51 @@
+From 6a2e0f36b103386e57dbe3a6ee4716e809111198 Mon Sep 17 00:00:00 2001
+From: Stephen Hemminger <shemminger@vyatta.com>
+Date: Tue, 6 Dec 2011 14:04:12 +0400
+Subject: [PATCH] lib: call filter delete hook before freeing access list
+
+The delete_hook was being run after calling access list delete function.
+This would cause ospf to dereference a NULL, in ospf_filter_update
+because 'access->name' was already freed.
+
+See also:
+    https://bugzilla.vyatta.com/show_bug.cgi?id=7654
+---
+ lib/filter.c |   12 ++++++------
+ 1 files changed, 6 insertions(+), 6 deletions(-)
+
+--- a/lib/filter.c
++++ b/lib/filter.c
+@@ -1337,13 +1337,13 @@ DEFUN (no_access_list_all,
+   master = access->master;
+-  /* Delete all filter from access-list. */
+-  access_list_delete (access);
+-
+   /* Run hook function. */
+   if (master->delete_hook)
+     (*master->delete_hook) (access);
+  
++  /* Delete all filter from access-list. */
++  access_list_delete (access);
++
+   return CMD_SUCCESS;
+ }
+@@ -1508,13 +1508,13 @@ DEFUN (no_ipv6_access_list_all,
+   master = access->master;
+-  /* Delete all filter from access-list. */
+-  access_list_delete (access);
+-
+   /* Run hook function. */
+   if (master->delete_hook)
+     (*master->delete_hook) (access);
++  /* Delete all filter from access-list. */
++  access_list_delete (access);
++
+   return CMD_SUCCESS;
+ }
diff --git a/net/quagga/patches/182-fix-bgpd-memleak.patch b/net/quagga/patches/182-fix-bgpd-memleak.patch
new file mode 100644 (file)
index 0000000..3084585
--- /dev/null
@@ -0,0 +1,20 @@
+From ce0af6ff5a4f200035ed4134da72a67f49a21dd6 Mon Sep 17 00:00:00 2001
+From: "Oleg A. Arkhangelsky" <sysoleg@yandex.ru>
+Date: Sat, 3 Dec 2011 15:18:19 +0400
+Subject: [PATCH] bgpd: fix memory leak for extra attributes
+
+this fixes commit b881c7074bb698aeb1b099175b325734fc6e44d2
+---
+ bgpd/bgp_attr.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+--- a/bgpd/bgp_attr.c
++++ b/bgpd/bgp_attr.c
+@@ -675,6 +675,7 @@ bgp_attr_unintern (struct attr **attr)
+     }
+   bgp_attr_unintern_sub (&tmp);
++  bgp_attr_extra_free (&tmp);
+ }
+ void