aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transport/plugin_transport_udp.c52
-rw-r--r--src/transport/transport.conf.in2
2 files changed, 40 insertions, 14 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 5a1257845..c5eb93617 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -1798,6 +1798,7 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock)
1798 size_t slen; 1798 size_t slen;
1799 struct GNUNET_TIME_Absolute max; 1799 struct GNUNET_TIME_Absolute max;
1800 struct UDPMessageWrapper *udpw = NULL; 1800 struct UDPMessageWrapper *udpw = NULL;
1801 static int network_down_error;
1801 1802
1802 if (sock == plugin->sockv4) 1803 if (sock == plugin->sockv4)
1803 { 1804 {
@@ -1889,24 +1890,39 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock)
1889 const struct GNUNET_ATS_Information type = plugin->env->get_address_type 1890 const struct GNUNET_ATS_Information type = plugin->env->get_address_type
1890 (plugin->env->cls,sa, slen); 1891 (plugin->env->cls,sa, slen);
1891 1892
1892 if ((GNUNET_ATS_NET_WAN == type.value) && 1893 if (((GNUNET_ATS_NET_LAN == ntohl(type.value)) || (GNUNET_ATS_NET_WAN == ntohl(type.value))) &&
1893 ((ENETUNREACH == errno) || (ENETDOWN == errno))) 1894 ((ENETUNREACH == errno) || (ENETDOWN == errno)))
1894 { 1895 {
1895 /* "Network unreachable" or "Network down" */ 1896 if ((network_down_error == GNUNET_NO) && (slen == sizeof (struct sockaddr_in)))
1896 /* 1897 {
1897 * This indicates that this system is IPv6 enabled, but does not 1898 /* IPv4: "Network unreachable" or "Network down"
1898 * have a valid global IPv6 address assigned 1899 *
1899 */ 1900 * This indicates we do not have connectivity
1900 LOG (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 1901 */
1901 _("UDP could not message to `%s': `%s'. " 1902 LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
1903 _("UDP could not message to `%s': "
1904 "Network seems down, please check your network configuration\n"),
1905 GNUNET_a2s (sa, slen));
1906 }
1907 if ((network_down_error == GNUNET_NO) && (slen == sizeof (struct sockaddr_in6)))
1908 {
1909 /* IPv6: "Network unreachable" or "Network down"
1910 *
1911 * This indicates that this system is IPv6 enabled, but does not
1912 * have a valid global IPv6 address assigned or we do not have
1913 * connectivity
1914 */
1915
1916 LOG (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK,
1917 _("UDP could not message to `%s': "
1902 "Please check your network configuration and disable IPv6 if your " 1918 "Please check your network configuration and disable IPv6 if your "
1903 "connection does not have a global IPv6 address\n"), 1919 "connection does not have a global IPv6 address\n"),
1904 GNUNET_a2s (sa, slen), 1920 GNUNET_a2s (sa, slen));
1905 STRERROR (errno)); 1921 }
1906 } 1922 }
1907 else 1923 else
1908 { 1924 {
1909 LOG (GNUNET_ERROR_TYPE_ERROR, 1925 LOG (GNUNET_ERROR_TYPE_WARNING,
1910 "UDP could not transmit %u-byte message to `%s': `%s'\n", 1926 "UDP could not transmit %u-byte message to `%s': `%s'\n",
1911 (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen), 1927 (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen),
1912 STRERROR (errno)); 1928 STRERROR (errno));
@@ -1920,6 +1936,7 @@ udp_select_send (struct Plugin *plugin, struct GNUNET_NETWORK_Handle *sock)
1920 (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen), (int) sent, 1936 (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen), (int) sent,
1921 (sent < 0) ? STRERROR (errno) : "ok"); 1937 (sent < 0) ? STRERROR (errno) : "ok");
1922 call_continuation(udpw, GNUNET_OK); 1938 call_continuation(udpw, GNUNET_OK);
1939 network_down_error = GNUNET_NO;
1923 } 1940 }
1924 1941
1925 if (sock == plugin->sockv4) 1942 if (sock == plugin->sockv4)
@@ -2276,6 +2293,7 @@ libgnunet_plugin_transport_udp_init (void *cls)
2276 unsigned long long enable_v6; 2293 unsigned long long enable_v6;
2277 char * bind4_address; 2294 char * bind4_address;
2278 char * bind6_address; 2295 char * bind6_address;
2296 char * fancy_interval;
2279 struct GNUNET_TIME_Relative interval; 2297 struct GNUNET_TIME_Relative interval;
2280 struct sockaddr_in serverAddrv4; 2298 struct sockaddr_in serverAddrv4;
2281 struct sockaddr_in6 serverAddrv6; 2299 struct sockaddr_in6 serverAddrv6;
@@ -2364,11 +2382,19 @@ libgnunet_plugin_transport_udp_init (void *cls)
2364 if (broadcast == GNUNET_SYSERR) 2382 if (broadcast == GNUNET_SYSERR)
2365 broadcast = GNUNET_NO; 2383 broadcast = GNUNET_NO;
2366 2384
2367 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (env->cfg, "transport-udp", 2385 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (env->cfg, "transport-udp",
2368 "BROADCAST_INTERVAL", &interval)) 2386 "BROADCAST_INTERVAL", &fancy_interval))
2369 { 2387 {
2370 interval = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10); 2388 interval = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10);
2371 } 2389 }
2390 else
2391 {
2392 if (GNUNET_SYSERR == GNUNET_STRINGS_fancy_time_to_relative(fancy_interval, &interval))
2393 {
2394 interval = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30);
2395 }
2396 GNUNET_free (fancy_interval);
2397 }
2372 2398
2373 /* Maximum datarate */ 2399 /* Maximum datarate */
2374 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-udp", 2400 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-udp",
diff --git a/src/transport/transport.conf.in b/src/transport/transport.conf.in
index 9a6f5d912..29f4a2d62 100644
--- a/src/transport/transport.conf.in
+++ b/src/transport/transport.conf.in
@@ -47,7 +47,7 @@ MAX_CONNECTIONS = 128
47[transport-udp] 47[transport-udp]
48PORT = 2086 48PORT = 2086
49BROADCAST = YES 49BROADCAST = YES
50BROADCAST_INTERVAL = 30000 50BROADCAST_INTERVAL = 30 s
51MAX_BPS = 1000000 51MAX_BPS = 1000000
52 52
53[transport-http] 53[transport-http]