aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-11-22 19:02:42 +0000
committerChristian Grothoff <christian@grothoff.org>2014-11-22 19:02:42 +0000
commitdc82ebded4c48483815fd73d4e33750b73fed496 (patch)
tree6ee4a5398fcb389b3c5e88bd0603253f41182ef6 /src/transport/plugin_transport_tcp.c
parentbdf9207c5a89a0af9c3967c5fd8ff3a66ccebdb6 (diff)
downloadgnunet-dc82ebded4c48483815fd73d4e33750b73fed496.tar.gz
gnunet-dc82ebded4c48483815fd73d4e33750b73fed496.zip
adding support for TCP STEALTH integrity protection
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 501aea15a..7701b540f 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1689,12 +1689,18 @@ tcp_plugin_get_session (void *cls,
1689 } 1689 }
1690 else 1690 else
1691 { 1691 {
1692 if (GNUNET_OK != 1692 if ( (GNUNET_OK !=
1693 GNUNET_NETWORK_socket_setsockopt (s, 1693 GNUNET_NETWORK_socket_setsockopt (s,
1694 IPPROTO_TCP, 1694 IPPROTO_TCP,
1695 SO_TCPSTEALTH, 1695 SO_TCPSTEALTH,
1696 &session->target, 1696 &session->target,
1697 sizeof (struct GNUNET_PeerIdentity))) 1697 sizeof (struct GNUNET_PeerIdentity))) ||
1698 (GNUNET_OK !=
1699 GNUNET_NETWORK_socket_setsockopt (s,
1700 IPPROTO_TCP,
1701 SO_TCPSTEALTH_INTEGRITY,
1702 &plugin->my_welcome,
1703 sizeof (struct WelcomeMessage))) )
1698 { 1704 {
1699 /* TCP STEALTH not supported by kernel */ 1705 /* TCP STEALTH not supported by kernel */
1700 GNUNET_break (GNUNET_OK == 1706 GNUNET_break (GNUNET_OK ==
@@ -2791,14 +2797,22 @@ libgnunet_plugin_transport_tcp_init (void *cls)
2791 lsocks = GNUNET_SERVICE_get_listen_sockets (service); 2797 lsocks = GNUNET_SERVICE_get_listen_sockets (service);
2792 if (NULL != lsocks) 2798 if (NULL != lsocks)
2793 { 2799 {
2800 uint32_t len = sizeof (struct WelcomeMessage);
2801
2794 for (i=0;NULL!=lsocks[i];i++) 2802 for (i=0;NULL!=lsocks[i];i++)
2795 { 2803 {
2796 if (GNUNET_OK != 2804 if ( (GNUNET_OK !=
2797 GNUNET_NETWORK_socket_setsockopt (lsocks[i], 2805 GNUNET_NETWORK_socket_setsockopt (lsocks[i],
2798 IPPROTO_TCP, 2806 IPPROTO_TCP,
2799 SO_TCPSTEALTH, 2807 SO_TCPSTEALTH,
2800 env->my_identity, 2808 env->my_identity,
2801 sizeof (struct GNUNET_PeerIdentity))) 2809 sizeof (struct GNUNET_PeerIdentity))) ||
2810 (GNUNET_OK !=
2811 GNUNET_NETWORK_socket_setsockopt (lsocks[i],
2812 IPPROTO_TCP,
2813 SO_TCPSTEALTH_INTEGRITY_LEN,
2814 &len,
2815 sizeof (len))) )
2802 { 2816 {
2803 /* TCP STEALTH not supported by kernel */ 2817 /* TCP STEALTH not supported by kernel */
2804 GNUNET_assert (0 == i); 2818 GNUNET_assert (0 == i);