mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-01-03 02:23:54 +00:00
tests: Fix some compile errors and warnings
* aspath_test.c: match changes in aspath_unintern. Fix printf size_t warning. * bgp_capability_test.c: compile warnings. * bgp_mp_attr_test.c: update for attr parser context struct * ecommunity_test.c: ecommunity_free/ecommunity * test-checksum.c: some unused vars and funcs without need of prototypes.
This commit is contained in:
parent
6ebeebb506
commit
1dba254e10
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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++)
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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 */
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user