diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-06-17 08:01:23 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2023-06-17 08:01:23 +0000 |
commit | b43b7129289f40ebfcabaf3cc991087ccfc9f509 (patch) | |
tree | 601de57dcace5c6415fc452779b3f492dd535a08 /regress | |
parent | 9b56317cd770c6457f448c851a2257247311108e (diff) |
Add community tests for various ext-community * versions.
While there move one test down so that the numbering is consistent again
and make the error strings for counts clear.
Diffstat (limited to 'regress')
-rw-r--r-- | regress/usr.sbin/bgpd/unittests/rde_community_test.c | 6 | ||||
-rw-r--r-- | regress/usr.sbin/bgpd/unittests/rde_community_test.h | 73 |
2 files changed, 69 insertions, 10 deletions
diff --git a/regress/usr.sbin/bgpd/unittests/rde_community_test.c b/regress/usr.sbin/bgpd/unittests/rde_community_test.c index 38c2a8a50d2..4b4457158dc 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_community_test.c +++ b/regress/usr.sbin/bgpd/unittests/rde_community_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_community_test.c,v 1.6 2023/01/30 17:02:48 claudio Exp $ */ +/* $OpenBSD: rde_community_test.c,v 1.7 2023/06/17 08:01:22 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org> @@ -161,7 +161,7 @@ test_filter(size_t num, struct testfilter *f) if (f->next != 0) { if (community_count(&comm, COMMUNITY_TYPE_EXT) != f->next - 1) { - printf("Test %zu: community_count unexpected " + printf("Test %zu: ext community_count unexpected " "return %d != %d\n", num, r, f->next - 1); return -1; } @@ -170,7 +170,7 @@ test_filter(size_t num, struct testfilter *f) if (f->nlarge != 0) { if (community_count(&comm, COMMUNITY_TYPE_LARGE) != f->nlarge - 1) { - printf("Test %zu: community_count unexpected " + printf("Test %zu: large community_count unexpected " "return %d != %d\n", num, r, f->nlarge - 1); return -1; } diff --git a/regress/usr.sbin/bgpd/unittests/rde_community_test.h b/regress/usr.sbin/bgpd/unittests/rde_community_test.h index 2d2439a0e02..00368912f22 100644 --- a/regress/usr.sbin/bgpd/unittests/rde_community_test.h +++ b/regress/usr.sbin/bgpd/unittests/rde_community_test.h @@ -502,6 +502,22 @@ struct community filters[] = { .data2 = 196618, .data3 = EXT_COMMUNITY_TRANS_TWO_AS << 8 | 0x02, }, + { /* 42 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 24), + }, + { /* 43 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 8), + .data3 = (-1 << 8) | 0x02, + }, + { /* 44 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 8), + .data3 = EXT_COMMUNITY_TRANS_FOUR_AS << 8 | 0x02, + }, + { /* 45 */ + .flags = COMMUNITY_TYPE_EXT | (COMMUNITY_ANY << 16), + .data3 = EXT_COMMUNITY_TRANS_FOUR_AS << 8 | 0x02, + .data1 = 196618, + }, }; struct testfilter { @@ -515,12 +531,6 @@ struct testfilter { struct rde_peer *peer; } testfilters[] = { { - .in = { 38, -1 }, - .match = 30, - .mout = 1, - .peer = &peer, - }, - { .in = { 1, 2, -1 }, .match = 1, .mout = 1, @@ -952,5 +962,54 @@ struct testfilter { .mout = 1, .peer = &peer_r4, }, + { + .in = { 38, -1 }, + .match = 30, + .mout = 1, + .peer = &peer, + }, + { /* 70 */ + .in = { 38, 39, 40, -1 }, + .match = 42, + .mout = 1, + .delete = 42, + .next = 0 + 1, + .peer = &peer, + }, + { + .in = { 38, 39, 40, -1 }, + .match = 43, + .mout = 1, + .delete = 43, + .next = 0 + 1, + .peer = &peer, + }, + { + .in = { 39, 40, -1 }, + .match = 44, + .mout = 1, + .delete = 44, + .next = 0 + 1, + .peer = &peer, + }, + { + .in = { 38, -1 }, + .match = 44, + .mout = 0, + .peer = &peer, + }, + { + .in = { 40, -1 }, + .match = 45, + .mout = 1, + .delete = 45, + .next = 0 + 1, + .peer = &peer, + }, + { /* 75 */ + .in = { 38, 39, 41, -1 }, + .match = 45, + .mout = 0, + .peer = &peer, + }, }; - |