diff options
author | whitespace / reindent <invalid@invalid.invalid> | 2017-07-17 21:26:02 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-07-17 21:26:02 +0200 |
commit | c14777c6bfd0a446c85243d3a9835054a259c276 (patch) | |
tree | 2021f7d89a6046f81ff1f44d256ecff28282568f /tests | |
parent | Merge pull request #826 from qlyoung/rm-vtyoutln (diff) | |
download | frr-c14777c6bfd0a446c85243d3a9835054a259c276.tar.xz frr-c14777c6bfd0a446c85243d3a9835054a259c276.zip |
*: reindent pt. 2
w/ clang 5
* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bgpd/test_aspath.c | 136 | ||||
-rw-r--r-- | tests/bgpd/test_capability.c | 762 | ||||
-rw-r--r-- | tests/bgpd/test_mp_attr.c | 158 | ||||
-rw-r--r-- | tests/bgpd/test_mpath.c | 3 | ||||
-rw-r--r-- | tests/lib/cli/test_commands.c | 12 | ||||
-rw-r--r-- | tests/lib/test_checksum.c | 4 | ||||
-rw-r--r-- | tests/lib/test_privs.c | 5 | ||||
-rw-r--r-- | tests/lib/test_timer_correctness.c | 4 |
8 files changed, 570 insertions, 514 deletions
diff --git a/tests/bgpd/test_aspath.c b/tests/bgpd/test_aspath.c index 46462d79c..706825681 100644 --- a/tests/bgpd/test_aspath.c +++ b/tests/bgpd/test_aspath.c @@ -50,8 +50,10 @@ struct test_spec { deleted */ const unsigned int hops; /* aspath_count_hops result */ const unsigned int confeds; /* aspath_count_confeds */ - const int private_as; /* whether the private_as check should pass or - fail */ + const int private_as; /* whether the private_as check should pass or + fail */ + /* $FRR indent$ */ + /* clang-format off */ #define NOT_ALL_PRIVATE 0 #define ALL_PRIVATE 1 const as_t does_loop; /* an ASN which should trigger loop-check */ @@ -85,7 +87,14 @@ static struct test_segment { {0x2, 0x1, 0x22, 0x12, 0x2, 0x1, 0x00, 0x04}, 8, { - "8722 4", "8722 4", 2, 0, NOT_ALL_PRIVATE, 4, 5, 8722, + "8722 4", + "8722 4", + 2, + 0, + NOT_ALL_PRIVATE, + 4, + 5, + 8722, }, }, { @@ -398,8 +407,22 @@ static struct test_segment { "reconcile_start_trans", "seq(23456,23456,23456) seq(6435,59408,21665)", { - 0x2, 0x3, 0x5b, 0xa0, 0x5b, 0xa0, 0x5b, 0xa0, 0x2, 0x3, - 0x19, 0x23, 0xe8, 0x10, 0x54, 0xa1, + 0x2, + 0x3, + 0x5b, + 0xa0, + 0x5b, + 0xa0, + 0x5b, + 0xa0, + 0x2, + 0x3, + 0x19, + 0x23, + 0xe8, + 0x10, + 0x54, + 0xa1, }, 16, {"23456 23456 23456 6435 59408 21665", @@ -411,8 +434,22 @@ static struct test_segment { "reconcile_start_trans4", "seq(1842,41591,51793) seq(6435,59408,21665)", { - 0x2, 0x3, 0x07, 0x32, 0xa2, 0x77, 0xca, 0x51, 0x2, 0x3, - 0x19, 0x23, 0xe8, 0x10, 0x54, 0xa1, + 0x2, + 0x3, + 0x07, + 0x32, + 0xa2, + 0x77, + 0xca, + 0x51, + 0x2, + 0x3, + 0x19, + 0x23, + 0xe8, + 0x10, + 0x54, + 0xa1, }, 16, {"1842 41591 51793 6435 59408 21665", @@ -424,8 +461,20 @@ static struct test_segment { "reconcile_start_trans_error", "seq(23456,23456,23456) seq(6435,59408)", { - 0x2, 0x3, 0x5b, 0xa0, 0x5b, 0xa0, 0x5b, 0xa0, 0x2, 0x2, - 0x19, 0x23, 0xe8, 0x10, + 0x2, + 0x3, + 0x5b, + 0xa0, + 0x5b, + 0xa0, + 0x5b, + 0xa0, + 0x2, + 0x2, + 0x19, + 0x23, + 0xe8, + 0x10, }, 14, {"23456 23456 23456 6435 59408", "23456 23456 23456 6435 59408", @@ -503,7 +552,10 @@ static struct aspath_tests { 0, 0, { - COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 10, + COMMON_ATTRS, + BGP_ATTR_FLAG_TRANS, + BGP_ATTR_AS_PATH, + 10, }, COMMON_ATTR_SIZE + 3, }, @@ -516,7 +568,10 @@ static struct aspath_tests { -1, 0, { - COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 8, + COMMON_ATTRS, + BGP_ATTR_FLAG_TRANS, + BGP_ATTR_AS_PATH, + 8, }, COMMON_ATTR_SIZE + 3, }, @@ -529,7 +584,10 @@ static struct aspath_tests { -1, 0, { - COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 12, + COMMON_ATTRS, + BGP_ATTR_FLAG_TRANS, + BGP_ATTR_AS_PATH, + 12, }, COMMON_ATTR_SIZE + 3, }, @@ -544,7 +602,8 @@ static struct aspath_tests { { COMMON_ATTRS, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - BGP_ATTR_AS_PATH, 10, + BGP_ATTR_AS_PATH, + 10, }, COMMON_ATTR_SIZE + 3, }, @@ -559,7 +618,8 @@ static struct aspath_tests { { COMMON_ATTRS, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - BGP_ATTR_AS4_PATH, 10, + BGP_ATTR_AS4_PATH, + 10, }, COMMON_ATTR_SIZE + 3, }, @@ -574,7 +634,8 @@ static struct aspath_tests { { COMMON_ATTRS, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - BGP_ATTR_AS4_PATH, 10, + BGP_ATTR_AS4_PATH, + 10, }, COMMON_ATTR_SIZE + 3, }, @@ -587,7 +648,10 @@ static struct aspath_tests { 0, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, { - COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 18, + COMMON_ATTRS, + BGP_ATTR_FLAG_TRANS, + BGP_ATTR_AS_PATH, + 18, }, COMMON_ATTR_SIZE + 3, }, @@ -600,7 +664,10 @@ static struct aspath_tests { -1, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, { - COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 16, + COMMON_ATTRS, + BGP_ATTR_FLAG_TRANS, + BGP_ATTR_AS_PATH, + 16, }, COMMON_ATTR_SIZE + 3, }, @@ -613,7 +680,10 @@ static struct aspath_tests { -1, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, { - COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 20, + COMMON_ATTRS, + BGP_ATTR_FLAG_TRANS, + BGP_ATTR_AS_PATH, + 20, }, COMMON_ATTR_SIZE + 3, }, @@ -626,7 +696,10 @@ static struct aspath_tests { -1, PEER_CAP_AS4_RCV | PEER_CAP_AS4_ADV, { - COMMON_ATTRS, BGP_ATTR_FLAG_TRANS, BGP_ATTR_AS_PATH, 22, + COMMON_ATTRS, + BGP_ATTR_FLAG_TRANS, + BGP_ATTR_AS_PATH, + 22, }, COMMON_ATTR_SIZE + 3, }, @@ -641,7 +714,8 @@ static struct aspath_tests { { COMMON_ATTRS, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - BGP_ATTR_AS_PATH, 18, + BGP_ATTR_AS_PATH, + 18, }, COMMON_ATTR_SIZE + 3, }, @@ -656,7 +730,8 @@ static struct aspath_tests { { COMMON_ATTRS, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - BGP_ATTR_AS4_PATH, 14, + BGP_ATTR_AS4_PATH, + 14, }, COMMON_ATTR_SIZE + 3, }, @@ -671,7 +746,8 @@ static struct aspath_tests { { COMMON_ATTRS, BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL, - BGP_ATTR_AS4_PATH, 14, + BGP_ATTR_AS4_PATH, + 14, }, COMMON_ATTR_SIZE + 3, &test_segments[0], @@ -804,7 +880,13 @@ static struct tests { {NULL, NULL, { - NULL, 0, 0, 0, 0, 0, 0, + NULL, + 0, + 0, + 0, + 0, + 0, + 0, }}, }; @@ -852,7 +934,13 @@ struct tests reconcile_tests[] = { {NULL, NULL, { - NULL, 0, 0, 0, 0, 0, 0, + NULL, + 0, + 0, + 0, + 0, + 0, + 0, }}, }; diff --git a/tests/bgpd/test_capability.c b/tests/bgpd/test_capability.c index 9ec2b5df1..2b515b0f7 100644 --- a/tests/bgpd/test_capability.c +++ b/tests/bgpd/test_capability.c @@ -216,439 +216,387 @@ static struct test_segment mp_segments[] = { }, {NULL, NULL, {0}, 0, 0}}; -static struct test_segment misc_segments[] = +static struct test_segment misc_segments[] = { + /* 13 */ { - /* 13 */ - { - "ORF", - "ORF, simple, single entry, single tuple", - {/* hdr */ CAPABILITY_CODE_ORF, 0x7, - /* mpc */ 0x0, 0x1, 0x0, 0x1, - /* num */ 0x1, - /* tuples */ 0x40, 0x3}, - 9, - SHOULD_PARSE, - }, - /* 14 */ - { - "ORF-many", - "ORF, multi entry/tuple", - { - /* hdr */ CAPABILITY_CODE_ORF, - 0x21, - /* mpc */ 0x0, - 0x1, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - ORF_MODE_BOTH, - 0x80, - ORF_MODE_RECEIVE, - 0x80, - ORF_MODE_SEND, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - ORF_MODE_BOTH, - 0x80, - ORF_MODE_RECEIVE, - 0x80, - ORF_MODE_SEND, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x2, - /* num */ 0x3, - /* tuples */ 0x40, - ORF_MODE_RECEIVE, - 0x80, - ORF_MODE_SEND, - 0x80, - ORF_MODE_BOTH, - }, - 35, - SHOULD_PARSE, - }, - /* 15 */ - { - "ORFlo", - "ORF, multi entry/tuple, hdr length too short", - { - /* hdr */ CAPABILITY_CODE_ORF, - 0x15, - /* mpc */ 0x0, - 0x1, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x1, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x2, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - }, - 35, - SHOULD_ERR, /* It should error on invalid - Route-Refresh.. */ - }, - /* 16 */ - {"ORFlu", - "ORF, multi entry/tuple, length too long", - { - /* hdr */ 0x3, - 0x22, - /* mpc */ 0x0, - 0x1, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x2, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - }, - 35, - SHOULD_ERR}, - /* 17 */ - { - "ORFnu", - "ORF, multi entry/tuple, entry number too long", - { - /* hdr */ 0x3, - 0x21, - /* mpc */ 0x0, - 0x1, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x1, - /* num */ 0x4, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x2, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - }, - 35, - SHOULD_PARSE, /* parses, but last few tuples should be - gibberish */ - }, - /* 18 */ - { - "ORFno", - "ORF, multi entry/tuple, entry number too short", - { - /* hdr */ 0x3, - 0x21, - /* mpc */ 0x0, - 0x1, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x1, - /* num */ 0x1, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x2, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - }, - 35, - SHOULD_PARSE, /* Parses, but should get gibberish - afi/safis */ - }, - /* 17 */ + "ORF", + "ORF, simple, single entry, single tuple", + {/* hdr */ CAPABILITY_CODE_ORF, 0x7, + /* mpc */ 0x0, 0x1, 0x0, 0x1, + /* num */ 0x1, + /* tuples */ 0x40, 0x3}, + 9, + SHOULD_PARSE, + }, + /* 14 */ + { + "ORF-many", + "ORF, multi entry/tuple", { - "ORFpad", - "ORF, multi entry/tuple, padded to align", - { - /* hdr */ 0x3, - 0x22, - /* mpc */ 0x0, - 0x1, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x1, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - /* mpc */ 0x0, - 0x2, - 0x0, - 0x2, - /* num */ 0x3, - /* tuples */ 0x40, - 0x3, - 0x80, - 0x1, - 0x80, - 0x2, - 0x00, - }, - 36, - SHOULD_PARSE, + /* hdr */ CAPABILITY_CODE_ORF, + 0x21, + /* mpc */ 0x0, + 0x1, + 0x0, + 0x1, + /* num */ 0x3, + /* tuples */ 0x40, + ORF_MODE_BOTH, + 0x80, + ORF_MODE_RECEIVE, + 0x80, + ORF_MODE_SEND, + /* mpc */ 0x0, + 0x2, + 0x0, + 0x1, + /* num */ 0x3, + /* tuples */ 0x40, + ORF_MODE_BOTH, + 0x80, + ORF_MODE_RECEIVE, + 0x80, + ORF_MODE_SEND, + /* mpc */ 0x0, + 0x2, + 0x0, + 0x2, + /* num */ 0x3, + /* tuples */ 0x40, + ORF_MODE_RECEIVE, + 0x80, + ORF_MODE_SEND, + 0x80, + ORF_MODE_BOTH, }, - /* 19 */ + 35, + SHOULD_PARSE, + }, + /* 15 */ + { + "ORFlo", + "ORF, multi entry/tuple, hdr length too short", { - "AS4", - "AS4 capability", - {0x41, 0x4, 0xab, 0xcd, 0xef, - 0x12}, /* AS: 2882400018 */ - 6, - SHOULD_PARSE, - 2882400018, + /* hdr */ CAPABILITY_CODE_ORF, + 0x15, + /* mpc */ 0x0, + 0x1, + 0x0, + 0x1, + /* num */ 0x3, + /* tuples */ 0x40, + 0x3, + 0x80, + 0x1, + 0x80, + 0x2, + /* mpc */ 0x0, + 0x1, + 0x0, + 0x1, + /* num */ 0x3, + /* tuples */ 0x40, + 0x3, + 0x80, + 0x1, + 0x80, + 0x2, + /* mpc */ 0x0, + 0x2, + 0x0, + 0x2, + /* num */ 0x3, + /* tuples */ 0x40, + 0x3, + 0x80, + 0x1, + 0x80, + 0x2, }, + 35, + SHOULD_ERR, /* It should error on invalid + Route-Refresh.. */ + }, + /* 16 */ + {"ORFlu", + "ORF, multi entry/tuple, length too long", + { + /* hdr */ 0x3, 0x22, + /* mpc */ 0x0, 0x1, 0x0, 0x1, + /* num */ 0x3, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, + /* mpc */ 0x0, 0x2, 0x0, 0x1, + /* num */ 0x3, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, + /* mpc */ 0x0, 0x2, 0x0, 0x2, + /* num */ 0x3, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, + }, + 35, + SHOULD_ERR}, + /* 17 */ + { + "ORFnu", + "ORF, multi entry/tuple, entry number too long", { - "AS4", - "AS4 capability: short", - {0x41, 0x4, 0xab, 0xcd, 0xef}, /* AS: 2882400018 */ - 5, - SHOULD_ERR, + /* hdr */ 0x3, 0x21, + /* mpc */ 0x0, 0x1, 0x0, 0x1, + /* num */ 0x3, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, + /* mpc */ 0x0, 0x2, 0x0, 0x1, + /* num */ 0x4, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, + /* mpc */ 0x0, 0x2, 0x0, 0x2, + /* num */ 0x3, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, }, + 35, + SHOULD_PARSE, /* parses, but last few tuples should be + gibberish */ + }, + /* 18 */ + { + "ORFno", + "ORF, multi entry/tuple, entry number too short", { - "AS4", - "AS4 capability: long", - {0x41, 0x4, 0xab, 0xcd, 0xef, 0x12, 0x12}, - 7, - SHOULD_ERR, - 2882400018, + /* hdr */ 0x3, 0x21, + /* mpc */ 0x0, 0x1, 0x0, 0x1, + /* num */ 0x3, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, + /* mpc */ 0x0, 0x2, 0x0, 0x1, + /* num */ 0x1, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, + /* mpc */ 0x0, 0x2, 0x0, 0x2, + /* num */ 0x3, + /* tuples */ 0x40, 0x3, 0x80, 0x1, 0x80, 0x2, }, + 35, + SHOULD_PARSE, /* Parses, but should get gibberish + afi/safis */ + }, + /* 17 */ + { + "ORFpad", + "ORF, multi entry/tuple, padded to align", { - "GR", - "GR capability", - { - /* hdr */ CAPABILITY_CODE_RESTART, 0xe, - /* R-bit, time */ 0xf1, 0x12, - /* afi */ 0x0, 0x1, - /* safi */ 0x1, - /* flags */ 0xf, - /* afi */ 0x0, 0x2, - /* safi */ 0x1, - /* flags */ 0x0, - /* afi */ 0x0, 0x2, - /* safi */ 0x2, - /* flags */ 0x1, - }, - 16, - SHOULD_PARSE, + /* hdr */ 0x3, + 0x22, + /* mpc */ 0x0, + 0x1, + 0x0, + 0x1, + /* num */ 0x3, + /* tuples */ 0x40, + 0x3, + 0x80, + 0x1, + 0x80, + 0x2, + /* mpc */ 0x0, + 0x2, + 0x0, + 0x1, + /* num */ 0x3, + /* tuples */ 0x40, + 0x3, + 0x80, + 0x1, + 0x80, + 0x2, + /* mpc */ 0x0, + 0x2, + 0x0, + 0x2, + /* num */ 0x3, + /* tuples */ 0x40, + 0x3, + 0x80, + 0x1, + 0x80, + 0x2, + 0x00, }, + 36, + SHOULD_PARSE, + }, + /* 19 */ + { + "AS4", + "AS4 capability", + {0x41, 0x4, 0xab, 0xcd, 0xef, 0x12}, /* AS: 2882400018 */ + 6, + SHOULD_PARSE, + 2882400018, + }, + { + "AS4", + "AS4 capability: short", + {0x41, 0x4, 0xab, 0xcd, 0xef}, /* AS: 2882400018 */ + 5, + SHOULD_ERR, + }, + { + "AS4", + "AS4 capability: long", + {0x41, 0x4, 0xab, 0xcd, 0xef, 0x12, 0x12}, + 7, + SHOULD_ERR, + 2882400018, + }, + { + "GR", + "GR capability", { - "GR-short", - "GR capability, but header length too short", - { - /* hdr */ 0x40, 0xa, - /* R-bit, time */ 0xf1, 0x12, - /* afi */ 0x0, 0x1, - /* safi */ 0x1, - /* flags */ 0xf, - /* afi */ 0x0, 0x2, - /* safi */ 0x1, - /* flags */ 0x0, - /* afi */ 0x0, 0x2, - /* safi */ 0x2, - /* flags */ 0x1, - }, - 15 /* array is 16 though */, - SHOULD_ERR, + /* hdr */ CAPABILITY_CODE_RESTART, + 0xe, + /* R-bit, time */ 0xf1, + 0x12, + /* afi */ 0x0, + 0x1, + /* safi */ 0x1, + /* flags */ 0xf, + /* afi */ 0x0, + 0x2, + /* safi */ 0x1, + /* flags */ 0x0, + /* afi */ 0x0, + 0x2, + /* safi */ 0x2, + /* flags */ 0x1, }, + 16, + SHOULD_PARSE, + }, + { + "GR-short", + "GR capability, but header length too short", { - "GR-long", - "GR capability, but header length too long", - { - /* hdr */ 0x40, 0xf, - /* R-bit, time */ 0xf1, 0x12, - /* afi */ 0x0, 0x1, - /* safi */ 0x1, - /* flags */ 0xf, - /* afi */ 0x0, 0x2, - /* safi */ 0x1, - /* flags */ 0x0, - /* afi */ 0x0, 0x2, - /* safi */ 0x2, - /* flags */ 0x01, - }, - 16, - SHOULD_ERR, + /* hdr */ 0x40, + 0xa, + /* R-bit, time */ 0xf1, + 0x12, + /* afi */ 0x0, + 0x1, + /* safi */ 0x1, + /* flags */ 0xf, + /* afi */ 0x0, + 0x2, + /* safi */ 0x1, + /* flags */ 0x0, + /* afi */ 0x0, + 0x2, + /* safi */ 0x2, + /* flags */ 0x1, }, + 15 /* array is 16 though */, + SHOULD_ERR, + }, + { + "GR-long", + "GR capability, but header length too long", { - "GR-trunc", - "GR capability, but truncated", - { - /* hdr */ 0x40, 0xf, - /* R-bit, time */ 0xf1, 0x12, - /* afi */ 0x0, 0x1, - /* safi */ 0x1, - /* flags */ 0xf, - /* afi */ 0x0, 0x2, - /* safi */ 0x1, - /* flags */ 0x0, - /* afi */ 0x0, 0x2, - /* safi */ 0x2, - /* flags */ 0x1, - }, - 15, - SHOULD_ERR, + /* hdr */ 0x40, + 0xf, + /* R-bit, time */ 0xf1, + 0x12, + /* afi */ 0x0, + 0x1, + /* safi */ 0x1, + /* flags */ 0xf, + /* afi */ 0x0, + 0x2, + /* safi */ 0x1, + /* flags */ 0x0, + /* afi */ 0x0, + 0x2, + /* safi */ 0x2, + /* flags */ 0x01, }, + 16, + SHOULD_ERR, + }, + { + "GR-trunc", + "GR capability, but truncated", { - "GR-empty", - "GR capability, but empty.", - { - /* hdr */ 0x40, 0x0, - }, - 2, - SHOULD_ERR, + /* hdr */ 0x40, + 0xf, + /* R-bit, time */ 0xf1, + 0x12, + /* afi */ 0x0, + 0x1, + /* safi */ 0x1, + /* flags */ 0xf, + /* afi */ 0x0, + 0x2, + /* safi */ 0x1, + /* flags */ 0x0, + /* afi */ 0x0, + 0x2, + /* safi */ 0x2, + /* flags */ 0x1, }, + 15, + SHOULD_ERR, + }, + { + "GR-empty", + "GR capability, but empty.", { - "MP-empty", - "MP capability, but empty.", - { - /* hdr */ 0x1, 0x0, - }, - 2, - SHOULD_ERR, + /* hdr */ 0x40, + 0x0, }, + 2, + SHOULD_ERR, + }, + { + "MP-empty", + "MP capability, but empty.", { - "ORF-empty", - "ORF capability, but empty.", - { - /* hdr */ 0x3, 0x0, - }, - 2, - SHOULD_ERR, + /* hdr */ 0x1, + 0x0, }, + 2, + SHOULD_ERR, + }, + { + "ORF-empty", + "ORF capability, but empty.", { - "AS4-empty", - "AS4 capability, but empty.", - { - /* hdr */ 0x41, 0x0, - }, - 2, - SHOULD_ERR, + /* hdr */ 0x3, + 0x0, }, + 2, + SHOULD_ERR, + }, + { + "AS4-empty", + "AS4 capability, but empty.", { - "dyn-empty", - "Dynamic capability, but empty.", - { - /* hdr */ 0x42, 0x0, - }, - 2, - SHOULD_PARSE, + /* hdr */ 0x41, + 0x0, }, + 2, + SHOULD_ERR, + }, + { + "dyn-empty", + "Dynamic capability, but empty.", { - "dyn-old", - "Dynamic capability (deprecated version)", - {CAPABILITY_CODE_DYNAMIC, 0x0}, - 2, - SHOULD_PARSE, + /* hdr */ 0x42, + 0x0, }, - {NULL, NULL, {0}, 0, 0}}; + 2, + SHOULD_PARSE, + }, + { + "dyn-old", + "Dynamic capability (deprecated version)", + {CAPABILITY_CODE_DYNAMIC, 0x0}, + 2, + SHOULD_PARSE, + }, + {NULL, NULL, {0}, 0, 0}}; /* DYNAMIC message */ struct test_segment dynamic_cap_msgs[] = { @@ -871,9 +819,9 @@ static void parse_test(struct peer *peer, struct test_segment *t, int type) failed++; if (tty) - printf("%s", - (failed > oldfailed) ? VT100_RED "failed!" VT100_RESET - : VT100_GREEN "OK" VT100_RESET); + printf("%s", (failed > oldfailed) + ? VT100_RED "failed!" VT100_RESET + : VT100_GREEN "OK" VT100_RESET); else printf("%s", (failed > oldfailed) ? "failed!" : "OK"); diff --git a/tests/bgpd/test_mp_attr.c b/tests/bgpd/test_mp_attr.c index 7c0afa1b9..2dbde0dbd 100644 --- a/tests/bgpd/test_mp_attr.c +++ b/tests/bgpd/test_mp_attr.c @@ -610,15 +610,15 @@ static struct test_segment { /* Nexthop */ 192, 168, 0, 1, /* SNPA (defunct, MBZ) */ 0x0, /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_AS */ - 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ - 10, 1, /* 10.1/16 */ - 88 + 17, 0xff, 0, 0, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_IP */ - 192, 168, 0, 1, /* IPv4 */ - 10, 2, 3, /* 10.2.3/17 */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_AS */ + 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ + 10, 1, /* 10.1/16 */ + 88 + 17, 0xff, 0, 0, /* tag */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_IP */ + 192, 168, 0, 1, /* IPv4 */ + 10, 2, 3, /* 10.2.3/17 */ }, (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)), SHOULD_PARSE, @@ -700,15 +700,15 @@ static struct test_segment { /* Nexthop */ 192, 168, 0, 1, /* SNPA (defunct, MBZ) */ 0x0, /* NLRI tuples */ 88 + 32, 0, 1, 2, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_AS */ - 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ - 10, 1, /* 10.1/16 */ - 88 + 17, 0xff, 0, 0, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_IP */ - 192, 168, 0, 1, /* IPv4 */ - 10, 2, 3, /* 10.2.3/17 */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_AS */ + 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ + 10, 1, /* 10.1/16 */ + 88 + 17, 0xff, 0, 0, /* tag */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_IP */ + 192, 168, 0, 1, /* IPv4 */ + 10, 2, 3, /* 10.2.3/17 */ }, (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)), SHOULD_ERR, @@ -727,16 +727,16 @@ static struct test_segment { /* Nexthop */ 192, 168, 0, 1, /* SNPA (defunct, MBZ) */ 0x0, /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_AS */ - 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ - 10, 1, /* 10.1/16 */ - 88 + 17, 0xff, 0, 0, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_IP */ - 192, 168, 0, 1, /* IPv4 */ - 10, 2, 3, /* 10.2.3/17 */ - 88 + 1, /* bogus */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_AS */ + 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ + 10, 1, /* 10.1/16 */ + 88 + 17, 0xff, 0, 0, /* tag */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_IP */ + 192, 168, 0, 1, /* IPv4 */ + 10, 2, 3, /* 10.2.3/17 */ + 88 + 1, /* bogus */ }, (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1), SHOULD_ERR, @@ -755,15 +755,15 @@ static struct test_segment { /* Nexthop */ 192, 168, 0, 1, /* SNPA (defunct, MBZ) */ 0x0, /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_AS */ - 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ - 10, 1, /* 10.1/16 */ - 88 + 2, 0xff, 0, 0, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_IP */ - 192, 168, 0, 1, /* IPv4 */ - 10, 2, 3, /* 10.2.3/17 */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_AS */ + 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ + 10, 1, /* 10.1/16 */ + 88 + 2, 0xff, 0, 0, /* tag */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_IP */ + 192, 168, 0, 1, /* IPv4 */ + 10, 2, 3, /* 10.2.3/17 */ }, (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)), SHOULD_ERR, @@ -782,15 +782,15 @@ static struct test_segment { /* Nexthop */ 192, 168, 0, 1, /* SNPA (defunct, MBZ) */ 0x0, /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */ - /* rd, 8 octets */ - 0xff, 0, /* Bogus RD */ - 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ - 10, 1, /* 10.1/16 */ - 88 + 17, 0xff, 0, 0, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_IP */ - 192, 168, 0, 1, /* IPv4 */ - 10, 2, 3, /* 10.2.3/17 */ + /* rd, 8 octets */ + 0xff, 0, /* Bogus RD */ + 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ + 10, 1, /* 10.1/16 */ + 88 + 17, 0xff, 0, 0, /* tag */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_IP */ + 192, 168, 0, 1, /* IPv4 */ + 10, 2, 3, /* 10.2.3/17 */ }, (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)), SHOULD_PARSE, @@ -809,16 +809,16 @@ static struct test_segment { /* Nexthop */ 192, 168, 0, 1, /* SNPA (defunct, MBZ) */ 0x0, /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_AS */ - 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ - 10, 1, /* 10.1/16 */ - 88 + 17, 0xff, 0, 0, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_IP */ - 192, 168, 0, 1, /* IPv4 */ - 10, 2, 3, /* 10.2.3/17 */ - 0 /* 0/0, bogus for vpnv4 ?? */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_AS */ + 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ + 10, 1, /* 10.1/16 */ + 88 + 17, 0xff, 0, 0, /* tag */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_IP */ + 192, 168, 0, 1, /* IPv4 */ + 10, 2, 3, /* 10.2.3/17 */ + 0 /* 0/0, bogus for vpnv4 ?? */ }, (4 + 12 + 1 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3) + 1), SHOULD_ERR, @@ -901,11 +901,23 @@ static struct test_segment mp_unreach_segments[] = { "IPv6-unreach2", "IPV6 MP Unreach, 2 NLRIs", { - /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, - /* NLRI tuples */ 32, 0xff, 0xfe, 0x1, - 0x2, /* fffe:102::/32 */ - 64, 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ - 0x0, 0x2, 0x0, 0x3, + /* AFI / SAFI */ 0x0, + AFI_IP6, + SAFI_UNICAST, + /* NLRI tuples */ 32, + 0xff, + 0xfe, + 0x1, + 0x2, /* fffe:102::/32 */ + 64, + 0xff, + 0xfe, + 0x0, + 0x1, /* fffe:1:2:3::/64 */ + 0x0, + 0x2, + 0x0, + 0x3, }, (3 + 5 + 9), SHOULD_PARSE, @@ -980,15 +992,15 @@ static struct test_segment mp_unreach_segments[] = { { /* AFI / SAFI */ 0x0, AFI_IP, IANA_SAFI_MPLS_VPN, /* NLRI tuples */ 88 + 16, 0, 1, 2, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_AS */ - 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ - 10, 1, /* 10.1/16 */ - 88 + 17, 0xff, 0, 0, /* tag */ - /* rd, 8 octets */ - 0, 0, /* RD_TYPE_IP */ - 192, 168, 0, 1, /* IPv4 */ - 10, 2, 3, /* 10.2.3/17 */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_AS */ + 0, 2, 0, 0xff, 3, 4, /* AS(2):val(4) */ + 10, 1, /* 10.1/16 */ + 88 + 17, 0xff, 0, 0, /* tag */ + /* rd, 8 octets */ + 0, 0, /* RD_TYPE_IP */ + 192, 168, 0, 1, /* IPv4 */ + 10, 2, 3, /* 10.2.3/17 */ }, (3 + (1 + 3 + 8 + 2) + (1 + 3 + 8 + 3)), SHOULD_PARSE, @@ -1017,9 +1029,9 @@ static void handle_result(struct peer *peer, struct test_segment *t, if (tty) - printf("%s", - (failed > oldfailed) ? VT100_RED "failed!" VT100_RESET - : VT100_GREEN "OK" VT100_RESET); + printf("%s", (failed > oldfailed) + ? VT100_RED "failed!" VT100_RESET + : VT100_GREEN "OK" VT100_RESET); else printf("%s", (failed > oldfailed) ? "failed!" : "OK"); diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c index ccd3b6f4c..72fe2d821 100644 --- a/tests/bgpd/test_mpath.c +++ b/tests/bgpd/test_mpath.c @@ -361,7 +361,8 @@ testcase_t test_bgp_info_mpath_update = { * Set up testcase vector */ testcase_t *all_tests[] = { - &test_bgp_cfg_maximum_paths, &test_bgp_mp_list, + &test_bgp_cfg_maximum_paths, + &test_bgp_mp_list, &test_bgp_info_mpath_update, }; diff --git a/tests/lib/cli/test_commands.c b/tests/lib/cli/test_commands.c index 48dd99d28..e149487c5 100644 --- a/tests/lib/cli/test_commands.c +++ b/tests/lib/cli/test_commands.c @@ -49,19 +49,23 @@ static vector test_cmds; static char test_buf[32768]; static struct cmd_node bgp_node = { - BGP_NODE, "%s(config-router)# ", + BGP_NODE, + "%s(config-router)# ", }; static struct cmd_node rip_node = { - RIP_NODE, "%s(config-router)# ", + RIP_NODE, + "%s(config-router)# ", }; static struct cmd_node isis_node = { - ISIS_NODE, "%s(config-router)# ", + ISIS_NODE, + "%s(config-router)# ", }; static struct cmd_node interface_node = { - INTERFACE_NODE, "%s(config-if)# ", + INTERFACE_NODE, + "%s(config-if)# ", }; static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "}; diff --git a/tests/lib/test_checksum.c b/tests/lib/test_checksum.c index c265e164e..87ea3039e 100644 --- a/tests/lib/test_checksum.c +++ b/tests/lib/test_checksum.c @@ -401,7 +401,7 @@ static int verify(u_char *buffer, testsz_t len) } static int /* return checksum in low-order 16 bits */ - in_cksum_optimized(void *parg, int nbytes) +in_cksum_optimized(void *parg, int nbytes) { u_short *ptr = parg; register long sum; /* assumes long == 32 bits */ @@ -433,7 +433,7 @@ static int /* return checksum in low-order 16 bits */ static int /* return checksum in low-order 16 bits */ - in_cksum_rfc(void *parg, int count) +in_cksum_rfc(void *parg, int count) /* from RFC 1071 */ { u_short *addr = parg; diff --git a/tests/lib/test_privs.c b/tests/lib/test_privs.c index c2cb5c2ea..843833437 100644 --- a/tests/lib/test_privs.c +++ b/tests/lib/test_privs.c @@ -27,7 +27,10 @@ #include "memory_vty.h" zebra_capabilities_t _caps_p[] = { - ZCAP_NET_RAW, ZCAP_BIND, ZCAP_NET_ADMIN, ZCAP_DAC_OVERRIDE, + ZCAP_NET_RAW, + ZCAP_BIND, + ZCAP_NET_ADMIN, + ZCAP_DAC_OVERRIDE, }; struct zebra_privs_t test_privs = { diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c index 43e79ba9d..eb9bca71d 100644 --- a/tests/lib/test_timer_correctness.c +++ b/tests/lib/test_timer_correctness.c @@ -97,8 +97,8 @@ static int timer_func(struct thread *thread) static int cmp_timeval(const void *a, const void *b) { - const struct timeval *ta = *(struct timeval * const *)a; - const struct timeval *tb = *(struct timeval * const *)b; + const struct timeval *ta = *(struct timeval *const *)a; + const struct timeval *tb = *(struct timeval *const *)b; if (timercmp(ta, tb, <)) return -1; |