]> git.puffer.fish Git - mirror/frr.git/commitdiff
[bgpd] aspath_loop_check was broken, fix it and the aspath unit test code.
authorPaul Jakma <paul.jakma@sun.com>
Sun, 6 Aug 2006 15:52:11 +0000 (15:52 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Sun, 6 Aug 2006 15:52:11 +0000 (15:52 +0000)
2006-08-06 Paul Jakma <paul.jakma@sun.com>

* bgp_aspath.c: (aspath_loop_check) Fix the typo-bug which
  essentially had disabled this check. Problem reported by
  Bartek Kania <mrbk@gnarf.org> in [quagga-users 7388].
* aspath_test.c: (validate) Fix the sense of the aspath_loop_check,
  which was the wrong way around and had actually been testing for
  aspath_loop_check to be buggy.

bgpd/ChangeLog
bgpd/bgp_aspath.c
tests/ChangeLog
tests/aspath_test.c

index 90d0e0e3d999871f5d9fdfa01c9a347f22c52d17..99960aef0b1e97adb8ca70b16f1c88a5ec71baac 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-06 Paul Jakma <paul.jakma@sun.com>
+
+       * bgp_aspath.c: (aspath_loop_check) Fix the typo-bug which
+         essentially had disabled this check. Problem reported by
+         Bartek Kania <mrbk@gnarf.org> in [quagga-users 7388].
+
 2006-07-27 Paul Jakma <paul.jakma@sun.com>
 
        * bgpd.c: (peer_delete) Ensure freed buffers can not be
index d404309c24e09adbfce8d7c0e5b1e975c4c5e061..317e9f8dbab9a8a6bffa80dfbc8a909ca03de670 100644 (file)
@@ -926,14 +926,14 @@ aspath_firstas_check (struct aspath *aspath, as_t asno)
   return 0;
 }
 
-/* AS path loop check.  If aspath contains asno then return 1. */
+/* AS path loop check.  If aspath contains asno then return >= 1. */
 int
 aspath_loop_check (struct aspath *aspath, as_t asno)
 {
   struct assegment *seg;
   int count = 0;
 
-  if ( (aspath == NULL) || (aspath->segments) )
+  if ( (aspath == NULL) || (aspath->segments == NULL) )
     return 0;
   
   seg = aspath->segments;
@@ -1363,7 +1363,7 @@ aspath_str2aspath (const char *str)
 {
   enum as_token token = as_token_unknown;
   u_short as_type;
-  u_short asno = NULL;
+  u_short asno = 0;
   struct aspath *aspath;
   int needtype;
 
index 74118e63c3bfa5a48beef871c84b870fea1c808f..b066cfd881d78e1035a361a47e23bffb62c71609 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-06 Paul Jakma <paul.jakma@sun.com>
+
+       * aspath_test.c: (validate) Fix the sense of the aspath_loop_check,
+         which was the wrong way around and had actually been testing for
+         aspath_loop_check to be buggy.
+
 2006-05-28 Paul Jakma <paul.jakma@sun.com>
 
        * test-sig.c: (main) configure logging, there's no terminal
index 5d510ccac38818e52520ad6cef046cae6d46e120..1d28dbedc4b2fd95c02dc78dd3dd466dbc881d05 100644 (file)
@@ -76,7 +76,7 @@ static struct test_segment {
     10,
     { "8482 51457 {5204}",
       "8482 51457 {5204}",
-      3, 0, NOT_ALL_PRIVATE, 5204, 51457, 8482},
+      3, 0, NOT_ALL_PRIVATE, 5204, 51456, 8482},
   },
   { /* 4 */
     "seqset2",
@@ -618,8 +618,8 @@ validate (struct aspath *as, const struct test_spec *sp)
     }
   
     /* loop, private and first as checks */
-  if (aspath_loop_check (as, sp->does_loop)
-      || aspath_loop_check (as, sp->doesnt_loop)
+  if ((sp->does_loop && aspath_loop_check (as, sp->does_loop) == 0)
+      || (sp->doesnt_loop && aspath_loop_check (as, sp->doesnt_loop) != 0)
       || (aspath_private_as_check (as) != sp->private_as)
       || (aspath_firstas_check (as,sp->first)
           && sp->first == 0))