gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12250 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r12250 - gnunet/src/util
Date: Sun, 18 Jul 2010 22:17:50 +0200

Author: grothoff
Date: 2010-07-18 22:17:50 +0200 (Sun, 18 Jul 2010)
New Revision: 12250

Modified:
   gnunet/src/util/
   gnunet/src/util/network.c
Log:
bind to v6 only


Property changes on: gnunet/src/util
___________________________________________________________________
Modified: svn:ignore
   - test_os_start_process
test_peer.gcno
test_peer.gcda
test_peer
test_bio.gcno
test_bio.gcda
gnunet-service-resolver.gcda
test_bio
resolver_api.gcno
resolver_api.gcda
peer.gcno
peer.gcda
container_slist.gcno
container_slist.gcda
container_heap.gcno
container_heap.gcda
connection.gcno
connection.gcda
bio.gcno
bio.gcda
test_resolver_api.gcno
test_resolver_api.gcda
test_container_slist.gcno
test_container_slist.gcda
test_container_heap.gcno
test_container_heap.gcda
test_connection_transmit_cancel.gcno
test_connection_transmit_cancel.gcda
test_connection_timeout_no_connect.gcno
test_connection_timeout_no_connect.gcda
test_connection_timeout.gcno
test_connection_timeout.gcda
test_connection_receive_cancel.gcno
test_connection_receive_cancel.gcda
test_connection_addressing.gcno
test_connection_addressing.gcda
test_connection.gcno
test_connection.gcda
gnunet-service-resolver.gcno
test_resolver_api
test_container_slist
test_container_heap
gnunet-service-resolver
test_container_vector
test_connection_transmit_cancel
test_connection_timeout_no_connect
test_connection_timeout
test_connection_receive_cancel
test_connection_addressing
test_connection
time.gcno
time.gcda
test_plugin_plug.gcno
test_plugin_plug.gcda
strings.gcno
strings.gcda
signal.gcno
signal.gcda
service.gcno
service.gcda
server_tc.gcno
server_tc.gcda
server.gcno
server.gcda
scheduler.gcno
scheduler.gcda
pseudonym.gcno
pseudonym.gcda
program.gcno
program.gcda
plugin.gcno
plugin.gcda
os_priority.gcno
os_priority.gcda
os_network.gcno
os_network.gcda
os_load.gcno
os_load.gcda
os_installation.gcno
os_installation.gcda
network.gcno
network.gcda
getopt_helpers.gcno
getopt_helpers.gcda
getopt.gcno
getopt.gcda
disk.gcno
disk.gcda
crypto_rsa.gcno
crypto_rsa.gcda
crypto_random.gcno
crypto_random.gcda
crypto_ksk.gcno
crypto_ksk.gcda
crypto_hash.gcno
crypto_hash.gcda
crypto_crc.gcno
crypto_crc.gcda
crypto_aes.gcno
crypto_aes.gcda
container_multihashmap.gcno
container_multihashmap.gcda
container_meta_data.gcno
container_meta_data.gcda
container_bloomfilter.gcno
container_bloomfilter.gcda
configuration.gcno
configuration.gcda
common_logging.gcno
common_logging.gcda
common_gettext.gcno
common_gettext.gcda
common_endian.gcno
common_endian.gcda
common_allocation.gcno
common_allocation.gcda
client.gcno
client.gcda
test_time.gcda
test_strings.gcda
test_service.gcda
test_server_with_client.gcda
test_server_disconnect.gcda
test_server.gcda
test_scheduler_delay.gcda
test_scheduler.gcda
test_pseudonym.gcda
test_program.gcda
test_plugin.gcda
test_os_priority.gcda
test_os_network.gcda
test_os_load.gcda
perf_crypto_hash.gcda
test_time.gcno
test_time
test_strings.gcno
test_strings
test_service.gcno
test_service
test_server_with_client.gcno
test_server_with_client
test_server_disconnect.gcno
test_server_disconnect
test_server.gcno
test_server
test_scheduler_delay.gcno
test_scheduler_delay
test_scheduler.gcno
test_scheduler
test_pseudonym.gcno
test_pseudonym
test_program.gcno
test_program
test_plugin.gcno
test_plugin
test_os_priority.gcno
test_os_priority
test_os_network.gcno
test_os_network
test_os_load.gcno
test_os_load
test_network_transmit_cancel.gcno
test_network_transmit_cancel.gcda
test_network_transmit_cancel
test_network_timeout_no_connect.gcno
test_network_timeout_no_connect.gcda
test_network_timeout_no_connect
test_network_timeout.gcno
test_network_timeout.gcda
test_network_timeout
test_network_receive_cancel.gcno
test_network_receive_cancel.gcda
test_network_receive_cancel
test_network_addressing.gcno
test_network_addressing.gcda
test_network_addressing
test_network.gcno
test_network.gcda
test_network
test_getopt.gcno
test_getopt.gcda
test_getopt
test_disk.gcno
test_disk.gcda
test_disk
test_crypto_rsa.gcno
test_crypto_rsa.gcda
test_crypto_rsa
test_crypto_random.gcno
test_crypto_random.gcda
test_crypto_random
test_crypto_ksk.gcno
test_crypto_ksk.gcda
test_crypto_ksk
test_crypto_hash.gcno
test_crypto_hash.gcda
test_crypto_hash
test_crypto_crc.gcno
test_crypto_crc.gcda
test_crypto_crc
test_crypto_aes_weak.gcno
test_crypto_aes_weak.gcda
test_crypto_aes_weak
test_crypto_aes.gcno
test_crypto_aes.gcda
test_crypto_aes
test_container_multihashmap.gcno
test_container_multihashmap.gcda
test_container_multihashmap
test_container_meta_data.gcno
test_container_meta_data.gcda
test_container_meta_data
test_container_bloomfilter.gcno
test_container_bloomfilter.gcda
test_container_bloomfilter
test_configuration.gcno
test_configuration.gcda
test_configuration
test_common_logging.gcno
test_common_logging.gcda
test_common_logging
test_common_endian.gcno
test_common_endian.gcda
test_common_endian
test_common_allocation.gcno
test_common_allocation.gcda
test_common_allocation
test_client.gcno
test_client.gcda
test_client
perf_crypto_hash.gcno
perf_crypto_hash
Makefile.in
Makefile
.deps

   + test_crypto_hkdf
test_os_start_process
test_peer.gcno
test_peer.gcda
test_peer
test_bio.gcno
test_bio.gcda
gnunet-service-resolver.gcda
test_bio
resolver_api.gcno
resolver_api.gcda
peer.gcno
peer.gcda
container_slist.gcno
container_slist.gcda
container_heap.gcno
container_heap.gcda
connection.gcno
connection.gcda
bio.gcno
bio.gcda
test_resolver_api.gcno
test_resolver_api.gcda
test_container_slist.gcno
test_container_slist.gcda
test_container_heap.gcno
test_container_heap.gcda
test_connection_transmit_cancel.gcno
test_connection_transmit_cancel.gcda
test_connection_timeout_no_connect.gcno
test_connection_timeout_no_connect.gcda
test_connection_timeout.gcno
test_connection_timeout.gcda
test_connection_receive_cancel.gcno
test_connection_receive_cancel.gcda
test_connection_addressing.gcno
test_connection_addressing.gcda
test_connection.gcno
test_connection.gcda
gnunet-service-resolver.gcno
test_resolver_api
test_container_slist
test_container_heap
gnunet-service-resolver
test_container_vector
test_connection_transmit_cancel
test_connection_timeout_no_connect
test_connection_timeout
test_connection_receive_cancel
test_connection_addressing
test_connection
time.gcno
time.gcda
test_plugin_plug.gcno
test_plugin_plug.gcda
strings.gcno
strings.gcda
signal.gcno
signal.gcda
service.gcno
service.gcda
server_tc.gcno
server_tc.gcda
server.gcno
server.gcda
scheduler.gcno
scheduler.gcda
pseudonym.gcno
pseudonym.gcda
program.gcno
program.gcda
plugin.gcno
plugin.gcda
os_priority.gcno
os_priority.gcda
os_network.gcno
os_network.gcda
os_load.gcno
os_load.gcda
os_installation.gcno
os_installation.gcda
network.gcno
network.gcda
getopt_helpers.gcno
getopt_helpers.gcda
getopt.gcno
getopt.gcda
disk.gcno
disk.gcda
crypto_rsa.gcno
crypto_rsa.gcda
crypto_random.gcno
crypto_random.gcda
crypto_ksk.gcno
crypto_ksk.gcda
crypto_hash.gcno
crypto_hash.gcda
crypto_crc.gcno
crypto_crc.gcda
crypto_aes.gcno
crypto_aes.gcda
container_multihashmap.gcno
container_multihashmap.gcda
container_meta_data.gcno
container_meta_data.gcda
container_bloomfilter.gcno
container_bloomfilter.gcda
configuration.gcno
configuration.gcda
common_logging.gcno
common_logging.gcda
common_gettext.gcno
common_gettext.gcda
common_endian.gcno
common_endian.gcda
common_allocation.gcno
common_allocation.gcda
client.gcno
client.gcda
test_time.gcda
test_strings.gcda
test_service.gcda
test_server_with_client.gcda
test_server_disconnect.gcda
test_server.gcda
test_scheduler_delay.gcda
test_scheduler.gcda
test_pseudonym.gcda
test_program.gcda
test_plugin.gcda
test_os_priority.gcda
test_os_network.gcda
test_os_load.gcda
perf_crypto_hash.gcda
test_time.gcno
test_time
test_strings.gcno
test_strings
test_service.gcno
test_service
test_server_with_client.gcno
test_server_with_client
test_server_disconnect.gcno
test_server_disconnect
test_server.gcno
test_server
test_scheduler_delay.gcno
test_scheduler_delay
test_scheduler.gcno
test_scheduler
test_pseudonym.gcno
test_pseudonym
test_program.gcno
test_program
test_plugin.gcno
test_plugin
test_os_priority.gcno
test_os_priority
test_os_network.gcno
test_os_network
test_os_load.gcno
test_os_load
test_network_transmit_cancel.gcno
test_network_transmit_cancel.gcda
test_network_transmit_cancel
test_network_timeout_no_connect.gcno
test_network_timeout_no_connect.gcda
test_network_timeout_no_connect
test_network_timeout.gcno
test_network_timeout.gcda
test_network_timeout
test_network_receive_cancel.gcno
test_network_receive_cancel.gcda
test_network_receive_cancel
test_network_addressing.gcno
test_network_addressing.gcda
test_network_addressing
test_network.gcno
test_network.gcda
test_network
test_getopt.gcno
test_getopt.gcda
test_getopt
test_disk.gcno
test_disk.gcda
test_disk
test_crypto_rsa.gcno
test_crypto_rsa.gcda
test_crypto_rsa
test_crypto_random.gcno
test_crypto_random.gcda
test_crypto_random
test_crypto_ksk.gcno
test_crypto_ksk.gcda
test_crypto_ksk
test_crypto_hash.gcno
test_crypto_hash.gcda
test_crypto_hash
test_crypto_crc.gcno
test_crypto_crc.gcda
test_crypto_crc
test_crypto_aes_weak.gcno
test_crypto_aes_weak.gcda
test_crypto_aes_weak
test_crypto_aes.gcno
test_crypto_aes.gcda
test_crypto_aes
test_container_multihashmap.gcno
test_container_multihashmap.gcda
test_container_multihashmap
test_container_meta_data.gcno
test_container_meta_data.gcda
test_container_meta_data
test_container_bloomfilter.gcno
test_container_bloomfilter.gcda
test_container_bloomfilter
test_configuration.gcno
test_configuration.gcda
test_configuration
test_common_logging.gcno
test_common_logging.gcda
test_common_logging
test_common_endian.gcno
test_common_endian.gcda
test_common_endian
test_common_allocation.gcno
test_common_allocation.gcda
test_common_allocation
test_client.gcno
test_client.gcda
test_client
perf_crypto_hash.gcno
perf_crypto_hash
Makefile.in
Makefile
.deps


Modified: gnunet/src/util/network.c
===================================================================
--- gnunet/src/util/network.c   2010-07-18 20:17:35 UTC (rev 12249)
+++ gnunet/src/util/network.c   2010-07-18 20:17:50 UTC (rev 12250)
@@ -45,6 +45,10 @@
   SOCKET fd;
 #endif
 
+  /**
+   * Address family / domain.
+   */
+  int af;
 };
 
 
@@ -203,6 +207,9 @@
   struct GNUNET_NETWORK_Handle *ret;
 
   ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_Handle));
+  ret->af = address->sa_family;
+  /* NOTE: if sa_family does not exist on some platform,
+     using AF_UNSPEC should be safe */
   ret->fd = accept (desc->fd, address, address_len);
   if (ret->fd == INVALID_SOCKET)
     {
@@ -260,7 +267,18 @@
                             socklen_t address_len)
 {
   int ret;
-
+  
+#ifdef IPV6_V6ONLY 
+#ifdef IPPROTO_IPV6
+  const int on = 1;
+  if (desc->af == AF_INET6)
+    setsockopt (desc->fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof (on));
+#if 0
+  /* is this needed or desired? or done elsewhere? */
+  setsockopt (desc->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on));
+#endif
+#endif
+#endif
   ret = bind (desc->fd, address, address_len);
 #ifdef MINGW
   if (SOCKET_ERROR == ret)
@@ -320,6 +338,7 @@
     return NULL; /* invalid FD */
   ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_Handle)); 
   ret->fd = fd;
+  ret->af = AF_UNSPEC;
   return ret;
 #endif
 }
@@ -602,6 +621,7 @@
 {
   struct GNUNET_NETWORK_Handle *ret;
   ret = GNUNET_malloc (sizeof (struct GNUNET_NETWORK_Handle));
+  ret->af = domain;
   ret->fd = socket (domain, type, protocol);
   if (INVALID_SOCKET == ret->fd)
     {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]