Split the authority-cert and signature/hash code from routerparse
[tor.git] / src / test / test_bridges.c
blob1cad5445f43126f0774da71d25735b01c30dea97
1 /* Copyright (c) 2018, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
4 /**
5 * \file test_bridges.c
6 * \brief Unittests for code in bridges.c
7 **/
9 #define TOR_BRIDGES_PRIVATE
10 #define PT_PRIVATE /* Only needed for the mock_* items below */
12 #include <stdbool.h>
14 #include "core/or/or.h"
15 #include "lib/net/address.h"
16 #include "feature/client/bridges.h"
17 #include "app/config/config.h"
18 #include "feature/client/transports.h"
19 #include "feature/nodelist/node_st.h"
20 #include "feature/nodelist/routerinfo_st.h"
21 #include "feature/nodelist/routerstatus_st.h"
22 #include "feature/nodelist/microdesc_st.h"
24 /* Test suite stuff */
25 #include "test/test.h"
27 /**
28 * A mocked transport_t, constructed via mock_transport_get_by_name().
30 static transport_t *mock_transport = NULL;
32 /**
33 * Mock transport_get_by_name() to simply return a transport_t for the
34 * transport name that was input to it.
36 static transport_t *
37 mock_transport_get_by_name(const char *name)
39 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
40 uint16_t port = 9999;
41 int socksv = 9;
42 char *args = tor_strdup("foo=bar");
44 if (!mock_transport) {
45 tor_addr_parse(addr, "99.99.99.99");
46 mock_transport = transport_new(addr, port, name, socksv, args);
49 tor_free(addr);
50 tor_free(args);
52 return mock_transport;
55 #undef PT_PRIVATE /* defined(PT_PRIVATE) */
57 /**
58 * Test helper: Add a variety of bridges to our global bridgelist.
60 static void
61 helper_add_bridges_to_bridgelist(void *arg)
63 /* Note: the two bridges which do not have specified fingerprints will be
64 * internally stored as both having the same fingerprint of all-zero bytes.
67 (void)arg;
68 char *bridge0 = tor_strdup("6.6.6.6:6666");
69 char *bridge1 = tor_strdup("6.6.6.7:6667 "
70 "A10C4F666D27364036B562823E5830BC448E046A");
71 char *bridge2 = tor_strdup("obfs4 198.245.60.51:443 "
72 "752CF7825B3B9EA6A98C83AC41F7099D67007EA5 "
73 "cert=xpmQtKUqQ/6v5X7ijgYE/f03+l2/EuQ1dexjyUhh16wQlu/"
74 "cpXUGalmhDIlhuiQPNEKmKw iat-mode=0");
75 char *bridge3 = tor_strdup("banana 5.5.5.5:5555 "
76 "9D6AE1BD4FDF39721CE908966E79E16F9BFCCF2F");
77 char *bridge4 = tor_strdup("obfs4 1.2.3.4:1234 "
78 "foo=abcdefghijklmnopqrstuvwxyz");
79 char *bridge5 = tor_strdup("apple 4.4.4.4:4444 "
80 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA "
81 "foo=abcdefghijklmnopqrstuvwxyz");
82 char *bridge6 = tor_strdup("[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:6666");
84 mark_bridge_list();
86 #define ADD_BRIDGE(bridge) \
87 bridge_line_t *bridge_line_ ##bridge = parse_bridge_line(bridge); \
88 if (!bridge_line_ ##bridge) { \
89 printf("Unparseable bridge line: '%s'", #bridge); \
90 } else { \
91 bridge_add_from_config(bridge_line_ ##bridge); \
92 } \
93 tor_free(bridge);
95 ADD_BRIDGE(bridge0);
96 ADD_BRIDGE(bridge1);
97 ADD_BRIDGE(bridge2);
98 ADD_BRIDGE(bridge3);
99 ADD_BRIDGE(bridge4);
100 ADD_BRIDGE(bridge5);
101 ADD_BRIDGE(bridge6);
102 #undef ADD_BRIDGES
104 sweep_bridge_list();
108 * Make sure our test helper works too.
110 static void
111 test_bridges_helper_func_add_bridges_to_bridgelist(void *arg)
113 helper_add_bridges_to_bridgelist(arg);
114 tt_finished();
116 done:
117 mark_bridge_list();
118 sweep_bridge_list();
122 * Calling bridge_list_get() should create a new bridgelist if we
123 * didn't have one before.
125 static void
126 test_bridges_bridge_list_get_creates_new_bridgelist(void *arg)
128 const smartlist_t *bridgelist = bridge_list_get();
130 (void)arg;
132 tt_ptr_op(bridgelist, OP_NE, NULL);
134 done:
135 return;
139 * Calling clear_bridge_list() should remove all bridges from the bridgelist.
141 static void
142 test_bridges_clear_bridge_list(void *arg)
144 const smartlist_t *bridgelist;
145 const smartlist_t *bridgelist_after;
146 const bridge_info_t *bridge;
148 helper_add_bridges_to_bridgelist(arg);
149 bridgelist = bridge_list_get();
150 tt_ptr_op(bridgelist, OP_NE, NULL);
152 bridge = smartlist_get(bridgelist, 0);
153 tt_ptr_op(bridge, OP_NE, NULL);
155 clear_bridge_list();
156 bridgelist_after = bridge_list_get();
157 tt_ptr_op(bridgelist_after, OP_NE, NULL);
158 tt_int_op(smartlist_len(bridgelist_after), OP_EQ, 0);
160 done:
161 return;
165 * Calling bridge_get_addrport() should give me the address and port
166 * of the bridge. In this case, we sort the smartlist of bridges on
167 * fingerprints and choose the first one.
169 static void
170 test_bridges_bridge_get_addrport(void *arg)
172 smartlist_t *bridgelist;
173 const bridge_info_t *bridge;
174 const tor_addr_port_t *addrport;
176 helper_add_bridges_to_bridgelist(arg);
177 bridgelist = (smartlist_t*)bridge_list_get();
178 tt_ptr_op(bridgelist, OP_NE, NULL);
180 // This should be the bridge at 6.6.6.6:6666 with fingerprint
181 // 0000000000000000000000000000000000000000
182 bridge = smartlist_get(bridgelist, 0);
183 tt_ptr_op(bridge, OP_NE, NULL);
185 addrport = bridge_get_addr_port(bridge);
186 tt_int_op(addrport->port, OP_EQ, 6666);
188 done:
189 mark_bridge_list();
190 sweep_bridge_list();
194 * Calling get_configured_bridge_by_orports_digest() with two
195 * configured bridge orports and an invalid digest should return the
196 * bridge of the first addrport in the list.
198 static void
199 test_bridges_get_configured_bridge_by_orports_digest(void *arg)
201 smartlist_t *orports = NULL;
202 const smartlist_t *bridgelist;
203 const bridge_info_t *bridge1;
204 const bridge_info_t *bridge2;
205 const bridge_info_t *ret;
206 tor_addr_port_t *addrport1;
207 tor_addr_port_t *addrport2;
208 const char *digest;
210 helper_add_bridges_to_bridgelist(arg);
211 bridgelist = bridge_list_get();
212 tt_ptr_op(bridgelist, OP_NE, NULL);
214 // This should be the bridge at 6.6.6.6:6666 with fingerprint
215 // 0000000000000000000000000000000000000000
216 bridge1 = smartlist_get(bridgelist, 0);
217 tt_ptr_op(bridge1, OP_NE, NULL);
218 // This should be the bridge at 6.6.6.7:6667 with fingerprint
219 // A10C4F666D27364036B562823E5830BC448E046A
220 bridge2 = smartlist_get(bridgelist, 1);
221 tt_ptr_op(bridge2, OP_NE, NULL);
223 addrport1 = (tor_addr_port_t*)bridge_get_addr_port(bridge1);
224 tt_int_op(addrport1->port, OP_EQ, 6666);
225 addrport2 = (tor_addr_port_t*)bridge_get_addr_port(bridge2);
226 tt_int_op(addrport2->port, OP_EQ, 6667);
228 orports = smartlist_new();
229 smartlist_add(orports, addrport1);
230 smartlist_add(orports, addrport2);
232 digest = "zzzzzzzzzzzzzzzz";
234 ret = get_configured_bridge_by_orports_digest(digest, orports);
235 tt_ptr_op(ret, OP_NE, NULL);
237 tt_assert(tor_addr_port_eq(addrport1, bridge_get_addr_port(ret)));
239 done:
240 smartlist_free(orports);
242 mark_bridge_list();
243 sweep_bridge_list();
247 * Calling get_configured_bridge_by_addr_port_digest() with a digest that we do
248 * have and an addr:port pair we don't should return the bridge for that
249 * digest.
251 static void
252 test_bridges_get_configured_bridge_by_addr_port_digest_digest_only(void *arg)
254 char digest[DIGEST_LEN];
255 bridge_info_t *bridge;
256 const char fingerprint[HEX_DIGEST_LEN] =
257 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
258 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
259 char ret_addr[16];
260 uint16_t port = 11111;
261 int ret;
263 helper_add_bridges_to_bridgelist(arg);
265 // We don't actually have a bridge with this addr:port pair
266 base16_decode(digest, DIGEST_LEN, fingerprint, HEX_DIGEST_LEN);
267 ret = tor_addr_parse(addr, "111.111.111.111");
268 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success
270 bridge = get_configured_bridge_by_addr_port_digest(addr, port, digest);
271 tt_ptr_op(bridge, OP_NE, NULL);
273 tor_addr_to_str(ret_addr, &bridge_get_addr_port(bridge)->addr, 16, 0);
274 tt_str_op("4.4.4.4", OP_EQ, ret_addr);
276 done:
277 tor_free(addr);
279 mark_bridge_list();
280 sweep_bridge_list();
284 * Calling get_configured_bridge_by_addr_port_digest() with only an
285 * addr:port (i.e. digest set to NULL) should return the bridge for
286 * that digest when there is such a bridge.
288 static void
289 test_bridges_get_configured_bridge_by_addr_port_digest_address_only(void *arg)
291 bridge_info_t *bridge;
292 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
293 char ret_addr[16];
294 uint16_t port = 6666;
295 int ret;
297 helper_add_bridges_to_bridgelist(arg);
299 ret = tor_addr_parse(addr, "6.6.6.6");
300 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success
302 bridge = get_configured_bridge_by_addr_port_digest(addr, port, NULL);
303 tt_ptr_op(bridge, OP_NE, NULL);
305 tor_addr_to_str(ret_addr, &bridge_get_addr_port(bridge)->addr, 16, 0);
306 tt_str_op("6.6.6.6", OP_EQ, ret_addr);
308 done:
309 tor_free(addr);
311 mark_bridge_list();
312 sweep_bridge_list();
316 * Calling get_configured_bridge_by_exact_addr_port_digest() with a digest that
317 * we do have, and an addr:port pair we don't have, should return NULL.
319 static void
320 test_bridges_get_configured_bridge_by_exact_addr_port_digest_donly(void *arg)
322 char digest[DIGEST_LEN];
323 bridge_info_t *bridge;
324 const char fingerprint[HEX_DIGEST_LEN] =
325 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
326 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
327 uint16_t port = 11111;
328 int ret;
330 helper_add_bridges_to_bridgelist(arg);
332 // We don't actually have a bridge with this addr:port pair
333 base16_decode(digest, DIGEST_LEN, fingerprint, HEX_DIGEST_LEN);
334 ret = tor_addr_parse(addr, "111.111.111.111");
335 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success
337 bridge = get_configured_bridge_by_exact_addr_port_digest(addr, port, digest);
338 tt_ptr_op(bridge, OP_EQ, NULL);
340 done:
341 tor_free(addr);
343 mark_bridge_list();
344 sweep_bridge_list();
348 * Calling get_configured_bridge_by_exact_addr_port_digest() with a digest that
349 * we do have, and an addr:port pair we do have, should return the bridge.
351 static void
352 test_bridges_get_configured_bridge_by_exact_addr_port_digest_both(void *arg)
354 char digest[DIGEST_LEN];
355 bridge_info_t *bridge;
356 const char fingerprint[HEX_DIGEST_LEN] =
357 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
358 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
359 uint16_t port = 4444;
360 char ret_addr[16];
361 int ret;
363 helper_add_bridges_to_bridgelist(arg);
365 base16_decode(digest, DIGEST_LEN, fingerprint, HEX_DIGEST_LEN);
366 ret = tor_addr_parse(addr, "4.4.4.4");
367 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success
369 bridge = get_configured_bridge_by_exact_addr_port_digest(addr, port, digest);
370 tt_ptr_op(bridge, OP_NE, NULL);
372 tor_addr_to_str(ret_addr, &bridge_get_addr_port(bridge)->addr, 16, 0);
373 tt_str_op("4.4.4.4", OP_EQ, ret_addr);
375 done:
376 tor_free(addr);
378 mark_bridge_list();
379 sweep_bridge_list();
383 * Calling get_configured_bridge_by_exact_addr_port_digest() with no digest,
384 * and an addr:port pair we do have, should return the bridge.
386 static void
387 test_bridges_get_configured_bridge_by_exact_addr_port_digest_aonly(void *arg)
389 bridge_info_t *bridge;
390 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
391 uint16_t port = 4444;
392 char ret_addr[16];
393 int ret;
395 helper_add_bridges_to_bridgelist(arg);
397 ret = tor_addr_parse(addr, "4.4.4.4");
398 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success
400 bridge = get_configured_bridge_by_exact_addr_port_digest(addr, port, NULL);
401 tt_ptr_op(bridge, OP_NE, NULL);
403 tor_addr_to_str(ret_addr, &bridge_get_addr_port(bridge)->addr, 16, 0);
404 tt_str_op("4.4.4.4", OP_EQ, ret_addr);
406 done:
407 tor_free(addr);
409 mark_bridge_list();
410 sweep_bridge_list();
414 * Calling find_bridge_by_digest() when we have a bridge with a known
415 * identity digest should return the bridge's information.
417 static void
418 test_bridges_find_bridge_by_digest_known(void *arg)
420 char digest1[DIGEST_LEN];
421 bridge_info_t *bridge;
422 const char fingerprint[HEX_DIGEST_LEN] =
423 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
425 helper_add_bridges_to_bridgelist(arg);
427 base16_decode(digest1, DIGEST_LEN, fingerprint, HEX_DIGEST_LEN);
428 bridge = find_bridge_by_digest(digest1);
430 tt_ptr_op(bridge, OP_NE, NULL);
432 /* We have to call bridge_get_rsa_id_digest() here because the bridge_info_t
433 * struct is opaquely defined in bridges.h. */
434 const uint8_t *digest2 = bridge_get_rsa_id_digest(bridge);
436 tt_mem_op((char*)digest2, OP_EQ, digest1, DIGEST_LEN);
438 done:
439 mark_bridge_list();
440 sweep_bridge_list();
444 * Calling find_bridge_by_digest() when we do NOT have a bridge with that
445 * identity digest should return NULL.
447 static void
448 test_bridges_find_bridge_by_digest_unknown(void *arg)
450 const char *fingerprint = "cccccccccccccccccccccccccccccccccccccccc";
451 bridge_info_t *bridge;
453 helper_add_bridges_to_bridgelist(arg);
455 bridge = find_bridge_by_digest(fingerprint);
457 tt_ptr_op(bridge, OP_EQ, NULL);
459 done:
460 mark_bridge_list();
461 sweep_bridge_list();
465 * Calling bridge_resolve_conflicts() with an identical bridge to one we've
466 * already configure should mark the pre-configured bridge for removal.
468 static void
469 test_bridges_bridge_resolve_conflicts(void *arg)
471 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
472 uint16_t port = 4444;
473 const char *digest = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
474 const char *transport = "apple";
475 int ret;
477 helper_add_bridges_to_bridgelist(arg);
479 ret = tor_addr_parse(addr, "4.4.4.4");
480 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success
482 bridge_resolve_conflicts((const tor_addr_t*)addr, port, digest, transport);
484 /* The bridge should now be marked for removal, and removed when we sweep the
485 * bridge_list */
486 sweep_bridge_list();
487 ret = addr_is_a_configured_bridge((const tor_addr_t*)addr, port, digest);
488 tt_int_op(ret, OP_EQ, 0);
490 done:
491 tor_free(addr);
493 mark_bridge_list();
494 sweep_bridge_list();
498 * Calling transport_is_needed() with a transport we do need ("obfs4") and a
499 * bogus transport that we don't need should return 1 and 0, respectively.
501 static void
502 test_bridges_transport_is_needed(void *arg)
504 int ret;
506 helper_add_bridges_to_bridgelist(arg);
508 ret = transport_is_needed("obfs4");
509 tt_int_op(ret, OP_EQ, 1);
511 ret = transport_is_needed("apowefjaoewpaief");
512 tt_int_op(ret, OP_EQ, 0);
514 done:
515 mark_bridge_list();
516 sweep_bridge_list();
520 * Calling get_transport_by_bridge_addrport() with the address and port of a
521 * configured bridge which uses a pluggable transport when there is no global
522 * transport_list should return -1 and the transport_t should be NULL.
524 static void
525 test_bridges_get_transport_by_bridge_addrport_no_ptlist(void *arg)
527 transport_t *transport = NULL;
528 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
529 uint16_t port = 1234;
530 int ret;
532 helper_add_bridges_to_bridgelist(arg);
534 ret = tor_addr_parse(addr, "1.2.3.4");
535 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success?
537 /* This will fail because the global transport_list has nothing in it, and so
538 * transport_get_by_name() has nothing to return, even the the bridge *did*
539 * say it had an obfs4 transport.
541 ret = get_transport_by_bridge_addrport((const tor_addr_t*)addr, port,
542 (const transport_t**)&transport);
543 tt_int_op(ret, OP_EQ, -1); // returns -1 on failure
544 tt_ptr_op(transport, OP_EQ, NULL);
546 done:
547 tor_free(addr);
549 mark_bridge_list();
550 sweep_bridge_list();
553 #define PT_PRIVATE
556 * Calling get_transport_by_bridge_addrport() with the address and port of a
557 * configured bridge which uses a pluggable transport should return 0 and set
558 * appropriate transport_t.
560 static void
561 test_bridges_get_transport_by_bridge_addrport(void *arg)
563 transport_t *transport = NULL;
564 tor_addr_t *addr = tor_malloc(sizeof(tor_addr_t));
565 uint16_t port = 1234;
566 int ret;
568 helper_add_bridges_to_bridgelist(arg);
569 mark_transport_list(); // Also initialise our transport_list
571 ret = tor_addr_parse(addr, "1.2.3.4");
572 tt_int_op(ret, OP_EQ, 2); // it returns the address family on success?
574 /* After we mock transport_get_by_name() to return a bogus transport_t with
575 * the name it was asked for, the call should succeed.
577 MOCK(transport_get_by_name, mock_transport_get_by_name);
578 ret = get_transport_by_bridge_addrport((const tor_addr_t*)addr, port,
579 (const transport_t**)&transport);
580 tt_int_op(ret, OP_EQ, 0); // returns 0 on success
581 tt_ptr_op(transport, OP_NE, NULL);
582 tt_str_op(transport->name, OP_EQ, "obfs4");
584 done:
585 UNMOCK(transport_get_by_name);
587 tor_free(addr);
588 transport_free(transport);
590 mark_bridge_list();
591 sweep_bridge_list();
594 static void
595 test_bridges_node_is_a_configured_bridge(void *arg)
597 routerinfo_t ri_ipv4 = { .addr = 0x06060606, .or_port = 6666 };
598 routerstatus_t rs_ipv4 = { .addr = 0x06060606, .or_port = 6666 };
600 routerinfo_t ri_ipv6 = { .ipv6_orport = 6666 };
601 tor_addr_parse(&(ri_ipv6.ipv6_addr),
602 "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
604 routerstatus_t rs_ipv6 = { .ipv6_orport = 6666 };
605 tor_addr_parse(&(rs_ipv6.ipv6_addr),
606 "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
608 microdesc_t md_ipv6 = { .ipv6_orport = 6666 };
609 tor_addr_parse(&(md_ipv6.ipv6_addr),
610 "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
612 helper_add_bridges_to_bridgelist(arg);
614 node_t node_with_digest;
615 memset(&node_with_digest, 0, sizeof(node_with_digest));
617 const char fingerprint[HEX_DIGEST_LEN] =
618 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
620 const char fingerprint2[HEX_DIGEST_LEN] =
621 "ffffffffffffffffffffffffffffffffffffffff";
623 base16_decode(node_with_digest.identity, DIGEST_LEN,
624 fingerprint, HEX_DIGEST_LEN);
626 node_t node_ri_ipv4 = { .ri = &ri_ipv4 };
627 base16_decode(node_ri_ipv4.identity, DIGEST_LEN,
628 fingerprint2, HEX_DIGEST_LEN);
629 tt_assert(node_is_a_configured_bridge(&node_ri_ipv4));
631 /* This will still match bridge0, since bridge0 has no digest set. */
632 memset(node_ri_ipv4.identity, 0x3f, DIGEST_LEN);
633 tt_assert(node_is_a_configured_bridge(&node_ri_ipv4));
635 /* It won't match bridge1, though, since bridge1 has a digest, and this
636 isn't it! */
637 node_ri_ipv4.ri->addr = 0x06060607;
638 node_ri_ipv4.ri->or_port = 6667;
639 tt_assert(! node_is_a_configured_bridge(&node_ri_ipv4));
640 /* If we set the fingerprint right, though, it will match. */
641 base16_decode(node_ri_ipv4.identity, DIGEST_LEN,
642 "A10C4F666D27364036B562823E5830BC448E046A", HEX_DIGEST_LEN);
643 tt_assert(node_is_a_configured_bridge(&node_ri_ipv4));
645 node_t node_rs_ipv4 = { .rs = &rs_ipv4 };
646 base16_decode(node_rs_ipv4.identity, DIGEST_LEN,
647 fingerprint2, HEX_DIGEST_LEN);
648 tt_assert(node_is_a_configured_bridge(&node_rs_ipv4));
650 node_t node_ri_ipv6 = { .ri = &ri_ipv6 };
651 base16_decode(node_ri_ipv6.identity, DIGEST_LEN,
652 fingerprint2, HEX_DIGEST_LEN);
653 tt_assert(node_is_a_configured_bridge(&node_ri_ipv6));
655 node_t node_rs_ipv6 = { .rs = &rs_ipv6 };
656 base16_decode(node_rs_ipv6.identity, DIGEST_LEN,
657 fingerprint2, HEX_DIGEST_LEN);
658 tt_assert(node_is_a_configured_bridge(&node_rs_ipv6));
660 node_t node_md_ipv6 = { .md = &md_ipv6 };
661 base16_decode(node_md_ipv6.identity, DIGEST_LEN,
662 fingerprint2, HEX_DIGEST_LEN);
663 tt_assert(node_is_a_configured_bridge(&node_md_ipv6));
665 mark_bridge_list();
666 sweep_bridge_list();
668 tt_assert(!node_is_a_configured_bridge(&node_with_digest));
669 tt_assert(!node_is_a_configured_bridge(&node_ri_ipv4));
670 tt_assert(!node_is_a_configured_bridge(&node_ri_ipv6));
671 tt_assert(!node_is_a_configured_bridge(&node_rs_ipv4));
672 tt_assert(!node_is_a_configured_bridge(&node_rs_ipv6));
673 tt_assert(!node_is_a_configured_bridge(&node_md_ipv6));
675 done:
676 mark_bridge_list();
677 sweep_bridge_list();
680 #undef PT_PRIVATE /* defined(PT_PRIVATE) */
682 #define B_TEST(name, flags) \
683 { #name, test_bridges_ ##name, (flags), NULL, NULL }
685 struct testcase_t bridges_tests[] = {
686 B_TEST(helper_func_add_bridges_to_bridgelist, 0),
687 B_TEST(bridge_list_get_creates_new_bridgelist, 0),
688 B_TEST(clear_bridge_list, 0),
689 B_TEST(bridge_get_addrport, 0),
690 B_TEST(get_configured_bridge_by_orports_digest, 0),
691 B_TEST(get_configured_bridge_by_addr_port_digest_digest_only, 0),
692 B_TEST(get_configured_bridge_by_addr_port_digest_address_only, 0),
693 B_TEST(get_configured_bridge_by_exact_addr_port_digest_donly, 0),
694 B_TEST(get_configured_bridge_by_exact_addr_port_digest_both, 0),
695 B_TEST(get_configured_bridge_by_exact_addr_port_digest_aonly, 0),
696 B_TEST(find_bridge_by_digest_known, 0),
697 B_TEST(find_bridge_by_digest_unknown, 0),
698 B_TEST(bridge_resolve_conflicts, 0),
699 B_TEST(get_transport_by_bridge_addrport_no_ptlist, 0),
700 B_TEST(get_transport_by_bridge_addrport, 0),
701 B_TEST(transport_is_needed, 0),
702 B_TEST(node_is_a_configured_bridge, 0),
703 END_OF_TESTCASES