summaryrefslogtreecommitdiffstats
path: root/tests/aspath_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/aspath_test.c')
-rw-r--r--tests/aspath_test.c269
1 files changed, 136 insertions, 133 deletions
diff --git a/tests/aspath_test.c b/tests/aspath_test.c
index 4a2ce9aa..11008b25 100644
--- a/tests/aspath_test.c
+++ b/tests/aspath_test.c
@@ -22,7 +22,7 @@ struct thread_master *master = NULL;
static int failed = 0;
/* specification for a test - what the results should be */
-struct test_spec
+struct test_spec
{
const char *shouldbe; /* the string the path should parse to */
const char *shouldbe_delete_confed; /* ditto, but once confeds are deleted */
@@ -45,9 +45,9 @@ static struct test_segment {
const u_char asdata[1024];
int len;
struct test_spec sp;
-} test_segments [] =
+} test_segments [] =
{
- { /* 0 */
+ { /* 0 */
"seq1",
"seq(8466,3,52737,4096)",
{ 0x2,0x4, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00 },
@@ -69,7 +69,7 @@ static struct test_segment {
{ /* 2 */
"seq3",
"seq(8466,3,52737,4096,8722,4)",
- { 0x2,0x6, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00,
+ { 0x2,0x6, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00,
0x22,0x12, 0x00,0x04},
14,
{ "8466 3 52737 4096 8722 4",
@@ -91,7 +91,7 @@ static struct test_segment {
"seq(8467, 59649) set(4196,48658) set(17322,30745)",
{ 0x2,0x2, 0x21,0x13, 0xe9,0x01,
0x1,0x2, 0x10,0x64, 0xbe,0x12,
- 0x1,0x2, 0x43,0xaa, 0x78,0x19 },
+ 0x1,0x2, 0x43,0xaa, 0x78,0x19 },
18,
{ "8467 59649 {4196,48658} {17322,30745}",
"8467 59649 {4196,48658} {17322,30745}",
@@ -151,7 +151,7 @@ static struct test_segment {
{ /* 10 */
"seq4",
"seq(8466,2,52737,4096,8722,4)",
- { 0x2,0x6, 0x21,0x12, 0x00,0x02, 0xce,0x01, 0x10,0x00,
+ { 0x2,0x6, 0x21,0x12, 0x00,0x02, 0xce,0x01, 0x10,0x00,
0x22,0x12, 0x00,0x04},
14,
{ "8466 2 52737 4096 8722 4",
@@ -161,7 +161,7 @@ static struct test_segment {
{ /* 11 */
"tripleseq1",
"seq(8466,2,52737) seq(4096,8722,4) seq(8722)",
- { 0x2,0x3, 0x21,0x12, 0x00,0x02, 0xce,0x01,
+ { 0x2,0x3, 0x21,0x12, 0x00,0x02, 0xce,0x01,
0x2,0x3, 0x10,0x00, 0x22,0x12, 0x00,0x04,
0x2,0x1, 0x22,0x12},
20,
@@ -169,7 +169,7 @@ static struct test_segment {
"8466 2 52737 4096 8722 4 8722",
7, 0, NOT_ALL_PRIVATE, 4096, 1, 8466 },
},
- { /* 12 */
+ { /* 12 */
"someprivate",
"seq(8466,64512,52737,65535)",
{ 0x2,0x4, 0x21,0x12, 0xfc,0x00, 0xce,0x01, 0xff,0xff },
@@ -178,7 +178,7 @@ static struct test_segment {
"8466 64512 52737 65535",
4, 0, NOT_ALL_PRIVATE, 65535, 4, 8466 },
},
- { /* 13 */
+ { /* 13 */
"allprivate",
"seq(65534,64512,64513,65535)",
{ 0x2,0x4, 0xff,0xfe, 0xfc,0x00, 0xfc,0x01, 0xff,0xff },
@@ -187,7 +187,7 @@ static struct test_segment {
"65534 64512 64513 65535",
4, 0, ALL_PRIVATE, 65534, 4, 65534 },
},
- { /* 14 */
+ { /* 14 */
"long",
"seq(8466,3,52737,4096,34285,<repeated 49 more times>)",
{ 0x2,0xfa, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00, 0x85,0xed,
@@ -266,7 +266,7 @@ static struct test_segment {
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 3 52737 4096 34285 8466 3 52737 4096 34285",
-
+
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
@@ -294,7 +294,7 @@ static struct test_segment {
"8466 3 52737 4096 34285 8466 3 52737 4096 34285",
250, 0, NOT_ALL_PRIVATE, 4096, 4, 8466 },
},
- { /* 15 */
+ { /* 15 */
"seq1extra",
"seq(8466,3,52737,4096,3456)",
{ 0x2,0x5, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00, 0x0d,0x80 },
@@ -310,7 +310,7 @@ static struct test_segment {
0,
{ "", "", 0, 0, 0, 0, 0, 0 },
},
- { /* 17 */
+ { /* 17 */
"redundantset",
"seq(8466,3,52737,4096,3456) set(7099,8153,8153,8153)",
{ 0x2,0x5, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00, 0x0d,0x80,
@@ -338,7 +338,7 @@ static struct test_segment {
{ /* 19 */
"reconcile_new_asp",
"set(2457,61697,4369), seq(1842,41591,51793)",
- {
+ {
0x1,0x3, 0x09,0x99, 0xf1,0x01, 0x11,0x11,
0x2,0x3, 0x07,0x32, 0xa2,0x77, 0xca,0x51 },
16,
@@ -391,7 +391,7 @@ static struct test_segment {
"23456 23456 23456 6435 59408",
5, 0, NOT_ALL_PRIVATE, 59408, 1, 23456 },
},
- { /* 24 */
+ { /* 24 */
"redundantset2",
"seq(8466,3,52737,4096,3456) set(7099,8153,8153,8153,7099)",
{ 0x2,0x5, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00, 0x0d,0x80,
@@ -403,7 +403,7 @@ static struct test_segment {
"8466 3 52737 4096 3456 {7099,8153}",
6, 0, NOT_ALL_PRIVATE, 4096, 4, 8466 },
},
- { /* 25 */
+ { /* 25 */
"zero-size overflow",
"#ASNs = 0, data = seq(8466 3 52737 4096 3456)",
{ 0x2,0x0, 0x21,0x12, 0x00,0x03, 0xce,0x01, 0x10,0x00, 0x0d,0x80 },
@@ -411,17 +411,17 @@ static struct test_segment {
{ NULL, NULL,
0, 0, 0, 0, 0, 0 },
},
- { /* 26 */
+ { /* 26 */
"zero-size overflow + valid segment",
"seq(#AS=0:8466 3 52737),seq(4096 3456)",
- { 0x2,0x0, 0x21,0x12, 0x00,0x03, 0xce,0x01,
+ { 0x2,0x0, 0x21,0x12, 0x00,0x03, 0xce,0x01,
0x2,0x2, 0x10,0x00, 0x0d,0x80 },
14
,
{ NULL, NULL,
0, 0, 0, 0, 0, 0 },
},
- { /* 27 */
+ { /* 27 */
"invalid segment type",
"type=8(4096 3456)",
{ 0x8,0x2, 0x10,0x00, 0x0d,0x80 },
@@ -453,7 +453,7 @@ static struct aspath_tests {
AS2_DATA, 0,
0,
{ BGP_ATTR_FLAG_TRANS,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
10,
},
3,
@@ -466,7 +466,7 @@ static struct aspath_tests {
AS2_DATA, -1,
0,
{ BGP_ATTR_FLAG_TRANS,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
8,
},
3,
@@ -479,7 +479,7 @@ static struct aspath_tests {
AS2_DATA, -1,
0,
{ BGP_ATTR_FLAG_TRANS,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
12,
},
3,
@@ -492,7 +492,7 @@ static struct aspath_tests {
AS2_DATA, -1,
0,
{ BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
10,
},
3,
@@ -505,7 +505,7 @@ static struct aspath_tests {
AS2_DATA, -1,
0,
{ BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS4_PATH,
+ BGP_ATTR_AS4_PATH,
10,
},
3,
@@ -518,7 +518,7 @@ static struct aspath_tests {
AS4_DATA, -1,
PEER_CAP_AS4_RCV,
{ BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS4_PATH,
+ BGP_ATTR_AS4_PATH,
10,
},
3,
@@ -531,7 +531,7 @@ static struct aspath_tests {
AS4_DATA, 0,
PEER_CAP_AS4_RCV|PEER_CAP_AS4_ADV,
{ BGP_ATTR_FLAG_TRANS,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
18,
},
3,
@@ -544,7 +544,7 @@ static struct aspath_tests {
AS4_DATA, -1,
PEER_CAP_AS4_RCV|PEER_CAP_AS4_ADV,
{ BGP_ATTR_FLAG_TRANS,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
16,
},
3,
@@ -557,7 +557,7 @@ static struct aspath_tests {
AS4_DATA, -1,
PEER_CAP_AS4_RCV|PEER_CAP_AS4_ADV,
{ BGP_ATTR_FLAG_TRANS,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
20,
},
3,
@@ -570,7 +570,7 @@ static struct aspath_tests {
AS4_DATA, -1,
PEER_CAP_AS4_RCV|PEER_CAP_AS4_ADV,
{ BGP_ATTR_FLAG_TRANS,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
22,
},
3,
@@ -583,7 +583,7 @@ static struct aspath_tests {
AS4_DATA, -1,
PEER_CAP_AS4_RCV|PEER_CAP_AS4_ADV,
{ BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS_PATH,
+ BGP_ATTR_AS_PATH,
18,
},
3,
@@ -596,7 +596,7 @@ static struct aspath_tests {
AS4_DATA, -1,
PEER_CAP_AS4_ADV,
{ BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_OPTIONAL,
- BGP_ATTR_AS4_PATH,
+ BGP_ATTR_AS4_PATH,
14,
},
3,
@@ -609,7 +609,7 @@ static struct tests {
const struct test_segment *test1;
const struct test_segment *test2;
struct test_spec sp;
-} prepend_tests[] =
+} prepend_tests[] =
{
/* 0 */
{ &test_segments[0], &test_segments[1],
@@ -691,7 +691,7 @@ static struct tests {
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 2 52737 4096 8722 4 8722",
-
+
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
"8466 3 52737 4096 34285 8466 3 52737 4096 34285 "
@@ -757,7 +757,7 @@ struct tests reconcile_tests[] =
},
{ NULL, NULL, { NULL, 0, 0, 0, 0, 0, 0, } },
};
-
+
struct tests aggregate_tests[] =
{
{ &test_segments[0], &test_segments[2],
@@ -790,7 +790,7 @@ struct tests aggregate_tests[] =
{ NULL, NULL, { NULL, 0, 0} },
};
-struct compare_tests
+struct compare_tests
{
int test_index1;
int test_index2;
@@ -830,17 +830,17 @@ make_aspath (const u_char *data, size_t len, int use32bit)
{
struct stream *s = NULL;
struct aspath *as;
-
+
if (len)
{
s = stream_new (len);
stream_put (s, data, len);
}
- as = aspath_parse (s, len, use32bit);
-
+ as = aspath_parse (s, len, use32bit, 0);
+
if (s)
stream_free (s);
-
+
return as;
}
@@ -857,7 +857,7 @@ printbytes (const u_char *bytes, int len)
i++;
}
printf ("\n");
-}
+}
/* validate the given aspath */
static int
@@ -868,33 +868,33 @@ validate (struct aspath *as, const struct test_spec *sp)
const u_char *out;
static struct stream *s;
struct aspath *asinout, *asconfeddel, *asstr, *as4;
-
+
if (as == NULL && sp->shouldbe == NULL)
{
printf ("Correctly failed to parse\n");
return fails;
}
-
+
out = aspath_snmp_pathseg (as, &bytes);
asinout = make_aspath (out, bytes, 0);
-
+
/* Excercise AS4 parsing a bit, with a dogfood test */
if (!s)
s = stream_new (4096);
bytes4 = aspath_put (s, as, 1);
as4 = make_aspath (STREAM_DATA(s), bytes4, 1);
-
+
asstr = aspath_str2aspath (sp->shouldbe);
-
+
asconfeddel = aspath_delete_confed_seq (aspath_dup (asinout));
-
+
printf ("got: %s\n", aspath_print(as));
-
+
/* the parsed path should match the specified 'shouldbe' string.
* We should pass the "eat our own dog food" test, be able to output
* this path and then input it again. Ie the path resulting from:
*
- * aspath_parse(aspath_put(as))
+ * aspath_parse(aspath_put(as))
*
* should:
*
@@ -909,7 +909,7 @@ validate (struct aspath *as, const struct test_spec *sp)
*
* aspath_parse(aspath_put(as,USE32BIT))
*
- * Confederation related tests:
+ * Confederation related tests:
* - aspath_delete_confed_seq(aspath) should match shouldbe_confed
* - aspath_delete_confed_seq should be idempotent.
*/
@@ -930,9 +930,9 @@ validate (struct aspath *as, const struct test_spec *sp)
fails++;
printf ("shouldbe:\n%s\n", sp->shouldbe);
printf ("as4:\n%s\n", aspath_print (as4));
- printf ("hash keys: in: %d out->in: %d\n",
+ printf ("hash keys: in: %d out->in: %d\n",
aspath_key_make (as), aspath_key_make (asinout));
- printf ("hops: %d, counted %d %d\n", sp->hops,
+ printf ("hops: %d, counted %d %d\n", sp->hops,
aspath_count_hops (as),
aspath_count_hops (asinout) );
printf ("confeds: %d, counted %d %d\n", sp->confeds,
@@ -942,13 +942,13 @@ validate (struct aspath *as, const struct test_spec *sp)
printbytes (out, bytes);
}
/* basic confed related tests */
- if ((aspath_print (asconfeddel) == NULL
+ if ((aspath_print (asconfeddel) == NULL
&& sp->shouldbe_delete_confed != NULL)
- || (aspath_print (asconfeddel) != NULL
+ || (aspath_print (asconfeddel) != NULL
&& sp->shouldbe_delete_confed == NULL)
|| strcmp(aspath_print (asconfeddel), sp->shouldbe_delete_confed)
/* delete_confed_seq should be idempotent */
- || (aspath_key_make (asconfeddel)
+ || (aspath_key_make (asconfeddel)
!= aspath_key_make (aspath_delete_confed_seq (asconfeddel))))
{
failed++;
@@ -965,7 +965,7 @@ validate (struct aspath *as, const struct test_spec *sp)
fails++;
printf ("asstr: %s\n", aspath_print (asstr));
}
-
+
/* loop, private and first as checks */
if ((sp->does_loop && aspath_loop_check (as, sp->does_loop) == 0)
|| (sp->doesnt_loop && aspath_loop_check (as, sp->doesnt_loop) != 0)
@@ -983,13 +983,13 @@ validate (struct aspath *as, const struct test_spec *sp)
printf ("private check: %d %d\n", sp->private_as,
aspath_private_as_check (as));
}
- aspath_unintern (asinout);
- aspath_unintern (as4);
-
+ aspath_unintern (&asinout);
+ aspath_unintern (&as4);
+
aspath_free (asconfeddel);
aspath_free (asstr);
stream_reset (s);
-
+
return fails;
}
@@ -1004,9 +1004,9 @@ empty_get_test ()
printf ("%s\n", OK);
else
printf ("%s!\n", FAILED);
-
+
printf ("\n");
-
+
aspath_free (as);
}
@@ -1015,22 +1015,22 @@ static void
parse_test (struct test_segment *t)
{
struct aspath *asp;
-
+
printf ("%s: %s\n", t->name, t->desc);
asp = make_aspath (t->asdata, t->len, 0);
-
+
printf ("aspath: %s\nvalidating...:\n", aspath_print (asp));
if (!validate (asp, &t->sp))
printf (OK "\n");
else
printf (FAILED "\n");
-
+
printf ("\n");
-
+
if (asp)
- aspath_unintern (asp);
+ aspath_unintern (&asp);
}
/* prepend testing */
@@ -1038,27 +1038,27 @@ static void
prepend_test (struct tests *t)
{
struct aspath *asp1, *asp2, *ascratch;
-
+
printf ("prepend %s: %s\n", t->test1->name, t->test1->desc);
printf ("to %s: %s\n", t->test2->name, t->test2->desc);
-
+
asp1 = make_aspath (t->test1->asdata, t->test1->len, 0);
asp2 = make_aspath (t->test2->asdata, t->test2->len, 0);
-
+
ascratch = aspath_dup (asp2);
- aspath_unintern (asp2);
-
+ aspath_unintern (&asp2);
+
asp2 = aspath_prepend (asp1, ascratch);
-
+
printf ("aspath: %s\n", aspath_print (asp2));
-
+
if (!validate (asp2, &t->sp))
printf ("%s\n", OK);
else
printf ("%s!\n", FAILED);
-
+
printf ("\n");
- aspath_unintern (asp1);
+ aspath_unintern (&asp1);
aspath_free (asp2);
}
@@ -1067,27 +1067,27 @@ static void
empty_prepend_test (struct test_segment *t)
{
struct aspath *asp1, *asp2, *ascratch;
-
+
printf ("empty prepend %s: %s\n", t->name, t->desc);
-
+
asp1 = make_aspath (t->asdata, t->len, 0);
asp2 = aspath_empty ();
-
+
ascratch = aspath_dup (asp2);
- aspath_unintern (asp2);
-
+ aspath_unintern (&asp2);
+
asp2 = aspath_prepend (asp1, ascratch);
-
+
printf ("aspath: %s\n", aspath_print (asp2));
-
+
if (!validate (asp2, &t->sp))
printf (OK "\n");
else
printf (FAILED "!\n");
-
+
printf ("\n");
if (asp1)
- aspath_unintern (asp1);
+ aspath_unintern (&asp1);
aspath_free (asp2);
}
@@ -1096,23 +1096,23 @@ static void
as4_reconcile_test (struct tests *t)
{
struct aspath *asp1, *asp2, *ascratch;
-
+
printf ("reconciling %s:\n %s\n", t->test1->name, t->test1->desc);
printf ("with %s:\n %s\n", t->test2->name, t->test2->desc);
-
+
asp1 = make_aspath (t->test1->asdata, t->test1->len, 0);
asp2 = make_aspath (t->test2->asdata, t->test2->len, 0);
-
+
ascratch = aspath_reconcile_as4 (asp1, asp2);
-
+
if (!validate (ascratch, &t->sp))
printf (OK "\n");
else
printf (FAILED "!\n");
-
+
printf ("\n");
- aspath_unintern (asp1);
- aspath_unintern (asp2);
+ aspath_unintern (&asp1);
+ aspath_unintern (&asp2);
aspath_free (ascratch);
}
@@ -1122,23 +1122,23 @@ static void
aggregate_test (struct tests *t)
{
struct aspath *asp1, *asp2, *ascratch;
-
+
printf ("aggregate %s: %s\n", t->test1->name, t->test1->desc);
printf ("with %s: %s\n", t->test2->name, t->test2->desc);
-
+
asp1 = make_aspath (t->test1->asdata, t->test1->len, 0);
asp2 = make_aspath (t->test2->asdata, t->test2->len, 0);
-
+
ascratch = aspath_aggregate (asp1, asp2);
-
+
if (!validate (ascratch, &t->sp))
printf (OK "\n");
else
printf (FAILED "!\n");
-
+
printf ("\n");
- aspath_unintern (asp1);
- aspath_unintern (asp2);
+ aspath_unintern (&asp1);
+ aspath_unintern (&asp2);
aspath_free (ascratch);
/* aspath_unintern (ascratch);*/
}
@@ -1156,23 +1156,23 @@ cmp_test ()
struct test_segment *t1 = &test_segments[left_compare[i].test_index1];
struct test_segment *t2 = &test_segments[left_compare[i].test_index2];
struct aspath *asp1, *asp2;
-
+
printf ("left cmp %s: %s\n", t1->name, t1->desc);
printf ("and %s: %s\n", t2->name, t2->desc);
-
+
asp1 = make_aspath (t1->asdata, t1->len, 0);
asp2 = make_aspath (t2->asdata, t2->len, 0);
-
+
if (aspath_cmp_left (asp1, asp2) != left_compare[i].shouldbe_cmp
|| aspath_cmp_left (asp2, asp1) != left_compare[i].shouldbe_cmp
- || aspath_cmp_left_confed (asp1, asp2)
+ || aspath_cmp_left_confed (asp1, asp2)
!= left_compare[i].shouldbe_confed
- || aspath_cmp_left_confed (asp2, asp1)
+ || aspath_cmp_left_confed (asp2, asp1)
!= left_compare[i].shouldbe_confed)
{
failed++;
printf (FAILED "\n");
- printf ("result should be: cmp: %d, confed: %d\n",
+ printf ("result should be: cmp: %d, confed: %d\n",
left_compare[i].shouldbe_cmp,
left_compare[i].shouldbe_confed);
printf ("got: cmp %d, cmp_confed: %d\n",
@@ -1183,47 +1183,50 @@ cmp_test ()
}
else
printf (OK "\n");
-
+
printf ("\n");
- aspath_unintern (asp1);
- aspath_unintern (asp2);
+ aspath_unintern (&asp1);
+ aspath_unintern (&asp2);
}
}
static int
handle_attr_test (struct aspath_tests *t)
{
- struct bgp bgp = { 0 };
+ struct bgp bgp = { 0 };
struct peer peer = { 0 };
- struct attr attr = { 0 };
+ struct attr attr = { 0 };
int ret;
int initfail = failed;
struct aspath *asp;
size_t datalen;
-
+ char host[] = { "none" } ;
+
asp = make_aspath (t->segment->asdata, t->segment->len, 0);
-
+
peer.ibuf = stream_new (BGP_MAX_PACKET_SIZE);
peer.obuf = stream_fifo_new ();
peer.bgp = &bgp;
- peer.host = (char *)"none";
+ peer.host = host ;
+#if 0
peer.fd = -1;
+#endif
peer.cap = t->cap;
-
+
stream_write (peer.ibuf, t->attrheader, t->len);
datalen = aspath_put (peer.ibuf, asp, t->as4 == AS4_DATA);
-
+
ret = bgp_attr_parse (&peer, &attr, t->len + datalen, NULL, NULL);
-
+
if (ret != t->result)
{
printf ("bgp_attr_parse returned %d, expected %d\n", ret, t->result);
- printf ("datalen %d\n", datalen);
+ printf ("datalen %d\n", (int)datalen);
failed++;
}
if (ret != 0)
goto out;
-
+
if (attr.aspath == NULL)
{
printf ("aspath is NULL!\n");
@@ -1240,9 +1243,9 @@ handle_attr_test (struct aspath_tests *t)
out:
if (attr.aspath)
- aspath_unintern (attr.aspath);
+ aspath_unintern (&attr.aspath);
if (asp)
- aspath_unintern (asp);
+ aspath_unintern (&asp);
return failed - initfail;
}
@@ -1250,7 +1253,7 @@ static void
attr_test (struct aspath_tests *t)
{
printf ("%s\n", t->desc);
- printf ("%s\n\n", handle_attr_test (t) ? FAILED : OK);
+ printf ("%s\n\n", handle_attr_test (t) ? FAILED : OK);
}
int
@@ -1260,54 +1263,54 @@ main (void)
bgp_master_init ();
master = bm->master;
bgp_attr_init ();
-
+
while (test_segments[i].name)
{
printf ("test %u\n", i);
parse_test (&test_segments[i]);
empty_prepend_test (&test_segments[i++]);
}
-
+
i = 0;
while (prepend_tests[i].test1)
{
printf ("prepend test %u\n", i);
prepend_test (&prepend_tests[i++]);
}
-
+
i = 0;
while (aggregate_tests[i].test1)
{
printf ("aggregate test %u\n", i);
aggregate_test (&aggregate_tests[i++]);
}
-
+
i = 0;
-
+
while (reconcile_tests[i].test1)
{
printf ("reconcile test %u\n", i);
as4_reconcile_test (&reconcile_tests[i++]);
}
-
+
i = 0;
-
+
cmp_test();
-
+
i = 0;
-
+
empty_get_test();
-
+
i = 0;
-
+
while (aspath_tests[i].desc)
{
printf ("aspath_attr test %d\n", i);
attr_test (&aspath_tests[i++]);
}
-
+
printf ("failures: %d\n", failed);
printf ("aspath count: %ld\n", aspath_count());
-
+
return (failed + aspath_count());
}