summaryrefslogtreecommitdiff
path: root/src/or/policies.c
AgeCommit message (Collapse)Author
2017-03-15Run the copyright update script.Nick Mathewson
2017-02-15Merge branch 'maint-0.2.9'Nick Mathewson
2017-02-14Fix policies.c instance of the "if (r=(a-b)) return r" patternNick Mathewson
I think this one probably can't underflow, since the input ranges are small. But let's not tempt fate. This patch also replaces the "cmp" functions here with just "eq" functions, since nothing actually checked for anything besides 0 and nonzero. Related to 21278.
2017-02-01Merge branch 'teor_bug21357-v2_029'Nick Mathewson
2017-02-01Scale IPv6 address counts in policy_summary_reject to avoid overflowteor
This disregards anything smaller than an IPv6 /64, and rejects ports that are rejected on an IPv6 /16 or larger. Adjust existing unit tests, and add more to cover exceptional cases. No IPv4 behaviour changes. Fixes bug 21357
2017-02-01Fix IPv6 support in policy_summary_reject and policy_summary_acceptteor
This interim fix results in too many IPv6 rejections. No behaviour change for IPv4 counts, except for overflow fixes that would require 4 billion redundant 0.0.0.0/0 policy entries to trigger. Part of 21357
2017-02-01Refactor policy_summary_reject to prepare for IPv6 changesteor
No behaviour change, apart from non-fatal assertions Part of 21357
2017-02-01Fix write_short_policy usage commentteor
2017-01-27Outbindbindaddress variants for Exit and OR.Nick Mathewson
Allow separation of exit and relay traffic to different source IP addresses (Ticket #17975). Written by Michael Sonntag.
2017-01-13Remove redundant boolean expression from firewall_is_fascist_impl()teor
Let A = UseBridges Let B = ClientUseIPv4 Then firewall_is_fascist_impl expands and simplifies to: B || (!(A || ...) && A) B || (!A && ... && A) B || 0 B
2017-01-13When IPv6 addresses have not been downloaded, use hard-coded address infoteor
The microdesc consensus does not contain any IPv6 addresses. When a client has a microdesc consensus but no microdescriptor, make it use the hard-coded IPv6 address for the node (if available). (Hard-coded addresses can come from authorities, fallback directories, or configured bridges.) If there is no hard-coded address, log a BUG message, and fail the connection attempt. (All existing code checks for a hard-coded address before choosing a node address.) Fixes 20996, fix on b167e82 from 19608 in 0.2.8.5-alpha.
2016-12-16Make fascist_firewall_use_ipv6() check ORPort & DirPort IP preferencesteor
This makes clients try harder to find an IPv6 address when searching for a directory server. Required for #19608.
2016-11-08Merge branch 'maint-0.2.9'Nick Mathewson
2016-10-31policy_is_reject_star():Nick Mathewson
ome policies are default-reject, some default-accept. But policy_is_reject_star() assumed they were all default_reject. Fix that! Also, document that policy_is_reject_star() treats a NULL policy as empty. This allows us to simplify the checks in parse_reachable_addresses() by quite a bit. Fxes bug 20306; bugfix on 0.2.8.2-alpha.
2016-10-27Automated change to use smartlist_add_strdupovercaffeinated
Use the following coccinelle script to change uses of smartlist_add(sl, tor_strdup(str)) to smartlist_add_strdup(sl, string) (coccinelle script from nickm via bug 20048): @@ expression a; expression b; @@ - smartlist_add + smartlist_add_strdup (a, - tor_strdup( b - ) )
2016-10-24Module-document dnsserv.c, policies.c, routerkeys.cNick Mathewson
2016-09-05Vote Exit correctly with DirAllowPrivateAddresses setSebastian Hahn
When allowing private addresses, mark Exits that only exit to private locations as such. Fixes bug 20064; bugfix on 0.2.2.9-alpha.
2016-07-28Fix a huge pile of -Wshadow warnings.Nick Mathewson
These appeared on some of the Jenkins platforms. Apparently some GCCs care when you shadow globals, and some don't.
2016-07-17Keep make check-spaces happyAndrea Shepard
2016-07-06Merge branch 'maint-0.2.8'Nick Mathewson
2016-07-06When checking if a routerstatus is reachable, don't check the nodeteor (Tim Wilson-Brown)
This fixes #19608, allowing IPv6-only clients to use microdescriptors, while preserving the ability of bridge clients to have some IPv4 bridges and some IPv6 bridges. Fix on c281c036 in 0.2.8.2-alpha.
2016-07-05Merge remote-tracking branch 'teor/bug18456'Nick Mathewson
2016-07-05Grammar.Nick Mathewson
I grepped and hand-inspected the "it's" instances, to see if any were supposed to be possessive. While doing that, I found a "the the", so I grepped to see if there were any more.
2016-07-01Avoid disclosing exit IP addresses in exit policies by defaultteor (Tim Wilson-Brown)
From 0.2.7.2-alpha onwards, Exits would reject all the IP addresses they knew about in their exit policy. But this may have disclosed addresses that were otherwise unlisted. Now, only advertised addresses are rejected by default by ExitPolicyRejectPrivate. All known addresses are only rejected when ExitPolicyRejectLocalInterfaces is explicitly set to 1.
2016-04-14Add new tor_assert_nonfatal*() macros.Nick Mathewson
Unlike tor_assert(), these macros don't abort the process. They're good for checking conditions we want to warn about, but which don't warrant a full crash. This commit also changes the default implementation for tor_fragile_assert() to tor_assert_nonfatal_unreached_once(). Closes ticket 18613.
2016-02-27Update the copyright year.Nick Mathewson
2016-02-20If both IPv4 and IPv6 addresses could be used, choose one correctlyteor (Tim Wilson-Brown)
If there is a node, use node_ipv6_or/dir_preferred(). If there is no node, use fascist_firewall_prefer_ipv6_or/dirport().
2016-02-20Refactor IPV6_OR_LOOKUP into fascist_firewall_choose_address_rsteor (Tim Wilson-Brown)
It's only used once now, so having it as a macro is unhelpful.
2016-02-20Make some fascist_firewall_choose_address* functions staticteor (Tim Wilson-Brown)
2016-02-20Refactor fascist_firewall_allows_address without changing behaviourteor (Tim Wilson-Brown)
2016-02-20Ensure relays must use IPv4, and can use IPv6teor (Tim Wilson-Brown)
A mistake in previous refactoring had relays using IPv4 and IPv6.
2016-02-11Fix all doxygen warnings other than "X is not documented"Nick Mathewson
2016-02-11make check-spacesNick Mathewson
2016-02-11Merge remote-tracking branch 'teor/feature17840-v11-merged-v2'Nick Mathewson
2016-02-03Make bridge clients prefer the configured bridge addressteor (Tim Wilson-Brown)
When ClientPreferIPv6ORPort is auto, bridges prefer the configured bridge ORPort address. Otherwise, they use the value of the option. Other clients prefer IPv4 ORPorts if ClientPreferIPv6ORPort is auto. When ClientPreferIPv6DirPort is auto, all clients prefer IPv4 DirPorts.
2016-01-29Automatically use IPv6 when ClientUseIPv4 is 0teor (Tim Wilson-Brown)
Consequential changes to log messages: * it's no longer possible to disable both IPv4 and IPv6, * refactor common string out of remaining log messages
2016-01-29Optimise reachability checks when iterating through relay liststeor (Tim Wilson-Brown)
Skip address checks on servers. Skip allowed-only address checks on non-bridge clients with IPv4.
2016-01-29Add firewall_is_fascist_dir()teor (Tim Wilson-Brown)
Refactor common parts of firewall_is_fascist_or().
2016-01-29Use fascist firewall and ClientUseIPv4 for bridge clientsteor (Tim Wilson-Brown)
Bridge clients ignore ClientUseIPv6, acting as if it is always 1. This preserves existing behaviour. Make ClientPreferIPv6OR/DirPort auto by default: * Bridge clients prefer IPv6 by default. * Other clients prefer IPv4 by default. This preserves existing behaviour.
2016-01-29Add ClientUseIPv4 and ClientPreferIPv6DirPort torrc optionsteor (Tim Wilson-Brown)
ClientUseIPv4 0 tells tor to avoid IPv4 client connections. ClientPreferIPv6DirPort 1 tells tor to prefer IPv6 directory connections. Refactor policy for IPv4/IPv6 preferences. Fix a bug where node->ipv6_preferred could become stale if ClientPreferIPv6ORPort was changed after the consensus was loaded. Update documentation, existing code, add unit tests.
2016-01-27Correct further grammatical errors in tor commentsNick Mathewson
Avoid using a pronoun where it makes comments unclear. Avoid using gender for things that don't have it. Avoid assigning gender to people unnecessarily.
2015-12-16Warn when comparing against an AF_UNSPEC address in a policyteor (Tim Wilson-Brown)
It produces unexpected results, and it's most likely a bug.
2015-12-15Replace usage of INLINE with inlinecypherpunks
This patch was generated using; sed -i -e "s/\bINLINE\b/inline/" src/*/*.[ch] src/*/*/*.[ch]
2015-12-09Merge remote-tracking branch 'teor/fix-exitpolicy-leak'Nick Mathewson
2015-12-09Merge branch 'refactor-effective-entry'Nick Mathewson
2015-12-09Tweak policies_log_first_redundant_entry even moreNick Mathewson
* Use smartlist_foreach_begin/end instead of a plain for loop. * constify the pointers.
2015-12-09Tweak policies_log_first_redundant_entry more.Nick Mathewson
* Since the variable is no longer modified, it should be called 'policy' instead of 'dest'. ("Dest" is short for "destination".) * Fixed the space issue that dgoulet found on the ticket. * Fixed the comment a little. (We use the imperative for function documentation.)
2015-12-08Merge branch 'maint-0.2.7'Nick Mathewson
2015-12-08Format IPv6 policies correctly.Nick Mathewson
Previously we'd suppressed the mask-bits field in the output when formatting a policy if it was >=32. But that should be a >=128 if we're talking about IPv6. Since we didn't put these in descriptors, this bug affects only log messages and controller outputs. Fix for bug 16056. The code in question was new in 0.2.0, but the bug was introduced in 0.2.4 when we started supporting IPv6 exits.
2015-12-07Consistently ignore multicast in internal reject private exit policiesteor (Tim Wilson-Brown)
Consistently ignore multicast addresses when automatically generating reject private exit policies. Closes ticket 17763. Bug fix on 10a6390deb3c9, not in any released version of Tor. Patch by "teor".