diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-06-10 15:10:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-06-10 15:10:57 +0000 |
commit | 30ebb14c293181d8aa3c3502526388ec92d3895b (patch) | |
tree | c088efcf3b556713074df6a335acf9ca0572c822 /src/transport/plugin_transport_tcp.c | |
parent | 35a78003b6f9109fc4f4d20468c58f10ddb80ec5 (diff) | |
download | gnunet-30ebb14c293181d8aa3c3502526388ec92d3895b.tar.gz gnunet-30ebb14c293181d8aa3c3502526388ec92d3895b.zip |
refuse connections from self
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index e93985f40..689cb3784 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1810,6 +1810,15 @@ handle_tcp_nat_probe (void *cls, | |||
1810 | if (ntohs(message->size) != sizeof(struct TCP_NAT_ProbeMessage)) | 1810 | if (ntohs(message->size) != sizeof(struct TCP_NAT_ProbeMessage)) |
1811 | { | 1811 | { |
1812 | GNUNET_break_op(0); | 1812 | GNUNET_break_op(0); |
1813 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
1814 | return; | ||
1815 | } | ||
1816 | if (0 == memcmp (&tcp_nat_probe->clientIdentity, | ||
1817 | plugin->env->my_identity, | ||
1818 | sizeof (struct GNUNET_PeerIdentity))) | ||
1819 | { | ||
1820 | /* refuse connections from ourselves */ | ||
1821 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
1813 | return; | 1822 | return; |
1814 | } | 1823 | } |
1815 | tcp_nat_probe = (const struct TCP_NAT_ProbeMessage *)message; | 1824 | tcp_nat_probe = (const struct TCP_NAT_ProbeMessage *)message; |
@@ -1921,7 +1930,15 @@ handle_tcp_welcome (void *cls, | |||
1921 | struct IPv6TcpAddress *t6; | 1930 | struct IPv6TcpAddress *t6; |
1922 | const struct sockaddr_in *s4; | 1931 | const struct sockaddr_in *s4; |
1923 | const struct sockaddr_in6 *s6; | 1932 | const struct sockaddr_in6 *s6; |
1924 | 1933 | ||
1934 | if (0 == memcmp (&wm->clientIdentity, | ||
1935 | plugin->env->my_identity, | ||
1936 | sizeof (struct GNUNET_PeerIdentity))) | ||
1937 | { | ||
1938 | /* refuse connections from ourselves */ | ||
1939 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
1940 | return; | ||
1941 | } | ||
1925 | #if DEBUG_TCP | 1942 | #if DEBUG_TCP |
1926 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 1943 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
1927 | "tcp", | 1944 | "tcp", |