[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34397 - in gnunet-gtk: contrib src/setup
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34397 - in gnunet-gtk: contrib src/setup |
Date: |
Sun, 2 Nov 2014 22:25:42 +0100 |
Author: grothoff
Date: 2014-11-02 22:25:42 +0100 (Sun, 02 Nov 2014)
New Revision: 34397
Modified:
gnunet-gtk/contrib/gnunet_setup_main_window.glade
gnunet-gtk/src/setup/gnunet-setup-options.c
Log:
adding TCP_STEALTH option to configuration
Modified: gnunet-gtk/contrib/gnunet_setup_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_setup_main_window.glade 2014-11-02 20:54:51 UTC
(rev 34396)
+++ gnunet-gtk/contrib/gnunet_setup_main_window.glade 2014-11-02 21:25:42 UTC
(rev 34397)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkAdjustment" id="GNUNET_setup_bandwidth_in_adjustment">
@@ -1956,6 +1956,24 @@
</packing>
</child>
<child>
+ <object class="GtkCheckButton"
id="GNUNET_setup_transport_tcp_stealth_checkbutton">
+ <property name="label"
translatable="yes">Use TCP Stealth (requires kernel support)</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="tooltip_text"
translatable="yes">Use this option to make your TCP server "stealthy", that is
"invisible" (or at least much less visible) to port scanners. This requires
kernel support and may not be available on all operating systems. Note that if
you use this option, only clients that also support TCP Stealth (on their
operating system) will be able to connect to you. You do not need to check this
box to enable TCP Stealth client-side.</property>
+ <property name="xalign">0</property>
+ <property
name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">5</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHBox"
id="GNUNET_setup_transport_tcp_test_hbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -2028,7 +2046,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">5</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
Modified: gnunet-gtk/src/setup/gnunet-setup-options.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-options.c 2014-11-02 20:54:51 UTC (rev
34396)
+++ gnunet-gtk/src/setup/gnunet-setup-options.c 2014-11-02 21:25:42 UTC (rev
34397)
@@ -91,7 +91,7 @@
GtkToggleButton *button;
button = GTK_TOGGLE_BUTTON (widget);
- if (button == NULL)
+ if (NULL == button)
return GNUNET_SYSERR;
gtk_toggle_button_set_active (button,
(0 ==
@@ -101,6 +101,85 @@
/**
+ * Initialize 'tcp_stealth' toggle button based on an options 'yes/no' value,
+ * make the widget sensitive if the platform supports TCP_STEALTH.
+ *
+ * @param cls closure
+ * @param section section with the value
+ * @param option option name
+ * @param value value as a string
+ * @param widget widget to initialize
+ * @param cfg configuration handle
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
+ */
+static int
+load_yes_no_check_tcp_stealth (const void *cls,
+ const char *section,
+ const char *option,
+ const char *value,
+ GObject * widget,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+ GtkWidget *button;
+ int ret;
+#ifdef SO_TCPSTEALTH
+ struct GNUNET_NETWORK_Handle *lsock;
+#endif
+ int disable;
+
+ ret = load_yes_no (cls, section,
+ option, value,
+ widget, cfg);
+ if (GNUNET_OK != ret)
+ return ret;
+ button = GTK_WIDGET (widget);
+ if (NULL == button)
+ return GNUNET_SYSERR;
+ /* check if TCP_STEALTH is supported by kernel */
+#ifdef SO_TCPSTEALTH
+ disable = GNUNET_NO;
+ lsock = GNUNET_NETWORK_socket_create (AF_INET, SOCK_STREAM, 0);
+ if (NULL == lsock)
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+ "socket");
+ return GNUNET_SYSERR;
+ }
+ else
+ {
+ if (GNUNET_OK !=
+ GNUNET_NETWORK_socket_setsockopt (lsock,
+ IPPROTO_TCP,
+ SO_TCPSTEALTH,
+ "test", 4))
+ disable = GNUNET_YES;
+ GNUNET_NETWORK_socket_close (lsock);
+ }
+#else
+ disable = GNUNET_YES;
+#endif
+ if (GNUNET_YES == disable)
+ {
+ /* force to false; with insensitive user could otherwise
+ not disable */
+ if (0 == strcasecmp (value, "YES"))
+ {
+ /* deactivate the option, but warn user, as this may open up
+ security issues */
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Disabling TCP STEALTH, not supported on this system.\n"));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
+ FALSE);
+ }
+ return GNUNET_OK;
+ }
+ gtk_widget_set_sensitive (button,
+ TRUE);
+ return GNUNET_OK;
+}
+
+
+/**
* Set a yes/no option based on a toggle button.
*
* @param cls closure
@@ -1565,6 +1644,18 @@
NULL},
{
+ "GNUNET_setup_transport_tcp_stealth_checkbutton",
+ "toggled",
+ "transport-tcp",
+ "TCP_STEALTH",
+ gettext_noop ("Should GNUnet use TCP STEALTH for the TCP server?"),
+ "https://gnunet.org/knock",
+ &load_yes_no_check_tcp_stealth,
+ &save_yes_no, NULL,
+ NULL, NULL,
+ NULL },
+
+ {
"GNUNET_setup_transport_nat_checkbutton",
"toggled",
"nat",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34397 - in gnunet-gtk: contrib src/setup,
gnunet <=