Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sergi
Tor
Commits
0127888b
Commit
0127888b
authored
5 years ago
by
Neel Chauhan
Committed by
George Kadianakis
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for IPv6 exit policies on microdescriptors
parent
be4a6094
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/test_microdesc.c
+51
-1
51 additions, 1 deletion
src/test/test_microdesc.c
with
51 additions
and
1 deletion
src/test/test_microdesc.c
+
51
−
1
View file @
0127888b
...
...
@@ -648,6 +648,41 @@ static const char MD_PARSE_TEST_DATA[] =
"ntor-onion-key k2yFqTU2vzMCQDEiE/j9UcEHxKrXMLpB3IL0or09sik=
\n
"
"id rsa1024 2A8wYpHxnkKJ92orocvIQBzeHlE
\n
"
"p6 allow 80
\n
"
/* Good 11: Normal, non-exit relay with ipv6 address */
"onion-key
\n
"
"-----BEGIN RSA PUBLIC KEY-----
\n
"
"MIGJAoGBAM7uUtq5F6h63QNYIvC+4NcWaD0DjtnrOORZMkdpJhinXUOwce3cD5Dj
\n
"
"sgdN1wJpWpTQMXJ2DssfSgmOVXETP7qJuZyRprxalQhaEATMDNJA/66Ml1jSO9mZ
\n
"
"+8Xb7m/4q778lNtkSbsvMaYD2Dq6k2QQ3kMhr9z8oUtX0XA23+pfAgMBAAE=
\n
"
"-----END RSA PUBLIC KEY-----
\n
"
"a [::1:2:3:4]:9090
\n
"
"a 18.0.0.1:9999
\n
"
"ntor-onion-key k2yFqTU2vzMCQDEiE/j9UcEHxKrXMLpB3IL0or09sik=
\n
"
"id rsa1024 2A8wYpHxnkKJ92orocvIQBzeHlE
\n
"
/* Good 12: Normal, exit relay with ipv6 address */
"onion-key
\n
"
"-----BEGIN RSA PUBLIC KEY-----
\n
"
"MIGJAoGBAM7uUtq5F6h63QNYIvC+4NcWaD0DjtnrOORZMkdpJhinXUOwce3cD5Dj
\n
"
"sgdN1wJpWpTQMXJ2DssfSgmOVXETP7qJuZyRprxalQhaEATMDNJA/66Ml1jSO9mZ
\n
"
"+8Xb7m/4q778lNtkSbsvMaYD2Dq6k2QQ3kMhr9z8oUtX0XA23+pfAgMBAAE=
\n
"
"-----END RSA PUBLIC KEY-----
\n
"
"a [::1:2:3:4]:9090
\n
"
"a 18.0.0.1:9999
\n
"
"ntor-onion-key k2yFqTU2vzMCQDEiE/j9UcEHxKrXMLpB3IL0or09sik=
\n
"
"p accept 20-23,43,53,79-81,88,110,143,194,220,389,443,464,531,543-544
\n
"
"id rsa1024 2A8wYpHxnkKJ92orocvIQBzeHlE
\n
"
/* Good 13: Normal, exit relay with only ipv6 exit policy */
"onion-key
\n
"
"-----BEGIN RSA PUBLIC KEY-----
\n
"
"MIGJAoGBAM7uUtq5F6h63QNYIvC+4NcWaD0DjtnrOORZMkdpJhinXUOwce3cD5Dj
\n
"
"sgdN1wJpWpTQMXJ2DssfSgmOVXETP7qJuZyRprxalQhaEATMDNJA/66Ml1jSO9mZ
\n
"
"+8Xb7m/4q778lNtkSbsvMaYD2Dq6k2QQ3kMhr9z8oUtX0XA23+pfAgMBAAE=
\n
"
"-----END RSA PUBLIC KEY-----
\n
"
"a [::1:2:3:4]:9090
\n
"
"a 18.0.0.1:9999
\n
"
"ntor-onion-key k2yFqTU2vzMCQDEiE/j9UcEHxKrXMLpB3IL0or09sik=
\n
"
"p6 accept 20-23,43,53,79-81,88,110,143,194,220,389,443,464,531,543-544
\n
"
"id rsa1024 2A8wYpHxnkKJ92orocvIQBzeHlE
\n
"
;
#ifdef HAVE_CFLAG_WOVERLENGTH_STRINGS
ENABLE_GCC_WARNING
(
overlength
-
strings
)
...
...
@@ -665,7 +700,7 @@ test_md_parse(void *arg)
smartlist_t
*
mds
=
microdescs_parse_from_string
(
MD_PARSE_TEST_DATA
,
NULL
,
1
,
SAVED_NOWHERE
,
invalid
);
tt_int_op
(
smartlist_len
(
mds
),
OP_EQ
,
1
1
);
tt_int_op
(
smartlist_len
(
mds
),
OP_EQ
,
1
4
);
tt_int_op
(
smartlist_len
(
invalid
),
OP_EQ
,
4
);
test_memeq_hex
(
smartlist_get
(
invalid
,
0
),
...
...
@@ -712,6 +747,21 @@ test_md_parse(void *arg)
tt_assert
(
tor_addr_family
(
&
md
->
ipv6_addr
)
==
AF_INET6
);
tt_int_op
(
md
->
ipv6_orport
,
OP_EQ
,
9090
);
md
=
smartlist_get
(
mds
,
11
);
tt_assert
(
tor_addr_family
(
&
md
->
ipv6_addr
)
==
AF_INET6
);
tt_int_op
(
md
->
ipv6_orport
,
OP_EQ
,
9090
);
tt_int_op
(
md
->
policy_is_reject_star
,
OP_EQ
,
1
);
md
=
smartlist_get
(
mds
,
12
);
tt_assert
(
tor_addr_family
(
&
md
->
ipv6_addr
)
==
AF_INET6
);
tt_int_op
(
md
->
ipv6_orport
,
OP_EQ
,
9090
);
tt_int_op
(
md
->
policy_is_reject_star
,
OP_EQ
,
0
);
md
=
smartlist_get
(
mds
,
13
);
tt_assert
(
tor_addr_family
(
&
md
->
ipv6_addr
)
==
AF_INET6
);
tt_int_op
(
md
->
ipv6_orport
,
OP_EQ
,
9090
);
tt_int_op
(
md
->
policy_is_reject_star
,
OP_EQ
,
0
);
done:
SMARTLIST_FOREACH
(
mds
,
microdesc_t
*
,
mdsc
,
microdesc_free
(
mdsc
));
smartlist_free
(
mds
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment