* 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.
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);
printf ("\n");
if (asp)
- aspath_unintern (asp);
+ aspath_unintern (&asp);
}
/* prepend testing */
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 ("%s!\n", FAILED);
printf ("\n");
- aspath_unintern (asp1);
+ aspath_unintern (&asp1);
aspath_free (asp2);
}
asp2 = aspath_empty ();
ascratch = aspath_dup (asp2);
- aspath_unintern (asp2);
+ aspath_unintern (&asp2);
asp2 = aspath_prepend (asp1, ascratch);
printf ("\n");
if (asp1)
- aspath_unintern (asp1);
+ aspath_unintern (&asp1);
aspath_free (asp2);
}
printf (FAILED "!\n");
printf ("\n");
- aspath_unintern (asp1);
- aspath_unintern (asp2);
+ aspath_unintern (&asp1);
+ aspath_unintern (&asp2);
aspath_free (ascratch);
}
printf (FAILED "!\n");
printf ("\n");
- aspath_unintern (asp1);
- aspath_unintern (asp2);
+ aspath_unintern (&asp1);
+ aspath_unintern (&asp2);
aspath_free (ascratch);
/* aspath_unintern (ascratch);*/
}
printf (OK "\n");
printf ("\n");
- aspath_unintern (asp1);
- aspath_unintern (asp2);
+ aspath_unintern (&asp1);
+ aspath_unintern (&asp2);
}
}
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)
out:
if (attr.aspath)
- aspath_unintern (attr.aspath);
+ aspath_unintern (&attr.aspath);
if (asp)
- aspath_unintern (asp);
+ aspath_unintern (&asp);
return failed - initfail;
}
#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"
#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;
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++)
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);
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)
{
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 [] =
str1,
(etmp && str2) ? str2 : "NULL");
}
- ecommunity_free (etmp);
+ ecommunity_free (&etmp);
XFREE (MTYPE_ECOMMUNITY_STR, str1);
XFREE (MTYPE_ECOMMUNITY_STR, str2);
printf ("failed\n");
printf ("\n");
- ecommunity_unintern (ecom);
+ ecommunity_unintern (&ecom);
}
{
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);
p = buffer;
ret.c0 = 0;
ret.c1 = 0;
- init_len = len;
while (len != 0)
{
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;
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;
}
-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 */
{