packages: quagga/quagga.spec, quagga/quagga-0.99.11-BGP-4-byte-ASN-bug-fixe...

gotar gotar at pld-linux.org
Sun May 3 14:42:38 CEST 2009


Author: gotar                        Date: Sun May  3 12:42:38 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- added 32-bit ASN fix, STBR ASAP!

---- Files affected:
packages/quagga:
   quagga.spec (1.54 -> 1.55) , quagga-0.99.11-BGP-4-byte-ASN-bug-fixes.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/quagga/quagga.spec
diff -u packages/quagga/quagga.spec:1.54 packages/quagga/quagga.spec:1.55
--- packages/quagga/quagga.spec:1.54	Fri Apr 10 11:25:41 2009
+++ packages/quagga/quagga.spec	Sun May  3 14:42:33 2009
@@ -3,7 +3,7 @@
 Summary(pl.UTF-8):	Zestaw oprogramowania do routingu
 Name:		quagga
 Version:	0.99.11
-Release:	2
+Release:	3
 License:	GPL
 Group:		Networking/Daemons
 Source0:	http://www.quagga.net/download/%{name}-%{version}.tar.gz
@@ -40,6 +40,7 @@
 Patch7:		%{name}-link.patch
 Patch8:		%{name}-view_commands.patch
 Patch9:		%{name}-save_history.patch
+Patch10:	%{name}-0.99.11-BGP-4-byte-ASN-bug-fixes.patch
 URL:		http://www.quagga.net/
 BuildRequires:	autoconf >= 2.53
 BuildRequires:	automake
@@ -208,6 +209,7 @@
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
 
 %build
 %{__libtoolize}
@@ -496,6 +498,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.55  2009/05/03 12:42:33  gotar
+- added 32-bit ASN fix, STBR ASAP!
+
 Revision 1.54  2009/04/10 09:25:41  gotar
 - fixed sorting
 

================================================================
Index: packages/quagga/quagga-0.99.11-BGP-4-byte-ASN-bug-fixes.patch
diff -u /dev/null packages/quagga/quagga-0.99.11-BGP-4-byte-ASN-bug-fixes.patch:1.1
--- /dev/null	Sun May  3 14:42:39 2009
+++ packages/quagga/quagga-0.99.11-BGP-4-byte-ASN-bug-fixes.patch	Sun May  3 14:42:33 2009
@@ -0,0 +1,121 @@
+--- quagga-0.99.10-stock/bgpd/bgp_aspath.c	2008-04-10 11:47:45.000000000 +0000
++++ quagga-0.99.10/bgpd/bgp_aspath.c	2009-04-30 20:12:22.000000000 +0000
+@@ -393,25 +393,6 @@ aspath_delimiter_char (u_char type, u_ch
+   return ' ';
+ }
+ 
+-/* countup asns from this segment and index onward */
+-static int
+-assegment_count_asns (struct assegment *seg, int from)
+-{
+-  int count = 0;
+-  while (seg)
+-    {
+-      if (!from)
+-        count += seg->length;
+-      else
+-        {
+-          count += (seg->length - from);
+-          from = 0;
+-        }
+-      seg = seg->next;
+-    }
+-  return count;
+-}
+-
+ unsigned int
+ aspath_count_confeds (struct aspath *aspath)
+ {
+@@ -521,13 +502,23 @@ aspath_count_numas (struct aspath *aspat
+   return num;
+ }
+ 
++static char *
++aspath_expand (char *path,
++	       size_t *space,
++	       size_t needed)
++{
++  while (*space < needed)
++    *space *= 2;
++  return XREALLOC (MTYPE_AS_STR, path, *space);
++}
++
+ /* Convert aspath structure to string expression. */
+ static char *
+ aspath_make_str_count (struct aspath *as)
+ {
+   struct assegment *seg;
+-  int str_size;
+-  int len = 0;
++  size_t str_size;
++  size_t len = 0;
+   char *str_buf;
+ 
+   /* Empty aspath. */
+@@ -540,18 +531,7 @@ aspath_make_str_count (struct aspath *as
+   
+   seg = as->segments;
+   
+-  /* ASN takes 5 chars at least, plus seperator, see below.
+-   * If there is one differing segment type, we need an additional
+-   * 2 chars for segment delimiters, and the final '\0'.
+-   * Hopefully this is large enough to avoid hitting the realloc
+-   * code below for most common sequences.
+-   *
+-   * With 32bit ASNs, this range will increase, but only worth changing
+-   * once there are significant numbers of ASN >= 100000
+-   */
+-#define ASN_STR_LEN (5 + 1)
+-  str_size = MAX (assegment_count_asns (seg, 0) * ASN_STR_LEN + 2 + 1,
+-                  ASPATH_STR_DEFAULT_LEN);
++  str_size = ASPATH_STR_DEFAULT_LEN;
+   str_buf = XMALLOC (MTYPE_AS_STR, str_size);
+ 
+   while (seg)
+@@ -575,32 +555,25 @@ aspath_make_str_count (struct aspath *as
+             return NULL;
+         }
+       
+-      /* We might need to increase str_buf, particularly if path has
+-       * differing segments types, our initial guesstimate above will
+-       * have been wrong.  need 5 chars for ASN, a seperator each and
+-       * potentially two segment delimiters, plus a space between each
+-       * segment and trailing zero.
+-       *
+-       * This may need to revised if/when significant numbers of
+-       * ASNs >= 100000 are assigned and in-use on the internet...
+-       */
+-#define SEGMENT_STR_LEN(X) (((X)->length * ASN_STR_LEN) + 2 + 1 + 1)
+-      if ( (len + SEGMENT_STR_LEN(seg)) > str_size)
+-        {
+-          str_size = len + SEGMENT_STR_LEN(seg);
+-          str_buf = XREALLOC (MTYPE_AS_STR, str_buf, str_size);
+-        }
+-#undef ASN_STR_LEN
+-#undef SEGMENT_STR_LEN
+-      
+       if (seg->type != AS_SEQUENCE)
+-        len += snprintf (str_buf + len, str_size - len, 
+-			 "%c", 
+-                         aspath_delimiter_char (seg->type, AS_SEG_START));
++	{
++	  str_buf = aspath_expand (str_buf,
++				   &str_size,
++				   len + 2); /* %c + '\0' */
++	  len += snprintf (str_buf + len, str_size - len, 
++			   "%c", 
++			   aspath_delimiter_char (seg->type, AS_SEG_START));
++	}
+       
+       /* write out the ASNs, with their seperators, bar the last one*/
+       for (i = 0; i < seg->length; i++)
+         {
++#define APPROX_DIGIT_COUNT(x) (x < 100000U ? 5 : 10)
++	  /* %u + %c + %c + " " + '\0' (last two are below loop) */
++	  str_buf = aspath_expand (str_buf,
++				   &str_size,
++				   len + APPROX_DIGIT_COUNT(seg->as[i]) + 4);
++				   
+           len += snprintf (str_buf + len, str_size - len, "%u", seg->as[i]);
+           
+           if (i < (seg->length - 1))
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/quagga/quagga.spec?r1=1.54&r2=1.55&f=u



More information about the pld-cvs-commit mailing list