|
@@ -1677,32 +1677,46 @@ get_effective_bwburst(const or_options_t *options)
|
|
|
return (uint32_t)bw;
|
|
|
}
|
|
|
|
|
|
+/* Used in the various options_transition_affects* functions. */
|
|
|
+#define YES_IF_CHANGED_BOOL(opt) \
|
|
|
+ if (!CFG_EQ_BOOL(old_options, new_options, opt)) return 1;
|
|
|
+#define YES_IF_CHANGED_INT(opt) \
|
|
|
+ if (!CFG_EQ_INT(old_options, new_options, opt)) return 1;
|
|
|
+#define YES_IF_CHANGED_STRING(opt) \
|
|
|
+ if (!CFG_EQ_STRING(old_options, new_options, opt)) return 1;
|
|
|
+#define YES_IF_CHANGED_LINELIST(opt) \
|
|
|
+ if (!CFG_EQ_LINELIST(old_options, new_options, opt)) return 1;
|
|
|
+#define YES_IF_CHANGED_SMARTLIST(opt) \
|
|
|
+ if (!CFG_EQ_SMARTLIST(old_options, new_options, opt)) return 1;
|
|
|
+#define YES_IF_CHANGED_ROUTERSET(opt) \
|
|
|
+ if (!CFG_EQ_ROUTERSET(old_options, new_options, opt)) return 1;
|
|
|
+
|
|
|
/**
|
|
|
* Return true if changing the configuration from <b>old</b> to <b>new</b>
|
|
|
- * affects the guard susbsystem.
|
|
|
+ * affects the guard subsystem.
|
|
|
*/
|
|
|
static int
|
|
|
-options_transition_affects_guards(const or_options_t *old,
|
|
|
- const or_options_t *new)
|
|
|
+options_transition_affects_guards(const or_options_t *old_options,
|
|
|
+ const or_options_t *new_options)
|
|
|
{
|
|
|
/* NOTE: Make sure this function stays in sync with
|
|
|
* node_passes_guard_filter */
|
|
|
+ tor_assert(old_options);
|
|
|
+ tor_assert(new_options);
|
|
|
+
|
|
|
+ YES_IF_CHANGED_BOOL(UseEntryGuards);
|
|
|
+ YES_IF_CHANGED_BOOL(UseBridges);
|
|
|
+ YES_IF_CHANGED_BOOL(ClientUseIPv4);
|
|
|
+ YES_IF_CHANGED_BOOL(ClientUseIPv6);
|
|
|
+ YES_IF_CHANGED_BOOL(FascistFirewall);
|
|
|
+ YES_IF_CHANGED_ROUTERSET(ExcludeNodes);
|
|
|
+ YES_IF_CHANGED_ROUTERSET(EntryNodes);
|
|
|
+ YES_IF_CHANGED_SMARTLIST(FirewallPorts);
|
|
|
+ YES_IF_CHANGED_LINELIST(Bridges);
|
|
|
+ YES_IF_CHANGED_LINELIST(ReachableORAddresses);
|
|
|
+ YES_IF_CHANGED_LINELIST(ReachableDirAddresses);
|
|
|
|
|
|
- tor_assert(old);
|
|
|
- tor_assert(new);
|
|
|
-
|
|
|
- return
|
|
|
- (old->UseEntryGuards != new->UseEntryGuards ||
|
|
|
- old->UseBridges != new->UseBridges ||
|
|
|
- old->ClientUseIPv4 != new->ClientUseIPv4 ||
|
|
|
- old->ClientUseIPv6 != new->ClientUseIPv6 ||
|
|
|
- old->FascistFirewall != new->FascistFirewall ||
|
|
|
- !routerset_equal(old->ExcludeNodes, new->ExcludeNodes) ||
|
|
|
- !routerset_equal(old->EntryNodes, new->EntryNodes) ||
|
|
|
- !smartlist_strings_eq(old->FirewallPorts, new->FirewallPorts) ||
|
|
|
- !config_lines_eq(old->Bridges, new->Bridges) ||
|
|
|
- !config_lines_eq(old->ReachableORAddresses, new->ReachableORAddresses) ||
|
|
|
- !config_lines_eq(old->ReachableDirAddresses, new->ReachableDirAddresses));
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
/** Fetch the active option list, and take actions based on it. All of the
|
|
@@ -4712,21 +4726,19 @@ static int
|
|
|
options_transition_affects_workers(const or_options_t *old_options,
|
|
|
const or_options_t *new_options)
|
|
|
{
|
|
|
- if (!opt_streq(old_options->DataDirectory, new_options->DataDirectory) ||
|
|
|
- old_options->NumCPUs != new_options->NumCPUs ||
|
|
|
- !config_lines_eq(old_options->ORPort_lines, new_options->ORPort_lines) ||
|
|
|
- old_options->ServerDNSSearchDomains !=
|
|
|
- new_options->ServerDNSSearchDomains ||
|
|
|
- old_options->SafeLogging_ != new_options->SafeLogging_ ||
|
|
|
- old_options->ClientOnly != new_options->ClientOnly ||
|
|
|
- server_mode(old_options) != server_mode(new_options) ||
|
|
|
- public_server_mode(old_options) != public_server_mode(new_options) ||
|
|
|
- !config_lines_eq(old_options->Logs, new_options->Logs) ||
|
|
|
- old_options->LogMessageDomains != new_options->LogMessageDomains)
|
|
|
+ YES_IF_CHANGED_STRING(DataDirectory);
|
|
|
+ YES_IF_CHANGED_INT(NumCPUs);
|
|
|
+ YES_IF_CHANGED_LINELIST(ORPort_lines);
|
|
|
+ YES_IF_CHANGED_BOOL(ServerDNSSearchDomains);
|
|
|
+ YES_IF_CHANGED_BOOL(SafeLogging_);
|
|
|
+ YES_IF_CHANGED_BOOL(ClientOnly);
|
|
|
+ YES_IF_CHANGED_BOOL(LogMessageDomains);
|
|
|
+ YES_IF_CHANGED_LINELIST(Logs);
|
|
|
+
|
|
|
+ if (server_mode(old_options) != server_mode(new_options) ||
|
|
|
+ public_server_mode(old_options) != public_server_mode(new_options))
|
|
|
return 1;
|
|
|
|
|
|
- /* Check whether log options match. */
|
|
|
-
|
|
|
/* Nothing that changed matters. */
|
|
|
return 0;
|
|
|
}
|
|
@@ -4739,37 +4751,34 @@ options_transition_affects_descriptor(const or_options_t *old_options,
|
|
|
{
|
|
|
/* XXX We can be smarter here. If your DirPort isn't being
|
|
|
* published and you just turned it off, no need to republish. Etc. */
|
|
|
- if (!opt_streq(old_options->DataDirectory, new_options->DataDirectory) ||
|
|
|
- !opt_streq(old_options->Nickname,new_options->Nickname) ||
|
|
|
- !opt_streq(old_options->Address,new_options->Address) ||
|
|
|
- !config_lines_eq(old_options->ExitPolicy,new_options->ExitPolicy) ||
|
|
|
- old_options->ExitRelay != new_options->ExitRelay ||
|
|
|
- old_options->ExitPolicyRejectPrivate !=
|
|
|
- new_options->ExitPolicyRejectPrivate ||
|
|
|
- old_options->ExitPolicyRejectLocalInterfaces !=
|
|
|
- new_options->ExitPolicyRejectLocalInterfaces ||
|
|
|
- old_options->IPv6Exit != new_options->IPv6Exit ||
|
|
|
- !config_lines_eq(old_options->ORPort_lines,
|
|
|
- new_options->ORPort_lines) ||
|
|
|
- !config_lines_eq(old_options->DirPort_lines,
|
|
|
- new_options->DirPort_lines) ||
|
|
|
- old_options->ClientOnly != new_options->ClientOnly ||
|
|
|
- old_options->DisableNetwork != new_options->DisableNetwork ||
|
|
|
- old_options->PublishServerDescriptor_ !=
|
|
|
- new_options->PublishServerDescriptor_ ||
|
|
|
- get_effective_bwrate(old_options) != get_effective_bwrate(new_options) ||
|
|
|
+
|
|
|
+ YES_IF_CHANGED_STRING(DataDirectory);
|
|
|
+ YES_IF_CHANGED_STRING(Nickname);
|
|
|
+ YES_IF_CHANGED_STRING(Address);
|
|
|
+ YES_IF_CHANGED_LINELIST(ExitPolicy);
|
|
|
+ YES_IF_CHANGED_BOOL(ExitRelay);
|
|
|
+ YES_IF_CHANGED_BOOL(ExitPolicyRejectPrivate);
|
|
|
+ YES_IF_CHANGED_BOOL(ExitPolicyRejectLocalInterfaces);
|
|
|
+ YES_IF_CHANGED_BOOL(IPv6Exit);
|
|
|
+ YES_IF_CHANGED_LINELIST(ORPort_lines);
|
|
|
+ YES_IF_CHANGED_LINELIST(DirPort_lines);
|
|
|
+ YES_IF_CHANGED_LINELIST(DirPort_lines);
|
|
|
+ YES_IF_CHANGED_BOOL(ClientOnly);
|
|
|
+ YES_IF_CHANGED_BOOL(DisableNetwork);
|
|
|
+ YES_IF_CHANGED_BOOL(PublishServerDescriptor_);
|
|
|
+ YES_IF_CHANGED_STRING(ContactInfo);
|
|
|
+ YES_IF_CHANGED_STRING(BridgeDistribution);
|
|
|
+ YES_IF_CHANGED_LINELIST(MyFamily);
|
|
|
+ YES_IF_CHANGED_STRING(AccountingStart);
|
|
|
+ YES_IF_CHANGED_INT(AccountingMax);
|
|
|
+ YES_IF_CHANGED_INT(AccountingRule);
|
|
|
+ YES_IF_CHANGED_BOOL(DirCache);
|
|
|
+ YES_IF_CHANGED_BOOL(AssumeReachable);
|
|
|
+
|
|
|
+ if (get_effective_bwrate(old_options) != get_effective_bwrate(new_options) ||
|
|
|
get_effective_bwburst(old_options) !=
|
|
|
get_effective_bwburst(new_options) ||
|
|
|
- !opt_streq(old_options->ContactInfo, new_options->ContactInfo) ||
|
|
|
- !opt_streq(old_options->BridgeDistribution,
|
|
|
- new_options->BridgeDistribution) ||
|
|
|
- !config_lines_eq(old_options->MyFamily, new_options->MyFamily) ||
|
|
|
- !opt_streq(old_options->AccountingStart, new_options->AccountingStart) ||
|
|
|
- old_options->AccountingMax != new_options->AccountingMax ||
|
|
|
- old_options->AccountingRule != new_options->AccountingRule ||
|
|
|
- public_server_mode(old_options) != public_server_mode(new_options) ||
|
|
|
- old_options->DirCache != new_options->DirCache ||
|
|
|
- old_options->AssumeReachable != new_options->AssumeReachable)
|
|
|
+ public_server_mode(old_options) != public_server_mode(new_options))
|
|
|
return 1;
|
|
|
|
|
|
return 0;
|