[or-cvs] go back to a single exitpolicy parameter
Roger Dingledine
arma at seul.org
Wed Feb 18 07:23:38 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
config.c or.h router.c
Log Message:
go back to a single exitpolicy parameter
if your exitpolicy includes " *:*" then it is final,
else we append the default exit policy.
(thanks weasel)
Index: config.c
===================================================================
RCS file: /home/or/cvsroot/src/or/config.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- config.c 18 Feb 2004 04:02:05 -0000 1.81
+++ config.c 18 Feb 2004 07:23:35 -0000 1.82
@@ -165,7 +165,6 @@
config_compare(list, "ExitNodes", CONFIG_TYPE_STRING, &options->ExitNodes) ||
config_compare(list, "EntryNodes", CONFIG_TYPE_STRING, &options->EntryNodes) ||
config_compare(list, "ExitPolicy", CONFIG_TYPE_STRING, &options->ExitPolicy) ||
- config_compare(list, "ExitPolicyPrepend",CONFIG_TYPE_STRING, &options->ExitPolicyPrepend) ||
config_compare(list, "ExcludedNodes", CONFIG_TYPE_STRING, &options->ExcludedNodes) ||
config_compare(list, "Group", CONFIG_TYPE_STRING, &options->Group) ||
@@ -244,7 +243,6 @@
tor_free(options->EntryNodes);
tor_free(options->ExcludedNodes);
tor_free(options->ExitPolicy);
- tor_free(options->ExitPolicyPrepend);
tor_free(options->SocksBindAddress);
tor_free(options->ORBindAddress);
tor_free(options->DirBindAddress);
@@ -260,8 +258,7 @@
options->ExitNodes = tor_strdup("");
options->EntryNodes = tor_strdup("");
options->ExcludedNodes = tor_strdup("");
- options->ExitPolicy = tor_strdup("reject 0.0.0.0/8,reject 169.254.0.0/16,reject 127.0.0.0/8,reject 192.168.0.0/16,reject 10.0.0.0/8,reject 172.16.0.0/12,accept *:20-22,accept *:53,accept *:79-80,accept *:110,accept *:143,accept *:443,accept *:873,accept *:993,accept *:995,accept *:1024-65535,reject *:*");
- options->ExitPolicyPrepend = tor_strdup("");
+ options->ExitPolicy = tor_strdup("");
options->SocksBindAddress = tor_strdup("127.0.0.1");
options->ORBindAddress = tor_strdup("0.0.0.0");
options->DirBindAddress = tor_strdup("0.0.0.0");
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -d -r1.224 -r1.225
--- or.h 18 Feb 2004 03:56:10 -0000 1.224
+++ or.h 18 Feb 2004 07:23:35 -0000 1.225
@@ -497,7 +497,6 @@
char *EntryNodes;
char *ExcludedNodes;
char *ExitPolicy;
- char *ExitPolicyPrepend;
char *SocksBindAddress;
char *ORBindAddress;
char *DirBindAddress;
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- router.c 18 Feb 2004 03:56:10 -0000 1.11
+++ router.c 18 Feb 2004 07:23:35 -0000 1.12
@@ -286,9 +286,15 @@
}
}
+#define DefaultExitPolicy "reject 0.0.0.0/8,reject 169.254.0.0/16,reject 127.0.0.0/8,reject 192.168.0.0/16,reject 10.0.0.0/8,reject 172.16.0.0/12,accept *:20-22,accept *:53,accept *:79-80,accept *:110,accept *:143,accept *:443,accept *:873,accept *:993,accept *:995,accept *:1024-65535,reject *:*"
+
static void router_add_exit_policy_from_config(routerinfo_t *router) {
- router_add_exit_policy_from_config_helper(options.ExitPolicyPrepend, router);
router_add_exit_policy_from_config_helper(options.ExitPolicy, router);
+ if(strstr(options.ExitPolicy," *:*") == NULL) {
+ /* if exitpolicy includes a *:* line, then we're done. Else, append
+ * the default exitpolicy. */
+ router_add_exit_policy_from_config_helper(DefaultExitPolicy, router);
+ }
}
/* Return false if my exit policy says to allow connection to conn.
More information about the tor-commits
mailing list