Commit Graph

14919 Commits

Author SHA1 Message Date
Linus Nordberg
c06c80b7f7 Fix warnings.
Remove environ declaration.
Use ORPort->value.  And it's a string.
Make tmp a char *.
2011-12-01 09:40:47 +01:00
Nick Mathewson
d106caaadc Add an initializer to appease older gcc 2011-11-30 18:08:07 -05:00
Murdoch@cl.cam.ac.uk
b0d3c6a878 Only define set_buffer_lengths_to_zero if bufferevents are enabled
Otherwise, on Windows, gcc will warn about the function being unused
2011-11-30 18:06:55 -05:00
Nick Mathewson
0530e80e5d Merge remote-tracking branch 'sjmurdoch/bug1983-port-tor-fw-helper-to-windows' 2011-11-30 17:51:01 -05:00
Steven Murdoch
a65212e371 Make file descriptor type an unsigned integer
This avoids a warning from gcc (comparison between signed and unsigned
integer expressions [-Werror=sign-compare]), under Windows
2011-11-30 22:04:14 +00:00
Nick Mathewson
d04f21bf39 Merge branch 'feature2553-v4-rebased' 2011-11-30 14:54:33 -05:00
Arturo Filastò
db648fe886 Add some more documentation 2011-11-30 14:54:15 -05:00
Arturo Filastò
6db69d9d61 Add support for tor2web mode via configure 2011-11-30 14:54:15 -05:00
Robert Ransom
c90c33fd53 Turn off LearnCircuitBuildTimeout when tor2web mode is on 2011-11-30 14:54:15 -05:00
Robert Ransom
328c9582a9 Add ifdefs to disable assertion in connection_ap_handshake_send_begin 2011-11-30 14:54:15 -05:00
Robert Ransom
a364f88477 Add ifdefs to disable #3332 assertions 2011-11-30 14:54:15 -05:00
Robert Ransom
826f1d5b0a Use single-hop intro and rend circuits when in tor2web mode 2011-11-30 14:54:15 -05:00
Robert Ransom
29287ed0ed Perform single-hop HS desc fetches when in tor2web mode 2011-11-30 14:54:15 -05:00
Robert Ransom
ebf524b48b Don't allow tor2web-mode Tors to connect to non-HS addresses
The client's anonymity when accessing a non-HS address in tor2web-mode
would be easily nuked by inserting an inline image with a .onion URL, so
don't even pretend to access non-HS addresses through Tor.
2011-11-30 14:54:15 -05:00
Robert Ransom
5f3e6eb0b9 Warn loudly on startup and SIGHUP if Tor is built for a non-anonymous mode 2011-11-30 14:54:14 -05:00
Robert Ransom
543a36a55b Add a compile-time #define to control whether Tor runs in 'tor2web mode'
The Tor2webMode torrc option is still required to run a Tor client in
'tor2web mode', but now it can't be turned on at runtime in a normal build
of Tor.  (And a tor2web build of Tor can't be used as a normal Tor client,
so we don't have to worry as much about someone distributing packages with
this particular pistol accessible to normal users.)
2011-11-30 14:54:14 -05:00
Steven Murdoch
5dbfb1b3e0 Support NAT-PMP on Windows
- Link in libws32 and libiphlpapi, needed for libnatpmp (both in
  ./configure and when compiling tor-fw-helper-natpmp.c)
- Define STATICLIB under Windows, to allow tor-fw-helper-natpmp.c to link
- Don't include arpa/inet.h which isn't present in Mingw32 and doesn't
  appear to be needed on either Windows or MacOS X
2011-11-30 19:46:38 +00:00
Nick Mathewson
3b88b63826 Merge branch 'bug933_nm_rebased_v2'
Conflicts:
	src/test/test.c
