mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Think of the poor children in Antarctica who still have to work on 4" screens
svn:r16528
This commit is contained in:
parent
0d807068a3
commit
adcea0f332
@ -48,11 +48,15 @@ typedef struct policy_summary_item_t {
|
|||||||
} policy_summary_item_t;
|
} policy_summary_item_t;
|
||||||
|
|
||||||
smartlist_t *policy_summary_create(void);
|
smartlist_t *policy_summary_create(void);
|
||||||
void policy_summary_accept(smartlist_t *summary, uint16_t prt_min, uint16_t prt_max);
|
void policy_summary_accept(smartlist_t *summary,
|
||||||
void policy_summary_reject(smartlist_t *summary, maskbits_t maskbits, uint16_t prt_min, uint16_t prt_max);
|
uint16_t prt_min, uint16_t prt_max);
|
||||||
|
void policy_summary_reject(smartlist_t *summary, maskbits_t maskbits,
|
||||||
|
uint16_t prt_min, uint16_t prt_max);
|
||||||
void policy_summary_add_item(smartlist_t *summary, addr_policy_t *p);
|
void policy_summary_add_item(smartlist_t *summary, addr_policy_t *p);
|
||||||
int policy_summary_split(smartlist_t *summary, uint16_t prt_min, uint16_t prt_max);
|
int policy_summary_split(smartlist_t *summary,
|
||||||
policy_summary_item_t* policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts);
|
uint16_t prt_min, uint16_t prt_max);
|
||||||
|
policy_summary_item_t* policy_summary_item_split(policy_summary_item_t* old,
|
||||||
|
uint16_t new_starts);
|
||||||
|
|
||||||
/** Private networks. This list is used in two places, once to expand the
|
/** Private networks. This list is used in two places, once to expand the
|
||||||
* "private" keyword when parsing our own exit policy, secondly to ignore
|
* "private" keyword when parsing our own exit policy, secondly to ignore
|
||||||
@ -956,7 +960,8 @@ policy_summary_create(void)
|
|||||||
* previously ended.
|
* previously ended.
|
||||||
*/
|
*/
|
||||||
policy_summary_item_t*
|
policy_summary_item_t*
|
||||||
policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts) {
|
policy_summary_item_split(policy_summary_item_t* old, uint16_t new_starts)
|
||||||
|
{
|
||||||
policy_summary_item_t* new;
|
policy_summary_item_t* new;
|
||||||
|
|
||||||
new = tor_malloc_zero(sizeof(policy_summary_item_t));
|
new = tor_malloc_zero(sizeof(policy_summary_item_t));
|
||||||
@ -998,7 +1003,7 @@ policy_summary_split(smartlist_t *summary,
|
|||||||
}
|
}
|
||||||
start_at_index = i;
|
start_at_index = i;
|
||||||
|
|
||||||
while(AT(i)->prt_max < prt_max)
|
while (AT(i)->prt_max < prt_max)
|
||||||
i++;
|
i++;
|
||||||
if (AT(i)->prt_max != prt_max) {
|
if (AT(i)->prt_max != prt_max) {
|
||||||
policy_summary_item_t* new_item;
|
policy_summary_item_t* new_item;
|
||||||
@ -1253,4 +1258,3 @@ policies_free_all(void)
|
|||||||
HT_CLEAR(policy_map, &policy_root);
|
HT_CLEAR(policy_map, &policy_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vim:set et ts=2 shiftwidth=2: */
|
|
||||||
|
@ -3327,7 +3327,8 @@ test_v3_networkstatus(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_policy_summary_helper(const char *policy_str, const char *expected_summary)
|
test_policy_summary_helper(const char *policy_str,
|
||||||
|
const char *expected_summary)
|
||||||
{
|
{
|
||||||
config_line_t line;
|
config_line_t line;
|
||||||
smartlist_t *policy;
|
smartlist_t *policy;
|
||||||
@ -3414,17 +3415,49 @@ test_policies(void)
|
|||||||
|
|
||||||
/* test policy summaries */
|
/* test policy summaries */
|
||||||
/* check if we properly ignore private IP addresses */
|
/* check if we properly ignore private IP addresses */
|
||||||
test_policy_summary_helper("reject 192.168.0.0/16:*,reject 0.0.0.0/8:*,reject 10.0.0.0/8:*,accept *:10-30,accept *:90,reject *:*", "accept 10-30,90");
|
test_policy_summary_helper("reject 192.168.0.0/16:*,"
|
||||||
|
"reject 0.0.0.0/8:*,"
|
||||||
|
"reject 10.0.0.0/8:*,"
|
||||||
|
"accept *:10-30,"
|
||||||
|
"accept *:90,"
|
||||||
|
"reject *:*",
|
||||||
|
"accept 10-30,90");
|
||||||
/* check all accept policies, and proper counting of rejects */
|
/* check all accept policies, and proper counting of rejects */
|
||||||
test_policy_summary_helper("reject 11.0.0.0/9:80, reject 12.0.0.0/9:80, reject 13.0.0.0/9:80, reject 14.0.0.0/9:80, accept *:*", "accept 1-65535");
|
test_policy_summary_helper("reject 11.0.0.0/9:80,"
|
||||||
test_policy_summary_helper("reject 11.0.0.0/9:80, reject 12.0.0.0/9:80, reject 13.0.0.0/9:80, reject 14.0.0.0/9:80, reject 15.0.0.0:81, accept *:*", "accept 1-65535");
|
"reject 12.0.0.0/9:80,"
|
||||||
test_policy_summary_helper("reject 11.0.0.0/9:80, reject 12.0.0.0/9:80, reject 13.0.0.0/9:80, reject 14.0.0.0/9:80, reject 15.0.0.0:80, accept *:*", "reject 80");
|
"reject 13.0.0.0/9:80,"
|
||||||
|
"reject 14.0.0.0/9:80,"
|
||||||
|
"accept *:*", "accept 1-65535");
|
||||||
|
test_policy_summary_helper("reject 11.0.0.0/9:80,"
|
||||||
|
"reject 12.0.0.0/9:80,"
|
||||||
|
"reject 13.0.0.0/9:80,"
|
||||||
|
"reject 14.0.0.0/9:80,"
|
||||||
|
"reject 15.0.0.0:81,"
|
||||||
|
"accept *:*", "accept 1-65535");
|
||||||
|
test_policy_summary_helper("reject 11.0.0.0/9:80,"
|
||||||
|
"reject 12.0.0.0/9:80,"
|
||||||
|
"reject 13.0.0.0/9:80,"
|
||||||
|
"reject 14.0.0.0/9:80,"
|
||||||
|
"reject 15.0.0.0:80,"
|
||||||
|
"accept *:*",
|
||||||
|
"reject 80");
|
||||||
/* no exits */
|
/* no exits */
|
||||||
test_policy_summary_helper("accept 11.0.0.0/9:80, reject *:*", NULL);
|
test_policy_summary_helper("accept 11.0.0.0/9:80,"
|
||||||
|
"reject *:*",
|
||||||
|
NULL);
|
||||||
/* port merging */
|
/* port merging */
|
||||||
test_policy_summary_helper("accept *:80, accept *:81, accept *:100-110, accept *:111, reject *:*", "accept 80-81,100-111");
|
test_policy_summary_helper("accept *:80,"
|
||||||
|
"accept *:81,"
|
||||||
|
"accept *:100-110,"
|
||||||
|
"accept *:111,"
|
||||||
|
"reject *:*",
|
||||||
|
"accept 80-81,100-111");
|
||||||
/* border ports */
|
/* border ports */
|
||||||
test_policy_summary_helper("accept *:1, accept *:3, accept *:65535, reject *:*", "accept 1,3,65535");
|
test_policy_summary_helper("accept *:1,"
|
||||||
|
"accept *:3,"
|
||||||
|
"accept *:65535,"
|
||||||
|
"reject *:*",
|
||||||
|
"accept 1,3,65535");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user