diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/aspath_test.c | 32 | ||||
-rw-r--r-- | tests/bgp_capability_test.c | 5 | ||||
-rw-r--r-- | tests/bgp_mp_attr_test.c | 16 | ||||
-rw-r--r-- | tests/ecommunity_test.c | 6 | ||||
-rw-r--r-- | tests/test-checksum.c | 9 |
5 files changed, 38 insertions, 30 deletions
diff --git a/tests/aspath_test.c b/tests/aspath_test.c index 4a2ce9aa..83eb9d80 100644 --- a/tests/aspath_test.c +++ b/tests/aspath_test.c @@ -983,8 +983,8 @@ 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); @@ -1030,7 +1030,7 @@ parse_test (struct test_segment *t) printf ("\n"); if (asp) - aspath_unintern (asp); + aspath_unintern (&asp); } /* prepend testing */ @@ -1046,7 +1046,7 @@ prepend_test (struct tests *t) 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); @@ -1058,7 +1058,7 @@ prepend_test (struct tests *t) printf ("%s!\n", FAILED); printf ("\n"); - aspath_unintern (asp1); + aspath_unintern (&asp1); aspath_free (asp2); } @@ -1074,7 +1074,7 @@ empty_prepend_test (struct test_segment *t) asp2 = aspath_empty (); ascratch = aspath_dup (asp2); - aspath_unintern (asp2); + aspath_unintern (&asp2); asp2 = aspath_prepend (asp1, ascratch); @@ -1087,7 +1087,7 @@ empty_prepend_test (struct test_segment *t) printf ("\n"); if (asp1) - aspath_unintern (asp1); + aspath_unintern (&asp1); aspath_free (asp2); } @@ -1111,8 +1111,8 @@ as4_reconcile_test (struct tests *t) printf (FAILED "!\n"); printf ("\n"); - aspath_unintern (asp1); - aspath_unintern (asp2); + aspath_unintern (&asp1); + aspath_unintern (&asp2); aspath_free (ascratch); } @@ -1137,8 +1137,8 @@ aggregate_test (struct tests *t) printf (FAILED "!\n"); printf ("\n"); - aspath_unintern (asp1); - aspath_unintern (asp2); + aspath_unintern (&asp1); + aspath_unintern (&asp2); aspath_free (ascratch); /* aspath_unintern (ascratch);*/ } @@ -1185,8 +1185,8 @@ cmp_test () printf (OK "\n"); printf ("\n"); - aspath_unintern (asp1); - aspath_unintern (asp2); + aspath_unintern (&asp1); + aspath_unintern (&asp2); } } @@ -1218,7 +1218,7 @@ handle_attr_test (struct aspath_tests *t) if (ret != t->result) { printf ("bgp_attr_parse returned %d, expected %d\n", ret, t->result); - printf ("datalen %d\n", datalen); + printf ("datalen %zd\n", datalen); failed++; } if (ret != 0) @@ -1240,9 +1240,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; } diff --git a/tests/bgp_capability_test.c b/tests/bgp_capability_test.c index 9b43159c..83da2e48 100644 --- a/tests/bgp_capability_test.c +++ b/tests/bgp_capability_test.c @@ -8,6 +8,7 @@ #include "bgpd/bgpd.h" #include "bgpd/bgp_open.h" #include "bgpd/bgp_debug.h" +#include "bgpd/bgp_packet.h" #define VT100_RESET "\x1b[0m" #define VT100_RED "\x1b[31m" @@ -35,7 +36,7 @@ static struct test_segment { #define SHOULD_PARSE 0 #define SHOULD_ERR -1 int parses; /* whether it should parse or not */ - int peek_for; /* what peek_for_as4_capability should say */ + as_t peek_for; /* what peek_for_as4_capability should say */ /* AFI/SAFI validation */ int validate_afi; @@ -625,7 +626,7 @@ main (void) return -1; peer = peer_create_accept (bgp); - peer->host = "foo"; + peer->host = (char *) "foo"; for (i = AFI_IP; i < AFI_MAX; i++) for (j = SAFI_UNICAST; j < SAFI_MAX; j++) diff --git a/tests/bgp_mp_attr_test.c b/tests/bgp_mp_attr_test.c index 9cbe9f22..1a48f4b7 100644 --- a/tests/bgp_mp_attr_test.c +++ b/tests/bgp_mp_attr_test.c @@ -438,6 +438,15 @@ parse_test (struct peer *peer, struct test_segment *t, int type) int oldfailed = failed; struct attr attr; struct bgp_nlri nlri; + struct bgp_attr_parser_args attr_args = { + .peer = peer, + .length = t->len, + .total = 1, + .attr = &attr, + .type = BGP_ATTR_MP_REACH_NLRI, + .flags = BGP_ATTR_FLAG_OPTIONAL, + .startp = BGP_INPUT_PNT (peer), + }; #define RANDOM_FUZZ 35 stream_reset (peer->ibuf); @@ -447,11 +456,12 @@ parse_test (struct peer *peer, struct test_segment *t, int type) stream_write (peer->ibuf, t->data, t->len); printf ("%s: %s\n", t->name, t->desc); - + + if (type == BGP_ATTR_MP_REACH_NLRI) - ret = bgp_mp_reach_parse (peer, t->len, &attr, BGP_ATTR_FLAG_OPTIONAL, BGP_INPUT_PNT (peer), &nlri); + ret = bgp_mp_reach_parse (&attr_args, &nlri); else - ret = bgp_mp_unreach_parse (peer, t->len, BGP_ATTR_FLAG_OPTIONAL, BGP_INPUT_PNT (peer), &nlri); + ret = bgp_mp_unreach_parse (&attr_args, &nlri); if (!ret) { diff --git a/tests/ecommunity_test.c b/tests/ecommunity_test.c index 418f659f..87f20f28 100644 --- a/tests/ecommunity_test.c +++ b/tests/ecommunity_test.c @@ -25,7 +25,7 @@ struct test_spec static struct test_segment { const char *name; const char *desc; - const u_char data[1024]; + const u_int8_t data[1024]; int len; struct test_spec sp; } test_segments [] = @@ -97,7 +97,7 @@ validate (struct ecommunity *ecom, const struct test_spec *sp) str1, (etmp && str2) ? str2 : "NULL"); } - ecommunity_free (etmp); + ecommunity_free (&etmp); XFREE (MTYPE_ECOMMUNITY_STR, str1); XFREE (MTYPE_ECOMMUNITY_STR, str2); @@ -122,7 +122,7 @@ parse_test (struct test_segment *t) printf ("failed\n"); printf ("\n"); - ecommunity_unintern (ecom); + ecommunity_unintern (&ecom); } diff --git a/tests/test-checksum.c b/tests/test-checksum.c index bd156baa..fc4eb02d 100644 --- a/tests/test-checksum.c +++ b/tests/test-checksum.c @@ -32,7 +32,7 @@ accumulate (u_char *buffer, testsz_t len, testoff_t off) { u_int8_t *p; u_int16_t *csum; - int i, init_len, partial_len; + int i, partial_len; struct acc_vals ret; csum = (u_int16_t *) (buffer + off); @@ -41,7 +41,6 @@ accumulate (u_char *buffer, testsz_t len, testoff_t off) p = buffer; ret.c0 = 0; ret.c1 = 0; - init_len = len; while (len != 0) { @@ -397,11 +396,9 @@ verify (u_char * buffer, testsz_t len) u_int8_t *p; u_int32_t c0; u_int32_t c1; - u_int16_t checksum; int i, partial_len; p = buffer; - checksum = 0; c0 = 0; c1 = 0; @@ -427,7 +424,7 @@ verify (u_char * buffer, testsz_t len) return 1; } -int /* return checksum in low-order 16 bits */ +static int /* return checksum in low-order 16 bits */ in_cksum_optimized(void *parg, int nbytes) { u_short *ptr = parg; @@ -459,7 +456,7 @@ in_cksum_optimized(void *parg, int nbytes) } -int /* return checksum in low-order 16 bits */ +static int /* return checksum in low-order 16 bits */ in_cksum_rfc(void *parg, int count) /* from RFC 1071 */ { |