2011-11-30 14:10:22 -05:00
Nick Mathewson
e8d598c4ac Tweak addressmap_rewrite a little more
This resolves a loop warning on "MapAddress *.example.com
example.com", makes the rewrite log messages correct, and fixes the
behavior of "MapAddress *.a *.b" when just given "a" as an input.
2011-11-30 14:08:11 -05:00
Nick Mathewson
66859e2d4a Fix an issue in my mapaddress domains code spotted by arma
MapAddress *.torproject.org torproject.org would have been interpreted
as a map from a domain to itself, and would have cleared the mapping.
Now we require not only a match of domains, but of wildcards.
2011-11-30 14:08:11 -05:00
Nick Mathewson
04c622d720 Add some post-comma spaces to please arma
Incidentally, we've got 30969 lines in master with a comma
in them, of which 1995 have a comma followed by a non-newline,
non-space character.  So about 93% of our commas are right,
but we have a substantial number of "crowded" lines.
2011-11-30 14:08:11 -05:00
Nick Mathewson
00ecc22126 Revise MapAddress manpage
make the asciidoc work; make the example more generic; tighten the
prose a little; be more specific that *.example.com matches
example.com; simplify an example.
2011-11-30 14:08:11 -05:00
Nick Mathewson
ff3eb8e023 Forbid remapping of *
It might be nice to support this someday, but for now it would fail
with an infinite remap cycle.  (If I say "remap * *.foo.exit",
then example.com ->
     example.com.foo.exit ->
     example.com.foo.exit.foo.exit ->
     example.com.foo.exit.foo.exit.foo.exit -> ...)
2011-11-30 14:08:11 -05:00
Nick Mathewson
69d16900aa Refactor addressmap_match_superdomains and representation of wildcards
In this new representation for wildcarded addresses, there are no
longer any 'magic addresses': rather, "a.b c.d", "*.a.b c.d" and
"*.a.b *.c.d" are all represented by a mapping from "a.b" to "c.d". we
now distinguish them by setting bits in the addressmap_entry_t
structure, where src_wildcard is set if the source address had a
wildcard, and dst_wildcard is set if the target address had a
wildcard.

This lets the case where "*.a.b *.c.d" or "*.a.b c.d" remap the
address "a.b" get handled trivially, and lets us simplify and improve
the addressmap_match_superdomains implementation: we can now have it
run in O(parts of address) rather than O(entries in addressmap).
2011-11-30 14:08:11 -05:00
Nick Mathewson
df0da3991c No new "LEGACY" tests allowed. 2011-11-30 14:08:10 -05:00
Nick Mathewson
54d262a728 Fix compilation: get_options() now returns const 2011-11-30 14:08:10 -05:00
Robert Hogan
53ce6bb52d Address nickm's comments at https://trac.torproject.org/projects/tor/ticket/933#comment:8
1. Only allow '*.' in MapAddress expressions. Ignore '*ample.com' and '.example.com'.
       This has resulted in a slight refactoring of config_register_addressmaps.
    2. Add some more detail to the man page entry for AddressMap.
    3. Fix initialization of a pointer to NULL rather than 0.
    4. Update the unit tests to cater for the changes in 1 and test more explicitly for
       recursive mapping.
2011-11-30 14:08:10 -05:00
Robert Hogan
909e9769ec Address nickm's comments at https://trac.torproject.org/projects/tor/ticket/933#comment:4
1. Implement the following mapping rules:

   MapAddress a.b.c d.e.f # This is what we have now
   MapAddress .a.b.c d.e.f # Replaces any address ending with .a.b.c with d.e.f
   MapAddress .a.b.c .d.e.f # Replaces the .a.b.c at the end of any addr with .d.e.f

   (Note that 'a.b.c .d.e.f' is invalid, and will be rejected.)

2. Add tests for the new rules.

3. Allow proper wildcard annotation, i.e. '*.d.e' '.d.e' will still work.

4. Update addressmap_entry_t with an is_wildcard member.
2011-11-30 14:08:10 -05:00
Robert Hogan
c6d8c6baaa bug933 - Match against super-domains in MapAddress
Allow MapAddress to handle directives such as:

MapAddress .torproject.org .torserver.exit
MapAddress .org 1.1.1.1

Add tests for addressmap_rewrite.
2011-11-30 14:08:10 -05:00
Nick Mathewson
60b41cd435 Merge branch 'bug4538_v2' 2011-11-30 13:18:56 -05:00
George Kadianakis
02708b7d80 Free the global DH parameters in crypto_global_cleanup(). 2011-11-30 13:17:47 -05:00
George Kadianakis
a708e85236 Move crypto_global_cleanup() to the bottom of crypto.c. 2011-11-30 13:17:39 -05:00
Nick Mathewson
29db095a35 Merge remote-tracking branch 'origin/maint-0.2.2' 2011-11-30 12:41:08 -05:00
Nick Mathewson
9da99b4939 Fix a memory leak in error path of my default-torrc code
Fixes Coverity CID # 500
2011-11-30 12:16:39 -05:00
Nick Mathewson
e83862a0ff Resolve a resource leak in test_util_split_lines
Fixes coverity CID # 488
2011-11-30 12:16:08 -05:00
Nick Mathewson
c5e2bfa983 appease "make check-spaces" 2011-11-30 12:09:53 -05:00
Nick Mathewson
8cc8b016c8 Merge branch 'ipv6_bridges_squashed' 2011-11-30 12:02:13 -05:00
Nick Mathewson
5412b3728c Rename one more recalcitrant function. 2011-11-30 12:01:16 -05:00
Linus Nordberg
192de441e0 Add changes file. 2011-11-30 11:55:46 -05:00
Linus Nordberg
1dca559db8 Warn user about client ignoring non-preferred IP address for a bridge. 2011-11-30 11:55:46 -05:00
Linus Nordberg
32d10bdfb3 Whitespace changes. 2011-11-30 11:55:46 -05:00
Linus Nordberg
39ec781b8f Make the router_get_*_orport interface consistent with node_*. 2011-11-30 11:55:46 -05:00
Linus Nordberg
3b51b326e4 Make router_get_{prim,alt,pref}_addr_port take tor_addr_port_t *.
Rename to *_orport for consistency with node_*.
2011-11-30 11:55:46 -05:00
Linus Nordberg
2376a6ade4 Merge node_get_{prim,pref,pref_ipv6}_addr with their _orport counterparts.
This keeps the IP address and TCP for a given OR port together,
reducing the risk of using an address for one address family with a
port of another.

Make node_get_addr() a wrapper function for compatibility.
2011-11-30 11:55:46 -05:00
Linus Nordberg
529820f8ba Use correct address family where necessary for bridges on IPv6. 2011-11-30 11:55:46 -05:00
Linus Nordberg
f89c619679 Use the preferred address and port when initiating a connection.
This is not as conservative as we could do it, f.ex. by looking at the
connection and only do this for connections to bridges.  A non-bridge
should never have anything else than its primary IPv4 address set
though, so I think this is safe.
2011-11-30 11:55:46 -05:00
Linus Nordberg
f6ce9e4ea5 Take IPv6 into account when rewriting routerinfo for a bridge and maintain ipv6_preferred.
Don't touch the string representation in routerinfo_t->address.

Also, set or clear the routerinfo_t->ipv6_preferred flag based on the
address family of the bridge.
2011-11-30 11:55:45 -05:00
Linus Nordberg
6048f01971 Use preferred address when looking for bridges by routerinfo_t.
This should be safe to do for all uses of get_configured_bridge_by_routerinfo().
2011-11-30 11:55:45 -05:00
Linus Nordberg
7b02d1a73e Clarify function documentation. 2011-11-30 11:55:45 -05:00
Linus Nordberg
f786307ab7 First chunk of support for bridges on IPv6
Comments below focus on changes, see diff for added code.

New type tor_addr_port_t holding an IP address and a TCP/UDP port.

New flag in routerinfo_t, ipv6_preferred.  This should go in the
node_t instead but not now.

Replace node_get_addr() with
- node_get_prim_addr() for primary address, i.e. IPv4 for now
- node_get_pref_addr() for preferred address, IPv4 or IPv6.

Rename node_get_addr_ipv4h() node_get_prim_addr_ipv4h() for
consistency.  The primary address will not allways be an IPv4 address.
Same for node_get_orport() -> node_get_prim_orport().

Rewrite node_is_a_configured_bridge() to take all OR ports into account.

Extend argument list to extend_info_from_node and
extend_info_from_router with a flag indicating if we want to use the
routers primary address or the preferred address.  Use the preferred
address in as few situtations as possible for allowing clients to
connect to bridges over IPv6.
2011-11-30 11:55:45 -05:00