Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ZerXes
Tor
Commits
9e30ac28
Commit
9e30ac28
authored
Oct 07, 2003
by
Roger Dingledine
Browse files
obey exit policies for addresses too
svn:r555
parent
686fce45
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/or/or.h
View file @
9e30ac28
...
...
@@ -421,6 +421,7 @@ typedef struct {
char
*
RouterFile
;
char
*
Nickname
;
char
*
Address
;
char
*
ExitPolicy
;
double
CoinWeight
;
int
Daemon
;
int
ORPort
;
...
...
src/or/routers.c
View file @
9e30ac28
...
...
@@ -1038,6 +1038,7 @@ policy_read_failed:
*/
int
router_compare_to_exit_policy
(
connection_t
*
conn
)
{
struct
exit_policy_t
*
tmpe
;
struct
in_addr
in
;
assert
(
desc_routerinfo
);
...
...
@@ -1045,10 +1046,14 @@ int router_compare_to_exit_policy(connection_t *conn) {
assert
(
tmpe
->
address
);
assert
(
tmpe
->
port
);
/* Totally ignore the address field of the exit policy, for now. */
if
(
!
strcmp
(
tmpe
->
port
,
"*"
)
||
atoi
(
tmpe
->
port
)
==
conn
->
port
)
{
log_fn
(
LOG_INFO
,
"Port '%s' matches '%d'. %s."
,
if
(
inet_aton
(
tmpe
->
address
,
&
in
)
==
0
)
{
/* malformed IP. reject. */
log_fn
(
LOG_WARNING
,
"Malformed IP %s in exit policy. Rejecting."
,
tmpe
->
address
);
return
-
1
;
}
if
(
conn
->
addr
==
ntohl
(
in
.
s_addr
)
&&
(
!
strcmp
(
tmpe
->
port
,
"*"
)
||
atoi
(
tmpe
->
port
)
==
conn
->
port
))
{
log_fn
(
LOG_INFO
,
"Address '%s' matches '%s' and port '%s' matches '%d'. %s."
,
tmpe
->
address
,
conn
->
address
,
tmpe
->
port
,
conn
->
port
,
tmpe
->
policy_type
==
EXIT_POLICY_ACCEPT
?
"Accepting"
:
"Rejecting"
);
if
(
tmpe
->
policy_type
==
EXIT_POLICY_ACCEPT
)
...
...
@@ -1057,7 +1062,6 @@ int router_compare_to_exit_policy(connection_t *conn) {
return
-
1
;
}
}
return
0
;
/* accept all by default. */
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment