UDP instead of TCP?

47 views
Skip to first unread message

Joe Hillenbrand

unread,
Aug 9, 2011, 1:57:18 PM8/9/11
to phantom-...@googlegroups.com
Hi all,

I've been interested in Phantom for a while, and I am hoping to start tinkering with it soon.

I was talking about Phantom to a bunch of people at DefCon this weekend, and somebody mentioned that it is a common mistake among darknet implementations to use TCP. He suggested that UDP would be the smarter option for communication between nodes in the routing path, though the end-to-end communication should still be TCP. 

The rational is that OK for the path to be lossy, since ethernet and wireless are also lossy and that using UDP could improve throughput. I imagine that this would improve performance among the routing nodes, since they can choose which packets they are able to forward, and it might make them more resistant to DDoS. I also imagine that this would make a high available routing implementation easier.

I was wondering if anyone else has thought about this idea. 

-Joe

Johannes Schlumberger

unread,
Aug 9, 2011, 3:21:52 PM8/9/11
to phantom-...@googlegroups.com
Hi Joe,

> I've been interested in Phantom for a while, and I am hoping to start tinkering
> with it soon.

Thanks for your interest.

> I was talking about Phantom to a bunch of people at DefCon this weekend, and
> somebody mentioned that it is a common mistake among darknet implementations to
> use TCP. He suggested that UDP would be the smarter option�for communication
> between nodes in the routing path, though the end-to-end communication should

> still be TCP.�

I was at defcon, too :-) Did we maybe run into each other at the privacy
presenters party Friday night?

> The rational is that OK for the path to be lossy, since ethernet and wireless
> are also lossy and that using UDP could improve throughput. I imagine that this
> would improve performance among the routing nodes, since they can choose which
> packets they are able to forward, and it might make them more resistant to
> DDoS. I also imagine that this would make a high available routing
> implementation easier.
>
> I was wondering if anyone else has thought about this idea.

I have thought about it and I see the point. However I do not understand the
suggestion for Phantom - user (application) data is never relayed through a
routing path at all - a routing path is only used to construct routing tunnels
as infrastructure - this should not be lossy because then it will fail. The
routing tunnels itself (relaying application data) could be UDP - is that what
you mean? That would be the equivalency of the end to end communication.
Enclosed in this routing tunnel there is the real application connection,
running TCP or UDP - so for routing tunnels we actually end up having the case
of transporting TCP and or UDP over TCP currently which is not very nice.

The reason why the current implementation does it that way is mainly because
libopenssl does not offer UDP support and I used this library for the routing
tunnels. So changing that later on might be a good idea to increase performance.
Johannes

Magnus Bråding

unread,
Aug 9, 2011, 4:05:47 PM8/9/11
to phantom-...@googlegroups.com
Hi Joe,

Welcome to the discussion, and thanks for your interest in Phantom!

Now, please don't be insulted in any way by my replies below, their
"edge" is aimed exclusively at the people who carelessly throw around
the opions you mention having heard here below, without any deeper
understanding, reasoning or further explanation (most of the time based
solely on the single fact that "they heard somewhere that UDP is faster
than TCP"). The reason that I'm a little tired of answering them is that
they, just like you say, are quite common.

But you can never be sure, maybe this time I will get some solid
reasoning back, and in that case no one will be happier than me, so here
we go... :-)


> I was talking about Phantom to a bunch of people at DefCon this weekend,
> and somebody mentioned that it is a common mistake among darknet
> implementations to use TCP.

In my experience, it's an even more common mistake to think that you can
design and implement your own flow-control over UDP that will be faster
than TCP for transfers of static data.


> He suggested that UDP would be the smarter
> option for communication between nodes in the routing path, though the
> end-to-end communication should still be TCP.

Could you then please ask him exactly how it would be more efficient to:

A) Implement your own TCP-to-UDP flow control interface

B) Necessitate the resending and requests-for-resending of packets over
an entire routing path (i.e. multiple hops of devices)

C) Drop packets intentionally instead of just dividing the available
bandwidth between currently active tunnels

than to just let TCP do this _locally_ and automatically between each
node? Also, if you've looked into how the encryption and communication
over Phantom routing paths work, you'd see that order verification and
resendings of packets between nodes (especially over multiple hops)
would be a total nightmare on so many levels.


> The rational is that OK for the path to be lossy, since ethernet and
> wireless are also lossy and that using UDP could improve throughput.

First of all I see the following false premise in this reasoning:
The pure act of using UDP will not improve throughput for transfers of
static data sets.

I also see that the following side-effect is seemingly ignored:
Dropped/reordered packets will be _very_ expensive to correct when
performed on an end-to-end basis in a routing path, and that's even
_without_ taking into account any of the side-effects on anonymity and
communication efficiency that would arise due to
Phantom/anonymity-specific reasons.


> I imagine that this would improve performance among the routing nodes,
> since they can choose which packets they are able to forward

More exactly why would it do that, and how would they know which packets
to choose (since they have no idea about what's in them)?


> and it might make them more resistant to DDoS.

More exactly how would that be?


> I also imagine that this would make a high available routing implementation easier.

High-availability routing paths are problematic mostly due to anonymity
and integrity aspects, not network communication aspects. Not much focus
has been put on this specific area in Phantom so far though, so I'll
refrain to saying too much more than that at this point.


> I was wondering if anyone else has thought about this idea.

Many people have had the same idea (or rather "spinal reflex", due to
the false and widespread notion that UDP would be faster that TCP under
all conditions), yes, but extremely few have been able to actually back
it up with some detailed (and foremost valid) reasoning. Hopefully you
will be the first one though, and in that case I'd be nothing but happy. :-)

On a related note, the traffic connected to the network database may in
some ways be beneficial to use UDP for, but in that case it is rather a
fully intentional trade-off for robustness and increased difficulty of
external identification and blocking of the Phantom traffic as a whole.

Regards,
Magnus

Magnus Bråding

unread,
Aug 9, 2011, 4:29:57 PM8/9/11
to phantom-...@googlegroups.com
> The reason why the current implementation does it that way is mainly because
> libopenssl does not offer UDP support and I used this library for the routing
> tunnels.

I may very well have completely misunderstood something here, but isn't
that what the DTLS support in OpenSSL is?

Or does libopenssl not support the full contents of OpenSSL? Or did I
misunderstand something else?

Regards,
Magnus

Johannes Schlumberger

unread,
Aug 10, 2011, 2:13:47 PM8/10/11
to phantom-...@googlegroups.com

My bad. I never stumbled upon this in the whole libssl documentation during my
implementation (which in my defense is not known to be very extensive). Good to
know, thanks.
regards,
Johannes

JoE

unread,
Aug 10, 2011, 6:28:05 PM8/10/11
to phantom-...@googlegroups.com

I was at defcon, too :-) Did we maybe run into each other at the privacy
presenters party Friday night?

Unfortunately, that wasn't me.  

JoE

unread,
Aug 10, 2011, 6:48:51 PM8/10/11
to phantom-...@googlegroups.com

Now, please don't be insulted in any way by my replies below, their
"edge" is aimed exclusively at the people who carelessly throw around
the opions you mention having heard here below, without any deeper
understanding, reasoning or further explanation (most of the time based
solely on the single fact that "they heard somewhere that UDP is faster
than TCP"). The reason that I'm a little tired of answering them is that
they, just like you say, are quite common.

 I understand. The suggestion was off the cuff anyway, and I probably didn't give a proper explanation of the protocol to the person making the suggestion. 

Could you then please ask him exactly how it would be more efficient to:

A) Implement your own TCP-to-UDP flow control interface

B) Necessitate the resending and requests-for-resending of packets over
an entire routing path (i.e. multiple hops of devices)

C) Drop packets intentionally instead of just dividing the available
bandwidth between currently active tunnels

than to just let TCP do this _locally_ and automatically between each
node? Also, if you've looked into how the encryption and communication
over Phantom routing paths work, you'd see that order verification and
resendings of packets between nodes (especially over multiple hops)
would be a total nightmare on so many levels.

I'm not sure about these, but I see what you mean. I'll forward this to him. 

> The rational is that OK for the path to be lossy, since ethernet and
> wireless are also lossy and that using UDP could improve throughput.

First of all I see the following false premise in this reasoning:
The pure act of using UDP will not improve throughput for transfers of
static data sets.

I also see that the following side-effect is seemingly ignored:
Dropped/reordered packets will be _very_ expensive to correct when
performed on an end-to-end basis in a routing path, and that's even
_without_ taking into account any of the side-effects on anonymity and
communication efficiency that would arise due to
Phantom/anonymity-specific reasons.

I can see how nodes having access to the ordering of packets could compromise anonymity. Definitely not a good idea.  

> I imagine that this would improve performance among the routing nodes,
> since they can choose which packets they are able to forward

More exactly why would it do that, and how would they know which packets
to choose (since they have no idea about what's in them)? 

> and it might make them more resistant to DDoS.

More exactly how would that be?

I was thinking they could just ignore the packets that it cannot handle when there are too many. This idea isn't based on any real understanding. I was just trying to theorize reasons why someone would suggest UDP as a better option.  

On a related note, the traffic connected to the network database may in
some ways be beneficial to use UDP for, but in that case it is rather a
fully intentional trade-off for robustness and increased difficulty of
external identification and blocking of the Phantom traffic as a whole.

I'm not sure what you mean here.  Are you suggesting that TCP would be harder to implement for the network database? How so?

Thanks for your thorough response. This gives me a lot to think about. 

-Joe

Magnus Bråding

unread,
Aug 10, 2011, 9:55:52 PM8/10/11
to phantom-...@googlegroups.com
Hi Joe,

> On a related note, the traffic connected to the network database may in
> some ways be beneficial to use UDP for, but in that case it is rather a
> fully intentional trade-off for robustness and increased difficulty of
> external identification and blocking of the Phantom traffic as a whole.
>
> I'm not sure what you mean here. Are you suggesting that TCP would be
> harder to implement for the network database? How so?

What I mean is that contrary to the other parts of the Phantom protocol
communication, a typical distributed data structure of redundant nature
(e.g. a typical DHT), which is most likely what the final network
database implementation will be based on to some degree, can be quite
optimal for UDP traffic use, since the typical conditions in such a case
would be:

1) Continuous communication with many different "random" peers.
2) Only small amounts of data communicated each time
3) No problems if data would sometimes be dropped, in the typical case
4) No anonymization of generic data transmissions involved

Such a situation may result in an unnecessary overhead for connection
establishment when using TCP/SSL. Probably not enough to be a practical
problem there either though, but theoretically anyway, and that's why I
want to emphasize that in this particular case the use of TCP/SSL is an


intentional trade-off for robustness and increased difficulty of

external protocol identification and blocking, contrary to the rest of
the Phantom protocol communication, where UDP does not make much sense
at all as far as I can tell, neither theoretically nor practically.

Thanks for your interest again anyway, and please keep the questions and
suggestions coming!

Regards,
Magnus

Joe Hillenbrand

unread,
Aug 10, 2011, 10:21:18 PM8/10/11
to phantom-...@googlegroups.com
Ah, that makes perfect sense. Thank you.

2011/8/10 Magnus Bråding <magnus....@fortego.se>

--
You received this message because you are subscribed to the Google Groups "Phantom Protocol" group.
To post to this group, send email to phantom-...@googlegroups.com.
To unsubscribe from this group, send email to phantom-protoc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/phantom-protocol?hl=en.


JoE

unread,
Aug 13, 2011, 2:04:45 PM8/13/11
to phantom-...@googlegroups.com
I got a little bit of clarification. Here is what my friend had to say:

I only roughly understood the nature of the actual wire protocol.  It looks
like SSL node-to-node, with a second SSL stream going on inside for the
end-to-end encryption? If that's the case, then there's only one
communication channel and only one flow of traffic, then having only one tcp
stack is fine.  It's when you have TCP running over TCP, or even just
multiple TCP/UDP connections all running over a single TCP connection that
you start having problems.

I'm not sure if that is true, or not.  If it is - one 'tunneled' connection
to one 'phantom' connection - then please reply back to Magnus stating that
I thought it was more like IPSEC rather than sequential TCP proxies.

If, however, there's multiple connections all over a single TCP connection,
than I'd quite happily expand on the perils of that approach.  I'd want to
be sure that's actually the case before putting pen to paper, though.


I'm not a big fan of all phantom traffic going through a single TCP connection either because it seems to limit phantom's usefulness as a protocol. Part of why I like phantom is that it applications don't need to be modified in order to use the protocol. 

-Joe

Magnus Bråding

unread,
Aug 13, 2011, 8:13:59 PM8/13/11
to phantom-...@googlegroups.com
There is only a single tunneled connection per TCP/SSL connection-chain,
yes, that's correct. I.e. you need not worry about multiple connections
being handled over single TCP connections, so this should calm you down.

Regards,
Magnus

> --
> You received this message because you are subscribed to the Google
> Groups "Phantom Protocol" group.

> To view this discussion on the web visit
> https://groups.google.com/d/msg/phantom-protocol/-/LyCxwzkWNLQJ.

Reply all
Reply to author
Forward
0 new messages