static void NS(test_main)(void *arg) { routerset_t *set, *bad_set; (void)arg; set = routerset_new(); bad_set = routerset_new(); smartlist_free(bad_set->list); bad_set->list = NULL; NS_MOCK(smartlist_new); routerset_union(set, NULL); tt_int_op(CALLED(smartlist_new), ==, 0); routerset_union(set, bad_set); tt_int_op(CALLED(smartlist_new), ==, 0); done: NS_UNMOCK(smartlist_new); routerset_free(set); /* Just recreate list, so we can simply use routerset_free. */ bad_set->list = smartlist_new(); routerset_free(bad_set); }
static void NS(test_main)(void *arg) { const routerset_t *set; int needs_geoip; (void)arg; set = NULL; needs_geoip = routerset_needs_geoip(set); tt_int_op(needs_geoip, ==, 0); set = routerset_new(); needs_geoip = routerset_needs_geoip(set); routerset_free((routerset_t *)set); tt_int_op(needs_geoip, ==, 0); set = NULL; set = routerset_new(); smartlist_add(set->country_names, tor_strndup("xx", 2)); needs_geoip = routerset_needs_geoip(set); routerset_free((routerset_t *)set); set = NULL; tt_int_op(needs_geoip, !=, 0); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = NULL; int is_empty; (void)arg; is_empty = routerset_is_empty(set); tt_int_op(is_empty, !=, 0); set = routerset_new(); is_empty = routerset_is_empty(set); routerset_free(set); set = NULL; tt_int_op(is_empty, !=, 0); set = routerset_new(); smartlist_add(set->list, tor_strdup("{xx}")); is_empty = routerset_is_empty(set); routerset_free(set); set = NULL; tt_int_op(is_empty, ==, 0); done: ; }
void refreshBannedNodes(void) { r1=tmpOptions->ExcludeExitNodes; r2=routerset_new(); char *tmp1=tor_malloc(65536),*tmp2,*tmp3;tmp2=tmp1;tmp3=tmp1;GetDlgItemText(hDlgRouterRestrictions,15100,tmp1,65536); while(*tmp1) { while((*tmp1==32)||(*tmp1==9)) tmp1++; if((*tmp1==13)||(*tmp1==10)) { while((*tmp1==13)||(*tmp1==10)){ tmp1++;} *tmp2++=','; } else if((*tmp1=='[')&&(*(tmp1+2)==']')) { if((*(tmp1+1)=='x')||(*(tmp1+1)=='X')) { tmp1+=3; while((*tmp1==32)||(*tmp1==9)) tmp1++; while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) *tmp2++=*tmp1++; } else while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) tmp1++; } else while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) tmp1++; } *tmp2=0;routerset_parse(r2,tmp3,"ExcludeExitNodes"); tmpOptions->ExcludeExitNodes=r2; if(r1) routerset_free(r1); r1=tmpOptions->ExcludeNodes; r2=routerset_new(); tmp1=tmp3;tmp2=tmp3;GetDlgItemText(hDlgRouterRestrictions,15100,tmp1,65536); while(*tmp1) { while((*tmp1==32)||(*tmp1==9)) tmp1++; if((*tmp1==13)||(*tmp1==10)) { while((*tmp1==13)||(*tmp1==10)){ tmp1++;} *tmp2++=','; } else if((*tmp1=='[')&&(*(tmp1+2)==']')) { if((*(tmp1+1)=='x')||(*(tmp1+1)=='X')) { while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) tmp1++; } else { while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) *tmp2++=*tmp1++; } } else { while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) *tmp2++=*tmp1++; } } *tmp2=0;routerset_parse(r2,tmp3,"ExcludeNodes"); tmpOptions->ExcludeNodes=r2; if(r1) routerset_free(r1); if(tmpOptions->ExcludeExitNodes || tmpOptions->ExcludeNodes) { r2 = tmpOptions->_ExcludeExitNodesUnion; r1 = routerset_new(); routerset_union(r1,tmpOptions->ExcludeExitNodes); routerset_union(r1,tmpOptions->ExcludeNodes); tmpOptions->_ExcludeExitNodesUnion = r1; if(r2) routerset_free(r2); } tor_free(tmp3); }
void refreshFavoriteNodes(void) { r1=tmpOptions->EntryNodes; r2=routerset_new(); char *tmp1=tor_malloc(65536),*tmp2,*tmp3;tmp2=tmp1;tmp3=tmp1;GetDlgItemText(hDlgRouterRestrictions,15101,tmp1,65536); while(*tmp1) { while((*tmp1==32)||(*tmp1==9)) tmp1++; if((*tmp1==13)||(*tmp1==10)) { while((*tmp1==13)||(*tmp1==10)){ tmp1++;} *tmp2++=','; } else if((*tmp1=='[')&&(*(tmp1+2)==']')) { if((*(tmp1+1)=='e')||(*(tmp1+1)=='E')) { tmp1+=3; while((*tmp1==32)||(*tmp1==9)) tmp1++; while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) *tmp2++=*tmp1++; } else while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) tmp1++; } else while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) tmp1++; } *tmp2=0;routerset_parse(r2,tmp3,"EntryNodes"); tmpOptions->EntryNodes=r2; if(r1) routerset_free(r1); r1=tmpOptions->ExitNodes; r2=routerset_new(); tmp1=tmp3;tmp2=tmp3;GetDlgItemText(hDlgRouterRestrictions,15101,tmp1,65536); while(*tmp1) { while((*tmp1==32)||(*tmp1==9)) tmp1++; if((*tmp1==13)||(*tmp1==10)) { while((*tmp1==13)||(*tmp1==10)){ tmp1++;} *tmp2++=','; } else if((*tmp1=='[')&&(*(tmp1+2)==']')) { if((*(tmp1+1)=='e')||(*(tmp1+1)=='E')) { while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) tmp1++; } else if((*(tmp1+1)=='x')||(*(tmp1+1)=='X')) { tmp1+=3; while((*tmp1==32)||(*tmp1==9)) tmp1++; while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) *tmp2++=*tmp1++; } else { while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) *tmp2++=*tmp1++; } } else { while((*tmp1!=0)&&(*tmp1!=13)&&(*tmp1!=10)) *tmp2++=*tmp1++; } } *tmp2=0;routerset_parse(r2,tmp3,"ExitNodes"); tmpOptions->ExitNodes=r2; if(r1) routerset_free(r1); tor_free(tmp3); }
void add_router_to_favorites(HWND hDlg,char *router,char favtype) { if(hDlgRouterRestrictions) { char *favtmp2,*favtmp3; int favtmpsize; int i; favtmpsize=SendDlgItemMessage(hDlgRouterRestrictions,15101,WM_GETTEXTLENGTH,0,0); favtmp2=tor_malloc(favtmpsize+256+5);favtmp3=favtmp2; GetDlgItemText(hDlgRouterRestrictions,15101,favtmp2,favtmpsize+1);favtmp2+=favtmpsize; if((favtmpsize>2)&&((*(favtmp2-1)!=0x0d)&&(*(favtmp2-1)!=0x0a))) { *favtmp2++=0x0d;*favtmp2++=0x0a;} *favtmp2++='[';*favtmp2++=favtype;*favtmp2++=']';*favtmp2++=32; for(i=0;router[i];i++) *favtmp2++=router[i]; *favtmp2++=13;*favtmp2++=10;*favtmp2++=0; tor_snprintf(favtmp2,100,get_lang_str(LANG_MB_FAV_ADDED),favtmp3+favtmpsize); LangMessageBox(hDlg,favtmp2,LANG_MB_FAVORITES,MB_OK); log(LOG_NOTICE,LD_APP,favtmp2); SetDlgItemText(hDlgRouterRestrictions,15101,favtmp3); refreshFavoriteNodes(); tor_free(favtmp3); } else if(favtype=='X') { char *tmp1=routerset_to_string(tmpOptions->ExitNodes); int i=strlen(tmp1)+256+5; char *tmp2=tor_malloc(i),*tmp3=tor_malloc(256); tor_snprintf(tmp2,i,"%s,%s",tmp1,router); r1=tmpOptions->ExitNodes; r2=routerset_new(); routerset_parse(r2,tmp2,"ExitNodes"); tmpOptions->ExitNodes=r2; if(r1) routerset_free(r1); tor_snprintf(tmp3,256,"[X] %s",router); tor_snprintf(tmp2,100,get_lang_str(LANG_MB_FAV_ADDED),tmp3); LangMessageBox(hDlg,tmp2,LANG_MB_FAVORITES,MB_OK); log(LOG_NOTICE,LD_APP,tmp2); tor_free(tmp1);tor_free(tmp2);tor_free(tmp3); } else if(favtype=='E') { char *tmp1=routerset_to_string(tmpOptions->EntryNodes); int i=strlen(tmp1)+256+5; char *tmp2=tor_malloc(i),*tmp3=tor_malloc(256); tor_snprintf(tmp2,i,"%s,%s",tmp1,router); r1=tmpOptions->EntryNodes; r2=routerset_new(); routerset_parse(r2,tmp2,"EntryNodes"); tmpOptions->EntryNodes=r2; if(r1) routerset_free(r1); tor_snprintf(tmp3,256,"[E] %s",router); tor_snprintf(tmp2,100,get_lang_str(LANG_MB_FAV_ADDED),tmp3); LangMessageBox(hDlg,tmp2,LANG_MB_FAVORITES,MB_OK); log(LOG_NOTICE,LD_APP,tmp2); tor_free(tmp1);tor_free(tmp2);tor_free(tmp3); } }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); (void)arg; NS_MOCK(geoip_is_loaded); NS_MOCK(geoip_get_n_countries); NS_MOCK(geoip_get_country); smartlist_add(set->country_names, tor_strndup("foo", 3)); routerset_refresh_countries(set); tt_ptr_op(set->countries, !=, NULL); tt_int_op(set->n_countries, ==, 2); tt_int_op(CALLED(geoip_is_loaded), ==, 1); tt_int_op(CALLED(geoip_get_n_countries), ==, 1); tt_int_op(CALLED(geoip_get_country), ==, 1); tt_int_op((unsigned int)(*set->countries), ==, 0); done: NS_UNMOCK(geoip_is_loaded); NS_UNMOCK(geoip_get_n_countries); NS_UNMOCK(geoip_get_country); routerset_free(set); }
static void NS(test_main)(void *arg) { routerset_t *a = routerset_new(), *b = routerset_new(); int r; (void)arg; smartlist_add(b->list, tor_strdup("{xx}")); r = routerset_equal(a, b); routerset_free(a); routerset_free(b); tt_int_op(r, ==, 0); done: ; }
static void NS(test_main)(void *arg) { routerset_t *a = routerset_new(), *b = routerset_new(); int r; (void)arg; r = routerset_equal(a, b); routerset_free(a); routerset_free(b); tt_int_op(r, ==, 1); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); smartlist_t *list = smartlist_new(); const char *nickname = "foo"; routerinfo_t ri; node_t mock_node; (void)arg; strmap_set_lc(set->names, nickname, (void *)1); ri.nickname = (char *)nickname; mock_node.rs = NULL; mock_node.ri = &ri; smartlist_add(list, (void *)&mock_node); tt_int_op(smartlist_len(list), !=, 0); routerset_subtract_nodes(list, set); tt_int_op(smartlist_len(list), ==, 0); done: routerset_free(set); smartlist_free(list); }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); smartlist_t *out = smartlist_new(); int r; (void)arg; NS_MOCK(nodelist_get_list); smartlist_add(set->country_names, tor_strdup("{xx}")); NS(mock_smartlist) = smartlist_new(); NS(mock_node).is_running = 0; smartlist_add(NS(mock_smartlist), (void *)&NS(mock_node)); routerset_get_all_nodes(out, set, NULL, 1); r = smartlist_len(out); routerset_free(set); smartlist_free(out); smartlist_free(NS(mock_smartlist)); tt_int_op(r, ==, 0); tt_int_op(CALLED(nodelist_get_list), ==, 1); done: ; }
static void NS(test_main)(void *arg) { smartlist_t *out = smartlist_new(); routerset_t *set = routerset_new(); int out_len; node_t *ent; (void)arg; NS_MOCK(node_get_by_nickname); NS(mock_nickname) = tor_strdup("foo"); smartlist_add(set->list, NS(mock_nickname)); routerset_get_all_nodes(out, set, NULL, 0); out_len = smartlist_len(out); ent = (node_t *)smartlist_get(out, 0); smartlist_free(out); routerset_free(set); tt_int_op(out_len, ==, 1); tt_ptr_op(ent, ==, &NS(mock_node)); tt_int_op(CALLED(node_get_by_nickname), ==, 1); done: ; }
static void NS(test_main)(void *arg) { smartlist_t *out = smartlist_new(); routerset_t *set = routerset_new(); int out_len; (void)arg; NS_MOCK(node_get_by_nickname); NS(mock_node).is_running = 0; NS(mock_nickname) = "foo"; smartlist_add(set->list, tor_strdup(NS(mock_nickname))); routerset_get_all_nodes(out, set, NULL, 1); out_len = smartlist_len(out); smartlist_free(out); routerset_free(set); tt_int_op(out_len, ==, 0); tt_int_op(CALLED(node_get_by_nickname), ==, 1); done: ; }
/* Make sure we never pick an RP if Tor2webRendezvousPoints doesn't * correspond to an actual node. */ static void test_pick_bad_tor2web_rendezvous_node(void *arg) { or_options_t *options = get_options_mutable(); const node_t *chosen_rp = NULL; router_crn_flags_t flags = CRN_NEED_DESC; int retval, i; const char *tor2web_rendezvous_str = "dummy"; (void) arg; /* Setup fake routerlist. */ helper_setup_fake_routerlist(); /* Parse Tor2webRendezvousPoints as a routerset. */ options->Tor2webRendezvousPoints = routerset_new(); retval = routerset_parse(options->Tor2webRendezvousPoints, tor2web_rendezvous_str, "test_tor2web_rp"); tt_int_op(retval, OP_GE, 0); /* Pick rendezvous point. Since Tor2webRendezvousPoints was set to a dummy value, we shouldn't find any eligible RPs. */ for (i = 0; i < 50 ; i++) { chosen_rp = pick_tor2web_rendezvous_node(flags, options); tt_ptr_op(chosen_rp, OP_EQ, NULL); } done: routerset_free(options->Tor2webRendezvousPoints); }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); (void)arg; NS_MOCK(geoip_is_loaded); NS_MOCK(geoip_get_n_countries); NS_MOCK(geoip_get_country); routerset_refresh_countries(set); tt_ptr_op(set->countries, OP_NE, NULL); tt_int_op(set->n_countries, OP_EQ, 1); tt_int_op((unsigned int)(*set->countries), OP_EQ, 0); tt_int_op(CALLED(geoip_is_loaded), OP_EQ, 1); tt_int_op(CALLED(geoip_get_n_countries), OP_EQ, 1); tt_int_op(CALLED(geoip_get_country), OP_EQ, 0); done: NS_UNMOCK(geoip_is_loaded); NS_UNMOCK(geoip_get_n_countries); NS_UNMOCK(geoip_get_country); routerset_free(set); }
/* Make sure we always pick the right RP, given a well formatted * Tor2webRendezvousPoints value. */ static void test_pick_tor2web_rendezvous_node(void *arg) { or_options_t *options = get_options_mutable(); const node_t *chosen_rp = NULL; router_crn_flags_t flags = CRN_NEED_DESC; int retval, i; const char *tor2web_rendezvous_str = "test003r"; (void) arg; /* Setup fake routerlist. */ helper_setup_fake_routerlist(); /* Parse Tor2webRendezvousPoints as a routerset. */ options->Tor2webRendezvousPoints = routerset_new(); retval = routerset_parse(options->Tor2webRendezvousPoints, tor2web_rendezvous_str, "test_tor2web_rp"); tt_int_op(retval, OP_GE, 0); /* Pick rendezvous point. Make sure the correct one is picked. Repeat many times to make sure it works properly. */ for (i = 0; i < 50 ; i++) { chosen_rp = pick_tor2web_rendezvous_node(flags, options); tt_assert(chosen_rp); tt_str_op(chosen_rp->ri->nickname, OP_EQ, tor2web_rendezvous_str); } done: routerset_free(options->Tor2webRendezvousPoints); }
static void test_conn_edge_ap_handshake_rewrite_and_attach_closes_conn_to_port0(void *data) { entry_connection_t *conn = entry_connection_new(CONN_TYPE_AP, AF_INET); addressmap_init(); origin_circuit_t *circuit = NULL; crypt_path_t *path = NULL; (void) data; MOCK(get_options, get_options_mock); MOCK(connection_ap_handshake_rewrite, connection_ap_handshake_rewrite_mock); MOCK(connection_mark_unattached_ap_, connection_mark_unattached_ap_mock); MOCK(node_get_by_nickname, node_get_by_nickname_mock); init_rewrite_mock(); init_mock_options(); init_exit_node_mock(); rewrite_mock->should_close = 0; rewrite_mock->exit_source = ADDRMAPSRC_NONE; SET_SOCKS_ADDRESS(conn->socks_request, "http://www.wellformed.exit"); conn->socks_request->command = SOCKS_COMMAND_CONNECT; options_mock->AllowDotExit = 1; options_mock->ExcludeExitNodes = routerset_new(); options_mock->ExcludeExitNodesUnion_ = routerset_new(); options_mock->SafeLogging_ = SAFELOG_SCRUB_NONE; int prev_log = setup_capture_of_logs(LOG_INFO); int res = connection_ap_handshake_rewrite_and_attach(conn, circuit, path); tt_int_op(unattachment_reason_spy, OP_EQ, END_STREAM_REASON_TORPROTOCOL); tt_int_op(res, OP_EQ, -1); tt_str_op(mock_saved_log_at(-1), OP_EQ, "Excluded relay in exit address 'http://www.exit'. Refusing.\n"); done: UNMOCK(get_options); UNMOCK(connection_ap_handshake_rewrite); UNMOCK(connection_mark_unattached_ap_); UNMOCK(node_get_by_nickname); destroy_mock_options(); destroy_rewrite_mock(); destroy_exit_node_mock(); tor_free(circuit); tor_free(path); teardown_capture_of_logs(prev_log); }
static void NS(test_main)(void *arg) { routerset_t *src = routerset_new(); routerset_t *tgt; (void)arg; tgt = routerset_new(); smartlist_add(src->list, tor_strdup("{xx}")); routerset_union(tgt, src); tt_int_op(smartlist_len(tgt->list), !=, 0); done: routerset_free(src); routerset_free(tgt); }
static void NS(test_main)(void *arg) { routerset_t *set; addr_policy_t *policy; int is_list; (void)arg; /* len(set->country_names) == 0, len(set->policies) == 0 */ set = routerset_new(); is_list = routerset_is_list(set); routerset_free(set); set = NULL; tt_int_op(is_list, !=, 0); /* len(set->country_names) != 0, len(set->policies) == 0 */ set = routerset_new(); smartlist_add(set->country_names, tor_strndup("foo", 3)); is_list = routerset_is_list(set); routerset_free(set); set = NULL; tt_int_op(is_list, ==, 0); /* len(set->country_names) == 0, len(set->policies) != 0 */ set = routerset_new(); policy = tor_malloc_zero(sizeof(addr_policy_t)); smartlist_add(set->policies, (void *)policy); is_list = routerset_is_list(set); routerset_free(set); set = NULL; tt_int_op(is_list, ==, 0); /* len(set->country_names) != 0, len(set->policies) != 0 */ set = routerset_new(); smartlist_add(set->country_names, tor_strndup("foo", 3)); policy = tor_malloc_zero(sizeof(addr_policy_t)); smartlist_add(set->policies, (void *)policy); is_list = routerset_is_list(set); routerset_free(set); set = NULL; tt_int_op(is_list, ==, 0); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = NULL; char *s = NULL; (void)arg; set = NULL; s = routerset_to_string(set); tt_str_op(s, ==, ""); tor_free(s); set = routerset_new(); s = routerset_to_string(set); tt_str_op(s, ==, ""); tor_free(s); routerset_free(set); set = NULL; set = routerset_new(); smartlist_add(set->list, tor_strndup("a", 1)); s = routerset_to_string(set); tt_str_op(s, ==, "a"); tor_free(s); routerset_free(set); set = NULL; set = routerset_new(); smartlist_add(set->list, tor_strndup("a", 1)); smartlist_add(set->list, tor_strndup("b", 1)); s = routerset_to_string(set); tt_str_op(s, ==, "a,b"); tor_free(s); routerset_free(set); set = NULL; done: tor_free(s); routerset_free((routerset_t *)set); }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); const char *s = "_"; int r; (void)arg; r = routerset_parse(set, s, ""); tt_int_op(r, ==, -1); done: routerset_free(set); }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); int contains; (void)arg; strmap_set_lc(set->names, "bar", (void *)1); contains = routerset_contains(set, NULL, 0, "foo", NULL, 0); routerset_free(set); tt_int_op(contains, ==, 0); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); routerset_t **setp = &set; int r; (void)arg; r = routerset_add_unknown_ccs(setp, 1); tt_int_op(r, ==, 0); done: routerset_free(set); }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); int r; (void)arg; NS(mock_node).ri = NULL; NS(mock_node).rs = NULL; r = routerset_contains_node(set, &NS(mock_node)); tt_int_op(r, ==, 0); done: routerset_free(set); }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); int contains; uint8_t bar[20] = { 9, 10, 11, 55 }; (void)arg; digestmap_set(set->digests, (const char*)bar, (void *)1); contains = routerset_contains(set, NULL, 0, NULL, NULL, 0); routerset_free(set); tt_int_op(contains, ==, 0); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); int contains; uint8_t foo[20] = { 2, 3, 4 }; (void)arg; digestmap_set(set->digests, (const char*)foo, (void *)1); contains = routerset_contains(set, NULL, 0, NULL, (const char*)foo, 0); routerset_free(set); tt_int_op(contains, ==, 4); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); char *nickname = NULL; int contains; (void)arg; contains = routerset_contains(set, NULL, 0, nickname, NULL, 0); routerset_free(set); tt_int_op(contains, ==, 0); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); int contains; (void)arg; NS_MOCK(compare_tor_addr_to_addr_policy); contains = routerset_contains(set, NULL, 0, NULL, NULL, 0); routerset_free(set); tt_int_op(contains, ==, 0); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set = routerset_new(); const char *nickname; int contains; (void)arg; nickname = "Foo"; /* This tests the lowercase comparison as well. */ strmap_set_lc(set->names, nickname, (void *)1); contains = routerset_contains(set, NULL, 0, nickname, NULL, 0); routerset_free(set); tt_int_op(contains, ==, 4); done: ; }
static void NS(test_main)(void *arg) { routerset_t *set; const char *s; int r; (void)arg; set = routerset_new(); s = "{cc}"; r = routerset_parse(set, s, ""); tt_int_op(r, ==, 0); tt_int_op(smartlist_len(set->country_names), !=, 0); done: routerset_free(set); }