Committer: Diego Biurrun <diego@xxxxxxxxxx> Date: 16/05/2010 at 20:58:26 Revision: 4528 Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: trunk Log: Remove DHT code. Modified: D hipd/dht.c D hipd/dht.h D hipd/dhtqueue.c D hipd/dhtqueue.h D lib/dht/ D lib/dht/example_xml_rpc_packets.txt D lib/dht/libhipdht.c D lib/dht/libhipdht.h D lib/dht/libhipdhtxml.c D lib/dht/libhipdhtxml.h D test/dhtteststub.c M INSTALL M Makefile.am M configure.ac M debian/rules M doc/HACKING M doc/HOWTO.xml M hipd/hadb_legacy.c M hipd/hipd.c M hipd/hipd.h M hipd/init.c M hipd/init.h M hipd/maintenance.c M hipd/maintenance.h M hipd/netdev.c M hipd/update_legacy.c M hipd/user.c M lib/conf/conf.c M lib/conf/conf.h M lib/core/builder.c M lib/core/builder.h M lib/core/hostsfiles.c M lib/core/hostsfiles.h M lib/core/icomm.h M lib/core/message.c M lib/core/protodefs.h M packaging/hipl-deb.spec M packaging/hipl-rpm.spec M packaging/openwrt/package/Makefile M tools/hipdnsproxy/hipdnsproxy M tools/hipl_autobuild.sh === modified file 'INSTALL' --- INSTALL 2010-05-12 16:09:38 +0000 +++ INSTALL 2010-05-16 17:58:14 +0000 @@ -23,26 +23,25 @@ to use the optional native programming interface, you need to patch your kernel anyway. -In order to compile HIPL you need autotools (autoconf, automake, -libtool), GNU Make and gcc. openssl, libxml2, iptables, -libcap and libconfig are required complete with -development headers. For Perl, Socket6, IO::Socket::INET6, Net::IP and +In order to compile HIPL you need autotools (autoconf, automake, libtool), GNU +Make and gcc. openssl, iptables, libcap and libconfig are required complete +with development headers. For Perl, Socket6, IO::Socket::INET6, Net::IP and Net::DNS modules are required. You can optionally install xmlto to build the HOWTO and doxygen to build the code documentation. On Ubuntu, the following command(s) should solve the dependencies: - aptitude install automake autoconf libtool gcc libssl-dev libxml2-dev \ - iptables-dev libcap-dev aptitudelibnet-ip-perl libnet-dns-perl \ + aptitude install automake autoconf libtool gcc libssl-dev \ + iptables-dev libcap-dev libnet-ip-perl libnet-dns-perl \ libsocket6-perl libio-socket-inet6-perl Optionally: aptitude install pax miredo bzr xmlto doxygen On Fedora, the following command(s) should solve the dependencies: - yum install gcc openssl-devel libxml2-devel autoconf automake libtool \ - iptables-devel libcap-devel rpm-build perl-Net-IP perl-Net-DNS \ - perl-Socket6 perl-IO-Socket-INET6" + yum install gcc openssl-devel autoconf automake libtool \ + iptables-devel libcap-devel rpm-build \ + perl-Net-IP perl-Net-DNS perl-Socket6 perl-IO-Socket-INET6 Optionally: yum install miredo bzr xmlto doxygen === modified file 'Makefile.am' --- Makefile.am 2010-05-12 16:09:38 +0000 +++ Makefile.am 2010-05-16 17:58:14 +0000 @@ -5,7 +5,6 @@ # For "make dist" EXTRA_DIST = .vimrc debian doc patches release.version version.h EXTRA_DIST += packaging tools/maintainer -EXTRA_DIST += $(wildcard $(addprefix $(srcdir)/lib/dht/,*.txt)) EXTRA_DIST += $(wildcard $(addprefix $(srcdir)/test/,*.pl *.sh)) EXTRA_DIST += $(wildcard $(addprefix $(srcdir)/tools/,*.cfg *.pl *.sh)) EXTRA_DIST += $(wildcard $(addprefix $(srcdir)/firewall/,*.cfg)) @@ -17,10 +16,6 @@ test/certteststub \ test/hc_performance -if HIP_DHT -bin_PROGRAMS += test/dhtteststub -endif - if HIP_PERFORMANCE bin_PROGRAMS += test/dh_performance endif @@ -49,7 +44,6 @@ test_auth_performance_SOURCES = test/auth_performance.c test_certteststub_SOURCES = test/certteststub.c test_dh_performance_SOURCES = test/dh_performance.c -test_dhtteststub_SOURCES = test/dhtteststub.c test_hc_performance_SOURCES = test/hc_performance.c tools_hipconf_SOURCES = tools/hipconf.c @@ -63,7 +57,6 @@ hipd/configfilereader.c \ hipd/cookie.c \ hipd/dh.c \ - hipd/dhtqueue.c \ hipd/esp_prot_anchordb.c \ hipd/esp_prot_hipd_msg.c \ hipd/esp_prot_light_update.c \ @@ -89,10 +82,6 @@ hipd/user_ipsec_hipd_msg.c \ hipd/user_ipsec_sadb_api.c -if HIP_DHT -hipd_hipd_SOURCES += hipd/dht.c -endif - if HIP_MIDAUTH hipd_hipd_SOURCES += hipd/pisa.c endif @@ -136,7 +125,7 @@ endif -# TODO: libhipcore, libhipconf, libhipdht and libhiptool have circular +# TODO: libhipcore, libhipconf and libhiptool have circular # dependencies. This needs to be addressed at some point. lib_core_libhipcore_la_SOURCES = lib/conf/conf.c \ lib/core/builder.c \ @@ -168,11 +157,6 @@ lib/tool/pk.c \ lib/tool/xfrmapi.c -if HIP_DHT -lib_core_libhipcore_la_SOURCES += lib/dht/libhipdht.c \ - lib/dht/libhipdhtxml.c -endif - if HIP_PERFORMANCE lib_core_libhipcore_la_SOURCES += lib/core/performance.c endif @@ -188,7 +172,6 @@ test_auth_performance_LDADD = lib/core/libhipcore.la test_certteststub_LDADD = lib/core/libhipcore.la test_dh_performance_LDADD = lib/core/libhipcore.la -test_dhtteststub_LDADD = lib/core/libhipcore.la test_hc_performance_LDADD = lib/core/libhipcore.la tools_hipconf_LDADD = lib/core/libhipcore.la tools_pisacert_LDADD = lib/core/libhipcore.la @@ -256,8 +239,6 @@ %.ho: %.h $(CC) -I$(srcdir) -I$(builddir) $(AM_CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -o $@ $< -lib/dht/libhipdhtxml.lo: CFLAGS += `xml2-config --cflags` - # Ensure that version.h is created before everything else. This does not work # when creating specific objects that may depend on version.h directly. BUILT_SOURCES = version.h === modified file 'configure.ac' --- configure.ac 2010-05-12 16:09:38 +0000 +++ configure.ac 2010-05-16 17:58:14 +0000 @@ -130,21 +130,6 @@ fi AM_CONDITIONAL(HIP_OPPORTUNISTIC, test x"$ac_cv_use_opportunistic" = x"yes") -AC_ARG_ENABLE(dht, - AS_HELP_STRING([--enable-dht], - [DHT support (default is YES)]), - [ac_cv_use_dht=$enableval], - [ac_cv_use_dht=yes]) -AC_CACHE_CHECK([whether to use dht], - [ac_cv_use_dht], - [ac_cv_use_dht=yes]) -if test x"$ac_cv_use_dht" = x"yes"; then - AC_DEFINE(CONFIG_HIP_DHT) - AH_TEMPLATE(CONFIG_HIP_DHT, [Defined to 1 if dht is enabled.]) - AC_CHECK_LIB(xml2, xmlFreeDoc,, AC_MSG_ERROR(libxml2 not found)) -fi -AM_CONDITIONAL(HIP_DHT, test x"$ac_cv_use_dht" = x"yes") - AC_ARG_ENABLE(blind, AS_HELP_STRING([--enable-blind], [HIP BLIND extensions (default is NO)]), === modified file 'debian/rules' --- debian/rules 2010-05-12 16:09:38 +0000 +++ debian/rules 2010-05-16 17:58:14 +0000 @@ -33,7 +33,6 @@ endif ./configure $(CROSS) --prefix=/usr --sysconfdir=/etc \ --enable-shared \ - --disable-dht \ --disable-debug === modified file 'doc/HACKING' --- doc/HACKING 2010-05-13 18:50:54 +0000 +++ doc/HACKING 2010-05-16 17:58:14 +0000 @@ -1200,7 +1200,7 @@ * ping6 HIT * nc6 HIT * nc LSI -* use dnsproxy to obtain HITs from DNS or DHT +* use dnsproxy to obtain HITs from DNS * hipconf run opp nc/nc6 (both client & server side) 3. Base Exchange === modified file 'doc/HOWTO.xml' --- doc/HOWTO.xml 2010-05-16 14:37:39 +0000 +++ doc/HOWTO.xml 2010-05-16 17:58:14 +0000 @@ -1580,7 +1580,7 @@ <title>HIPL Internet Test Servers</title> <para> Below is a list of public InfraHIP test servers. Crossroads and ashenvale are also running - free DHT-based name look up services (<xref linkend="ch_opendht" />) and HIP rendezvous service which you can use according to the instructions in <xref linkend="ch_rvs_relay" />. + HIP rendezvous service which you can use according to the instructions in <xref linkend="ch_rvs_relay" />. </para> <table id="table_servers" frame="all"><title>Test Servers</title> <tgroup cols="1"> @@ -1722,8 +1722,7 @@ </para> <para> You can also add the mapping to "/etc/hip/hipd_config" and restart hipd. - It is also possible to use DNS or DHT (<xref linkend="ch_opendht" />) - for the mappings. + It is also possible to use DNS for the mappings. </para> <para> Link local IPv6 addresses are not supported well, so do not use @@ -1967,7 +1966,8 @@ <section id="sec_easy_methods"> <title>Easy Methods</title> <para> - 1. Run the dnshipproxy to map hostnames transparently to HITs from hosts files and directory services (DNS, DHT). + 1. Run the hipdnsproxy to map hostnames transparently to HITs + from hosts files and directory services (DNS). See <xref linkend="sec_dns_proxy" /> for more details. </para> <para> @@ -1981,7 +1981,7 @@ For example, you can execute "ping6 PEER_HIT". However, hipd must know the mapping from the PEER_HIT to the corresponding IP address. Hipd can find this mapping - from DNS or DHT. Alternatively, this information can be store to + from DNS. Alternatively, this information can be store to hosts files as follows: </para> <para> @@ -2011,7 +2011,7 @@ 1a. Running a single IPv6-enabled application using HIP: <emphasis>hipconf run opp <EXECUTABLE></emphasis> </para> <para> - 1b. Enabling HIP for all applications in bash shell (add to bashrc if you want to set this permanently): <emphasis>export LD_PRELOAD=libopphip.so:libhiptool.so:libhipopendht.so</emphasis> + 1b. Enabling HIP for all applications in bash shell (add to bashrc if you want to set this permanently): <emphasis>export LD_PRELOAD=libopphip.so:libhiptool.so</emphasis> </para> <para> 2. Use the system-based opportunistic mode as instructed in @@ -2217,11 +2217,8 @@ ldapsearch -x -H ldap://<fqdn> -b 'dc=<MY-DOMAIN>,dc=<COM>' '(objectclass=*)' </programlisting> <para> - The name can be - something found from <emphasis>/etc/hosts</emphasis> - and <emphasis>/etc/hosts</emphasis> or you can use DHT to - resolve names to HIT and address. Search can also be done directly - with HIT by command + The name can be something found in <emphasis>/etc/hosts</emphasis>. + Search can also be done directly with HIT by command </para> <programlisting> ldapsearch -x -H ldap://[<HIT>] -b 'dc=<MY-DOMAIN>,dc=<COM>' '(objectclass=*)' @@ -2477,10 +2474,10 @@ </para> <para> - The DNS proxy tries to find host identities from three places: - "hosts" files (/etc/hosts and /etc/hip/hosts), HI records in DNS - and Openlookup DHT (experimental). It returns the host identities as - HITs or LSIs to the requesting application. + The DNS proxy tries to find host identities from two places: + "hosts" files (/etc/hosts and /etc/hip/hosts), HI records in DNS. + It returns the host identities as HITs or LSIs to the requesting + application. </para> <para> @@ -2538,11 +2535,6 @@ This outputs a line which can be inserted to a zone file. Similarly, with sed command: <programlisting> -.... | sed -n -e '/^HIPBIND */s///p' - </programlisting> - an HIP RR entry suitable for OpenDHT version of BIND9 is output - and with - <programlisting> .... | sed -n -e '/^DJBDNS */s///p' </programlisting> a line for Dan Bernstein's tinydns is output. For further @@ -2567,7 +2559,6 @@ <listitem><para>in /etc/hip/hosts</para></listitem> <listitem><para>in /etc/hosts</para></listitem> <listitem><para>in hit-to-ip.infrahip.net zone</para></listitem> - <listitem><para>in DHT</para></listitem> </itemizedlist> </para> @@ -2611,73 +2602,6 @@ </para> </section> -<section id="ch_opendht"> - <title>Openlookup-based Name Lookup for HIP</title> - <section> - <title>DHT Client Support (Experimental!)</title> - <itemizedlist> - <listitem><para> - With DHT support, the hip daemon pushes the hostname, - RSA public HIT and public IP address to the DHT. The resolver - can then look up this information automatically without DNS or manual - /etc/(hip)/hosts configuration. - </para></listitem> - <listitem><para> - Once you start hipd, it will send its hostname, HIT and IP address - to DHT. You can query this information with - "hipconf dht get <hostname|HIT>". - </para></listitem> - <listitem><para> - To test, just run normally nc6 with -v flag - between the two hosts. You would see messages - from hipd and nc6 connecting to a HIT. Everything - should work without additional actions. - </para></listitem> - </itemizedlist> - - <para> - HIP daemon creates a file called /etc/hip/dhtservers when you - execute it. You can add there DHT servers. The file has almost the - same format as hosts files, with the addition of port definition - with the servername (IP_address servername<:port>). - </para> - - <para> - There is multiple DHT related hipconf commands that you can - use to affect the behaviour of the DHT code of HIPL. - </para> - - <itemizedlist> - <listitem><para> - hipconf opendht on|off - </para></listitem> - <listitem><para> - hipconf dht gw <IPv4|hostname> <port (DHT default = 5851)> <TTL> - </para></listitem> - <listitem><para> - hipconf dht get <fqdn/hit> - </para></listitem> - <listitem><para> - hipconf dht set <name> - </para></listitem> - </itemizedlist> - - <para> - First one of these commands toggles the on/off status of the - code. Second one forces the DHT code to change current serving - gateway eith a new one. This command allows to change port and TTL - definitions of DHT code on the fly. Third command is a simple - get of value under a key. Fourth command lets you set a - userdefined name to be sent to the DHT. By default result of - "uname -n" is sent to the DHT. - </para> - - <para> - For documentation, - please also check <ulink url="http://kom.aau.dk/group/05gr680/"; /> - </para> -</section> - </section> </chapter> <!-- Name Look-up --> @@ -3867,7 +3791,7 @@ HIPL supports also opportunistic mode that is uses TCP options to detect whether peer supports HIP or not. This is particularly useful in networking environments without HIP look up - infrastructure (OpenDHT/DNS/etc) and where the number of HIP hosts + infrastructure (DNS/etc) and where the number of HIP hosts is small. This "advanced" version of the opportunistic mode enables fast and backwards compatible fallback to non-HIP communications for TCP connections when the peer does not support === modified file 'hipd/hadb_legacy.c' --- hipd/hadb_legacy.c 2010-04-15 20:47:19 +0000 +++ hipd/hadb_legacy.c 2010-05-16 17:58:14 +0000 @@ -4,7 +4,7 @@ * Distributed under <a href="http://www.gnu.org/licenses/gpl2.txt";>GNU/GPL</a> * * This file contains legacy functions for mobility that should be rewritten for modularity. - * They are still included in the code base due to locator dependencies with DHT and + * They are still included in the code base due to locator dependencies with * base exchange code. See bugzilla item 926 and 927. * * @author Baris Boyvat === modified file 'hipd/hipd.c' --- hipd/hipd.c 2010-05-14 12:31:23 +0000 +++ hipd/hipd.c 2010-05-16 17:58:14 +0000 @@ -13,7 +13,6 @@ #include "config.h" #include "hipd.h" -#include "lib/dht/libhipdht.h" #include "lib/core/filemanip.h" #include "lib/core/performance.h" #include "lib/core/straddr.h" @@ -90,29 +89,6 @@ */ int hip_transform_order = 123; -/* OpenDHT related variables */ -int hip_opendht_sock_fqdn = -1; /* FQDN->HIT mapping */ -int hip_opendht_sock_hit = -1; /* HIT->IP mapping */ -int hip_opendht_fqdn_sent = STATE_OPENDHT_IDLE; -int hip_opendht_hit_sent = STATE_OPENDHT_IDLE; - -int dht_queue_count = 0; -int opendht_error = 0; -unsigned char opendht_response[HIP_MAX_PACKET]; -struct addrinfo *opendht_serving_gateway = NULL; -int opendht_serving_gateway_port = OPENDHT_PORT; -int opendht_serving_gateway_ttl = OPENDHT_TTL; - -char opendht_name_mapping[HIP_HOST_ID_HOSTNAME_LEN_MAX]; /* what name should be used as key */ -char opendht_host_name[256]; -unsigned char opendht_hdrr_secret[40]; -hip_common_t *opendht_current_hdrr = NULL; -char opendht_current_key[INET6_ADDRSTRLEN + 2]; - -/* now DHT is always off, so you have to set it on if you want to use it */ -int hip_opendht_inuse = HIP_MSG_DHT_OFF; -int hip_opendht_error_count = 0; /* Error count, counting errors from libhipopendht */ - int hip_buddies_inuse = HIP_MSG_BUDDIES_OFF; /* Tells to the daemon should it build LOCATOR parameters to R1 and I2 */ @@ -285,9 +261,6 @@ int highest_descriptor = 0, err = 0; struct timeval timeout; fd_set read_fdset; - fd_set write_fdset; - - #ifdef CONFIG_HIP_PERFORMANCE HIP_DEBUG("Creating perf set\n"); @@ -353,10 +326,9 @@ return 0; } - highest_descriptor = maxof(9, hip_nl_route.fd, hip_raw_sock_input_v6, + highest_descriptor = maxof(7, hip_nl_route.fd, hip_raw_sock_input_v6, hip_user_sock, hip_nl_ipsec.fd, hip_raw_sock_input_v4, hip_nat_sock_input_udp, - hip_opendht_sock_fqdn, hip_opendht_sock_hit, hip_icmp_sock); /* Allocate user message. */ @@ -377,15 +349,6 @@ #endif while (hipd_get_state() != HIPD_STATE_CLOSED) { /* prepare file descriptor sets */ - if (hip_opendht_inuse == HIP_MSG_DHT_ON) { - FD_ZERO(&write_fdset); - if (hip_opendht_fqdn_sent == STATE_OPENDHT_WAITING_CONNECT) { - FD_SET(hip_opendht_sock_fqdn, &write_fdset); - } - if (hip_opendht_hit_sent == STATE_OPENDHT_WAITING_CONNECT) { - FD_SET(hip_opendht_sock_hit, &write_fdset); - } - } FD_ZERO(&read_fdset); FD_SET(hip_nl_route.fd, &read_fdset); FD_SET(hip_raw_sock_input_v6, &read_fdset); @@ -396,13 +359,6 @@ FD_SET(hip_icmp_sock, &read_fdset); hip_firewall_sock = hip_user_sock; - if (hip_opendht_fqdn_sent == STATE_OPENDHT_WAITING_ANSWER) { - FD_SET(hip_opendht_sock_fqdn, &read_fdset); - } - if (hip_opendht_hit_sent == STATE_OPENDHT_WAITING_ANSWER) { - FD_SET(hip_opendht_sock_hit, &read_fdset); - } - timeout.tv_sec = HIP_SELECT_TIMEOUT; timeout.tv_usec = 0; @@ -420,14 +376,8 @@ } #endif - /* If DHT is on have to use write sets for asynchronic communication */ - if (hip_opendht_inuse == HIP_MSG_DHT_ON) { - err = select((highest_descriptor + 1), &read_fdset, - &write_fdset, NULL, &timeout); - } else { - err = select((highest_descriptor + 1), &read_fdset, - NULL, NULL, &timeout); - } + err = select((highest_descriptor + 1), &read_fdset, + NULL, NULL, &timeout); if (err < 0) { HIP_ERROR("select() error: %s.\n", strerror(errno)); @@ -581,81 +531,6 @@ err = hip_handle_user_msg(hipd_msg, &app_src); } } -#ifdef CONFIG_HIP_DHT - /* DHT SOCKETS HANDLING */ - if (hip_opendht_inuse == HIP_MSG_DHT_ON && hip_opendht_sock_fqdn != -1) { - if (FD_ISSET(hip_opendht_sock_fqdn, &read_fdset) && - FD_ISSET(hip_opendht_sock_fqdn, &write_fdset) && - (hip_opendht_inuse == HIP_MSG_DHT_ON)) { - HIP_DEBUG("DHT socket waiting for connect (readable and writable)\n"); - } else if (FD_ISSET(hip_opendht_sock_fqdn, &write_fdset)) { - if (address_count == 0) { - HIP_DEBUG("No addresses do not go to the next state\n"); - } else { - hip_opendht_fqdn_sent = STATE_OPENDHT_START_SEND; - } - } - if (FD_ISSET(hip_opendht_sock_fqdn, &read_fdset) && - (hip_opendht_inuse == HIP_MSG_DHT_ON)) { - /* Receive answer from openDHT FQDN->HIT mapping */ - if (hip_opendht_fqdn_sent == STATE_OPENDHT_WAITING_ANSWER) { - memset(opendht_response, '\0', sizeof(opendht_response)); - opendht_error = opendht_read_response(hip_opendht_sock_fqdn, - opendht_response); - if (opendht_error == -1) { - HIP_DEBUG("Put was unsuccesfull \n"); - hip_opendht_error_count++; - HIP_DEBUG("DHT error count now %d/%d.\n", - hip_opendht_error_count, OPENDHT_ERROR_COUNT_MAX); - } else { - HIP_DEBUG("Put was success (FQDN->HIT)\n"); - } - - close(hip_opendht_sock_fqdn); - hip_opendht_sock_fqdn = 0; - hip_opendht_sock_fqdn = init_dht_gateway_socket_gw(hip_opendht_sock_fqdn, - opendht_serving_gateway); - hip_opendht_fqdn_sent = STATE_OPENDHT_IDLE; - opendht_error = 0; - } - } - if (FD_ISSET(hip_opendht_sock_hit, &read_fdset) && - FD_ISSET(hip_opendht_sock_hit, &write_fdset) && - (hip_opendht_inuse == HIP_MSG_DHT_ON)) { - HIP_ERROR("DHT socket waiting for connect (readable and writable)\n\n"); - } else if (FD_ISSET(hip_opendht_sock_hit, &write_fdset)) { - if (address_count == 0) { - HIP_DEBUG("No addresses do not go to the next state\n"); - } else { - hip_opendht_hit_sent = STATE_OPENDHT_START_SEND; - } - } - if ((FD_ISSET(hip_opendht_sock_hit, &read_fdset)) && - (hip_opendht_inuse == HIP_MSG_DHT_ON)) { - /* Receive answer from openDHT HIT->IP mapping */ - if (hip_opendht_hit_sent == STATE_OPENDHT_WAITING_ANSWER) { - memset(opendht_response, '\0', sizeof(opendht_response)); - opendht_error = opendht_read_response(hip_opendht_sock_hit, - opendht_response); - if (opendht_error == -1) { - HIP_DEBUG("Put was unsuccesfull \n"); - hip_opendht_error_count++; - HIP_DEBUG("DHT error count now %d/%d.\n", - hip_opendht_error_count, OPENDHT_ERROR_COUNT_MAX); - } else { - HIP_DEBUG("Put was success (HIT->IP)\n"); - } - close(hip_opendht_sock_hit); - hip_opendht_sock_hit = 0; - hip_opendht_sock_hit = init_dht_gateway_socket_gw(hip_opendht_sock_hit, - opendht_serving_gateway); - hip_opendht_hit_sent = STATE_OPENDHT_IDLE; - opendht_error = 0; - } - } - } -#endif /* CONFIG_HIP_DHT */ - /* END DHT SOCKETS HANDLING */ if (FD_ISSET(hip_nl_ipsec.fd, &read_fdset)) { /* Something on IF and address event netlink socket, === modified file 'hipd/hipd.h' --- hipd/hipd.h 2010-05-12 16:09:38 +0000 +++ hipd/hipd.h 2010-05-16 17:58:14 +0000 @@ -33,7 +33,6 @@ #include "accessor.h" /* @todo: header recursion: accessor.h calls hipd.h */ #include "lib/core/message.h" #include "lib/core/esp_prot_common.h" -#include "dhtqueue.h" #include "blind.h" @@ -55,8 +54,6 @@ #define HIP_R1_PRECREATE_INTERVAL 60 * 60 /* seconds */ #define HIP_R1_PRECREATE_INIT (HIP_R1_PRECREATE_INTERVAL / HIP_SELECT_TIMEOUT) -#define OPENDHT_REFRESH_INTERVAL 30 /* seconds Original 60 using 1 with sockaddrs */ -#define OPENDHT_REFRESH_INIT (OPENDHT_REFRESH_INTERVAL / HIP_SELECT_TIMEOUT) #define QUEUE_CHECK_INTERVAL 15 /* seconds */ #define QUEUE_CHECK_INIT (QUEUE_CHECK_INTERVAL / HIP_SELECT_TIMEOUT) @@ -117,26 +114,6 @@ extern int hip_tcptimeout_status; -extern struct addrinfo *opendht_serving_gateway; -extern int opendht_serving_gateway_ttl; -extern int opendht_serving_gateway_port; - -extern int dht_queue_count; - -extern int opendht_error; -extern char opendht_current_key[INET6_ADDRSTRLEN + 2]; -extern char opendht_name_mapping[HIP_HOST_ID_HOSTNAME_LEN_MAX]; -extern hip_common_t *opendht_current_hdrr; -extern unsigned char opendht_hdrr_secret[40]; -extern char opendht_host_name[256]; - -extern int hip_opendht_inuse; -extern int hip_opendht_error_count; -extern int hip_opendht_sock_fqdn; -extern int hip_opendht_sock_hit; -extern int hip_opendht_fqdn_sent; -extern int hip_opendht_hit_sent; - extern hip_transform_suite_t hip_nat_status; extern int hip_use_userspace_data_packet_mode; === modified file 'hipd/init.c' --- hipd/init.c 2010-05-14 12:31:23 +0000 +++ hipd/init.c 2010-05-16 17:58:14 +0000 @@ -31,7 +31,6 @@ #include "lib/core/hostid.h" #include "lib/core/performance.h" #include "lib/tool/nlink.h" -#include "lib/dht/libhipdht.h" #include "lib/core/hip_udp.h" #include "lib/core/hostsfiles.h" @@ -45,11 +44,6 @@ /** Maximum size of a modprobe command line */ #define MODPROBE_MAX_LINE 64 -/* the /etc/hip/dhtservers file */ -#define HIPL_DHTSERVERS_FILE HIPL_SYSCONFDIR "/dhtservers" - -#define HIPL_DHTSERVERS_FILE_EX "193.167.187.134 hipdht2.infrahip.net\n" - /** ICMPV6_FILTER related stuff */ #define BIT_CLEAR(nr, addr) do { ((uint32_t *) (addr))[(nr) >> 5] &= ~(1U << ((nr) & 31)); } while (0) @@ -148,8 +142,6 @@ hip_create_file_unless_exists(HIPL_HOSTS_FILE, HIPL_HOSTS_FILE_EX); - hip_create_file_unless_exists(HIPL_DHTSERVERS_FILE, HIPL_DHTSERVERS_FILE_EX); - hip_create_file_unless_exists(HIPL_NSUPDATE_CONF_FILE, HIPL_NSUPDATE_CONF_FILE_EX); /* Load the configuration. The configuration is loaded as a sequence @@ -364,129 +356,6 @@ } /** - * initialize the needed variables for DHT - * - * @return zero on success or negative on failure - */ -int hip_init_dht(void) -{ - int err = 0; - -#ifdef CONFIG_HIP_DHT - int i = 0, j = 0, place = 0; - char serveraddr_str[INET6_ADDRSTRLEN]; - char servername_str[HOST_NAME_MAX]; - char servername_buf[HOST_NAME_MAX]; - char port_buf[] = "00000"; - int family; - - HIP_IFEL((hip_opendht_inuse == HIP_MSG_DHT_OFF), 0, "No DHT\n"); - - /* Init the opendht_queue */ - HIP_IFEL((hip_init_dht_queue() == -1), -1, "Failed to initialize opendht queue\n"); - - hip_opendht_error_count = 0; - /* Initializing variable for dht gateway port used in - * resolve_dht_gateway_info in libhipopendht */ - - /* Needs to be init here, because of gateway change after - * threshold error count*/ - opendht_serving_gateway_port = OPENDHT_PORT; - - memcpy(opendht_host_name, OPENDHT_GATEWAY, strlen(OPENDHT_GATEWAY)); - - /* Initialize the HDRR secret for OpenDHT put-rm.*/ - HIP_ASSERT(opendht_hdrr_secret != NULL); - memset(opendht_hdrr_secret, 0, 40); - err = RAND_bytes(opendht_hdrr_secret, 40); - - memset(servername_str, 0, sizeof(servername_str)); - memset(serveraddr_str, 0, sizeof(serveraddr_str)); - memset(servername_buf, '\0', sizeof(servername_buf)); - err = hip_get_random_hostname_id_from_hosts(OPENDHT_SERVERS_FILE, - servername_buf, serveraddr_str); - - for (i = 0; i < strlen(servername_buf); i++) { - if (servername_buf[i] == ':') { - break; - } - place++; - } - for (i = 0; i < place; i++) { - servername_str[i] = servername_buf[i]; - } - if (place < strlen(servername_buf) - 1) { - place++; - for (i = 0, j = place; i < strlen(servername_buf); i++, j++) { - port_buf[i] = servername_buf[j]; - } - opendht_serving_gateway_port = atoi(port_buf); - } - - HIP_IFEL(err, 0, "Failed to get random dht server\n"); - HIP_DEBUG("DHT gateway from dhtservers:\n %s (addr = %s, port = %d)\n", - servername_str, serveraddr_str, opendht_serving_gateway_port); - - if (strchr(serveraddr_str, ':') == NULL) { - family = AF_INET; - } else { - family = AF_INET6; - } - - /* resolve it */ - memset(opendht_host_name, '\0', sizeof(opendht_host_name)); - memcpy(opendht_host_name, servername_str, strlen(servername_str)); - err = resolve_dht_gateway_info(serveraddr_str, - &opendht_serving_gateway, - opendht_serving_gateway_port, family); - if (err < 0) { - hip_opendht_error_count++; - HIP_DEBUG("Error resolving openDHT gateway!\n"); - } - err = 0; - - /* check the condition of the sockets, we may have come here in middle - * of something so re-initializing might be needed */ - if (hip_opendht_sock_fqdn > 0) { - close(hip_opendht_sock_fqdn); - hip_opendht_sock_fqdn = init_dht_gateway_socket_gw(hip_opendht_sock_fqdn, - opendht_serving_gateway); - hip_opendht_fqdn_sent = STATE_OPENDHT_IDLE; - } - - if (hip_opendht_sock_hit > 0) { - close(hip_opendht_sock_hit); - hip_opendht_sock_hit = init_dht_gateway_socket_gw(hip_opendht_sock_hit, - opendht_serving_gateway); - hip_opendht_hit_sent = STATE_OPENDHT_IDLE; - } - - memset(opendht_name_mapping, '\0', HIP_HOST_ID_HOSTNAME_LEN_MAX); - if (gethostname(opendht_name_mapping, HIP_HOST_ID_HOSTNAME_LEN_MAX)) { - HIP_DEBUG("gethostname failed\n"); - } - hip_register_to_dht(); - err = hip_init_dht_sockets(&hip_opendht_sock_fqdn, &hip_opendht_fqdn_sent); - if (err < 0) { - close(hip_opendht_sock_fqdn); - hip_opendht_sock_fqdn = -1; - /* Do not bother trying the other */ - return err; - } - err = hip_init_dht_sockets(&hip_opendht_sock_hit, &hip_opendht_hit_sent); - if (err < 0) { - close(hip_opendht_sock_hit); - hip_opendht_sock_hit = -1; - } - -/* out_err only used by opendht code */ -out_err: -#endif /* CONFIG_HIP_DHT */ - - return err; -} - -/** * Initialize local host IDs. * * @return zero on success or negative on failure @@ -783,14 +652,6 @@ hip_remove_lock_file(HIP_DAEMON_LOCK_FILE); - if (opendht_serving_gateway) { - freeaddrinfo(opendht_serving_gateway); - } - - if (opendht_current_hdrr) { - free(opendht_current_hdrr); - } - #ifdef CONFIG_HIP_PERFORMANCE /* Deallocate memory of perf_set after finishing all of tests */ hip_perf_destroy(perf_set); @@ -798,8 +659,6 @@ hip_dh_uninit(); - hip_dht_queue_uninit(); - if (sflags & HIPD_START_LOAD_KMOD) { hip_remove_kernel_modules(); } @@ -1089,19 +948,6 @@ hip_load_configuration(); -#ifdef CONFIG_HIP_DHT - { - memset(opendht_host_name, 0, sizeof(opendht_host_name)); - - hip_opendht_sock_fqdn = init_dht_gateway_socket_gw(hip_opendht_sock_fqdn, - opendht_serving_gateway); - set_cloexec_flag(hip_opendht_sock_fqdn, 1); - hip_opendht_sock_hit = init_dht_gateway_socket_gw(hip_opendht_sock_hit, - opendht_serving_gateway); - set_cloexec_flag(hip_opendht_sock_hit, 1); - } -#endif /* CONFIG_HIP_DHT */ - certerr = 0; certerr = hip_init_certs(); if (certerr < 0) { === modified file 'hipd/init.h' --- hipd/init.h 2010-05-14 12:31:23 +0000 +++ hipd/init.h 2010-05-16 17:58:14 +0000 @@ -57,6 +57,5 @@ int is_output); void hip_close(int signal); void hip_exit(int signal); -int hip_init_dht(void); #endif /* HIP_HIPD_INIT_H */ === modified file 'hipd/maintenance.c' --- hipd/maintenance.c 2010-05-12 16:09:38 +0000 +++ hipd/maintenance.c 2010-05-16 17:58:14 +0000 @@ -7,8 +7,7 @@ * default roughly once in a second. These actions include * retransmissions of lost HIP control packets, keepalives for NATs, * heartbeats to detect connectivity problems, purging of opportunistic - * mode state, delaying of UPDATE triggering until addresses have stabilized - * and publishing of hostname/hit/ip mappings in a DHT. + * mode state, delaying of UPDATE triggering until addresses have stabilized. * * @brief Hipd maintenance loop * @@ -35,7 +34,6 @@ float opp_fallback_counter = HIP_OPP_FALLBACK_INIT; float precreate_counter = HIP_R1_PRECREATE_INIT; int nat_keep_alive_counter = HIP_NAT_KEEP_ALIVE_INTERVAL; -float opendht_counter = OPENDHT_REFRESH_INIT; float queue_counter = QUEUE_CHECK_INIT; int force_exit_counter = FORCE_EXIT_COUNTER_START; int cert_publish_counter = CERTIFICATE_PUBLISH_INTERVAL; @@ -253,34 +251,6 @@ address_change_time_counter--; } } -#ifdef CONFIG_HIP_DHT - if (hip_opendht_inuse == HIP_MSG_DHT_ON) { - if (opendht_counter < 0) { - hip_register_to_dht(); - opendht_counter = OPENDHT_REFRESH_INIT; - } else { - opendht_counter--; - } - if (queue_counter < 0) { - hip_send_packet_to_lookup_from_queue(); - queue_counter = QUEUE_CHECK_INIT; - } else { - queue_counter--; - } - if (hip_buddies_inuse == HIP_MSG_BUDDIES_ON) { - if (cert_publish_counter < 0) { - err = hip_publish_certificates(); - if (err < 0) { - HIP_ERROR("Publishing certificates to the lookup returned an error\n"); - err = 0; - } - cert_publish_counter = opendht_serving_gateway_ttl; - } else { - cert_publish_counter--; - } - } - } -#endif /* Clear the expired records from the relay hashtable. */ hip_relht_maintenance(); === modified file 'hipd/maintenance.h' --- hipd/maintenance.h 2010-05-12 16:09:38 +0000 +++ hipd/maintenance.h 2010-05-16 17:58:14 +0000 @@ -16,8 +16,6 @@ #include "nat.h" #include "update.h" #include "update_legacy.h" -#include "dhtqueue.h" -#include "dht.h" extern int heartbeat_counter; === modified file 'hipd/netdev.c' --- hipd/netdev.c 2010-05-12 13:57:56 +0000 +++ hipd/netdev.c 2010-05-16 17:58:14 +0000 @@ -11,7 +11,7 @@ * - automatic determination of source address for a packet if one has not been given (source * routing) * - automatic mapping of a remote HIT or LSI to its corresponding IP address(es) through - * HADB, hosts files, DHT or DNS when no mapping was not given (e.g. in referral scenarios) + * HADB, hosts files or DNS when no mapping was not given (e.g. in referral scenarios) * - triggering of base exchange * * @brief Localhost address cache and related management functions @@ -32,7 +32,6 @@ #include "accessor.h" #include "netdev.h" #include "maintenance.h" -#include "lib/dht/libhipdht.h" #include "lib/core/debug.h" #include "lib/tool/lutil.h" #include "lib/conf/conf.h" @@ -413,7 +412,7 @@ memcpy(&n->addr, addr, hip_sockaddr_len(addr)); } - /* Add secret to address. Used with openDHT removable puts. */ + /* Add secret to address. */ memset(tmp_secret, 0, sizeof(tmp_secret)); err_rand = RAND_bytes(tmp_secret, 40); memcpy(&n->secret, &tmp_secret, sizeof(tmp_secret)); @@ -650,131 +649,9 @@ return err; } -#ifdef CONFIG_HIP_DHT -/** - * Choose one address amongst multiple peer addresses obtained from a - * DHT server. - * - * @param in_msg the message from the DHT - * @param addr the DHT message (HIP control message format) @param - * addr The function writes the chosen address here. IPv4 - * adresses are in IPv6 mapped format. Set to zeroes when - * in_msg contained no addresses. - */ -static void hip_get_suitable_locator_address(struct hip_common *in_msg, - struct in6_addr *addr) -{ - struct hip_locator *locator; - int err_value = 0; - struct hip_locator_info_addr_item *item = NULL; - struct hip_locator_info_addr_item2 *item2 = NULL; - char *address_pointer; - struct in6_addr reply6; - struct in6_addr all_zero_ipv6; - - memset(&all_zero_ipv6, 0, sizeof(all_zero_ipv6)); - memset(addr, 0, sizeof(*addr)); - - _HIP_DUMP_MSG(in_msg); - - locator = hip_get_param((struct hip_common *) in_msg, - HIP_PARAM_LOCATOR); - if (locator) { - address_pointer = (char *) (locator + 1); - for (/* VOID */; address_pointer < ((char *) locator) + hip_get_param_contents_len(locator); ) { - if (((struct hip_locator_info_addr_item *) address_pointer)->locator_type - == HIP_LOCATOR_LOCATOR_TYPE_UDP) { - item2 = (struct hip_locator_info_addr_item2 *) address_pointer; - - HIP_DEBUG_HIT("LOCATOR", (struct in6_addr *) &item2->address); - memcpy(addr, (struct in6_addr *) &item2->address, sizeof(struct in6_addr)); - address_pointer += sizeof(struct hip_locator_info_addr_item2); - } else if (((struct hip_locator_info_addr_item *) address_pointer)->locator_type - == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) { - item = (struct hip_locator_info_addr_item *) address_pointer; - - HIP_DEBUG_HIT("LOCATOR", (struct in6_addr *) &item->address); - memcpy(addr, (struct in6_addr *) &item->address, sizeof(struct in6_addr)); - address_pointer += sizeof(struct hip_locator_info_addr_item); - } else if (((struct hip_locator_info_addr_item *) address_pointer)->locator_type - == HIP_LOCATOR_LOCATOR_TYPE_IPV6) { - item = (struct hip_locator_info_addr_item *) address_pointer; - - HIP_DEBUG_HIT("LOCATOR", (struct in6_addr *) &item->address); - memcpy(addr, (struct in6_addr *) &item->address, sizeof(struct in6_addr)); - address_pointer += sizeof(struct hip_locator_info_addr_item); - } else { - address_pointer += sizeof(struct hip_locator_info_addr_item); - } - } - } else { - memcpy(&((&reply6)->s6_addr), in_msg, sizeof(reply6.s6_addr)); - if (!ipv6_addr_cmp(&all_zero_ipv6, &reply6)) { - err_value = 3; //Entry not found at DHT gateway - } - } - - HIP_DEBUG_IN6ADDR("####", addr); -} - -#endif /* CONFIG_HIP_DHT */ - -/** - * Look up value from DHT corresponding to the key. The key is a HIT and the - * value is a locator (IP address). - * - * @param node_hit The key for the look up (a HIT) - * @param addr The value corresponding to the key (an IP address). IPv4 addresses - * are in IPv6 mapped format. - * @return Zero on success and negative on error - */ -static int hip_dht_get_endpointinfo(const char *node_hit, struct in6_addr *addr) -{ - int err = -1; -#ifdef CONFIG_HIP_DHT - char dht_locator_last[1024]; - int locator_item_count = 0; - struct in6_addr addr6, result; - struct hip_locator *locator; - unsigned char dht_response[HIP_MAX_PACKET]; - - /* Initialize vars with zero */ - bzero(&addr6, sizeof(addr6)); - bzero(&result, sizeof(result)); - bzero(dht_response, sizeof(dht_response)); - - if (hip_opendht_inuse == HIP_MSG_DHT_ON) { - memset(dht_locator_last, '\0', sizeof(dht_locator_last)); - HIP_IFEL(hip_opendht_get_key(&handle_hdrr_value, - opendht_serving_gateway, - node_hit, - dht_response, - 1), - -1, "DHT get in opendht_get_endpoint failed!\n"); - inet_pton(AF_INET6, node_hit, &addr6.s6_addr); - - /* HDRR verification */ - HIP_IFEL(hip_verify_hdrr((struct hip_common *) dht_response, &addr6), - -1, "HDRR Signature and/or host id verification failed!\n"); - - locator = hip_get_param((struct hip_common *) dht_response, - HIP_PARAM_LOCATOR); - locator_item_count = hip_get_locator_addr_item_count(locator); - if (locator_item_count > 0) { - err = 0; - } - hip_get_suitable_locator_address( - (struct hip_common *) dht_response, addr); - } - -out_err: -#endif /* CONFIG_HIP_DHT */ - return err; -} - /** * Try to map a given HIT or an LSI to a routable IP address using local host association - * data base, hosts files, DNS or DHT (in the presented order). + * data base, hosts files or DNS (in the presented order). * * @param hit a HIT to map to a LSI * @param lsi an LSI to map to an IP address @@ -801,7 +678,7 @@ if (ha && !ipv6_addr_any(&ha->peer_addr)) { ipv6_addr_copy(addr, &ha->peer_addr); - HIP_DEBUG("Found peer address from hadb, skipping hosts and opendht look up\n"); + HIP_DEBUG("Found peer address from hadb, skipping hosts look up\n"); err = 0; goto out_err; } @@ -810,9 +687,7 @@ * then resolve the hostname to an IP, and a HIT or LSI, * depending on dst_hit value. * If dst_hit is a HIT -> find LSI and hostname - * If dst_hit is an LSI -> find HIT and hostname - * We can fallback to e.g. DHT search if the mapping is not - * found from local files.*/ + * If dst_hit is an LSI -> find HIT and hostname */ /* try to resolve HIT to IPv4/IPv6 address by '/etc/hip/hosts' * and '/etc/hosts' files @@ -841,21 +716,6 @@ } } - /* Try to resolve HIT to IPv4/IPv6 address with OpenDHT server */ - if (hip_opendht_inuse == HIP_MSG_DHT_ON && !skip_namelookup) { - char hit_str[INET6_ADDRSTRLEN]; - - memset(hit_str, 0, sizeof(hit_str)); - hip_in6_ntop(&hit2, hit_str); - _HIP_DEBUG("### HIT STRING ### %s\n", (const char *) hit_str); - err = hip_dht_get_endpointinfo((const char *) hit_str, addr); - _HIP_DEBUG_IN6ADDR("### ADDR ###", addr); - if (err) { - HIP_DEBUG("Got IP for HIT from DHT err = \n", err); - } - } - - HIP_DEBUG_IN6ADDR("Found addr: ", addr); out_err: @@ -1024,11 +884,6 @@ } } - /* Try to look up peer ip from hosts and opendht */ - if (err) { - err = hip_map_id_to_addr(dst_hit, dst_lsi, dst_addr); - } - /* No peer address found; set it to broadcast address * as a last resource */ if (err) { @@ -1051,7 +906,7 @@ /** @todo changing global state won't work with threads */ hip_nat_status = ha_nat_mode; - /* To make it follow the same route as it was doing before HDRR/loactors */ + /* To make it follow the same route as it was doing before locators */ HIP_IFEL(hip_hadb_add_peer_info(dst_hit, dst_addr, dst_lsi, NULL), -1, "map failed\n"); === modified file 'hipd/update_legacy.c' --- hipd/update_legacy.c 2010-04-15 20:47:19 +0000 +++ hipd/update_legacy.c 2010-05-16 17:58:14 +0000 @@ -3,7 +3,7 @@ * Distributed under <a href="http://www.gnu.org/licenses/gpl2.txt";>GNU/GPL</a>. * * This file contains legacy functions for mobility that should be rewritten for modularity. - * They are still included in the code base due to locator dependencies with DHT and + * They are still included in the code base due to locator dependencies with * base exchange code. See bugzilla ids 926 and 927. * * @author Baris Boyvat === modified file 'hipd/user.c' --- hipd/user.c 2010-05-12 16:09:38 +0000 +++ hipd/user.c 2010-05-16 17:58:14 +0000 @@ -29,7 +29,6 @@ #include "accessor.h" #include "user.h" #include "esp_prot_anchordb.h" -#include "lib/dht/libhipdht.h" #include "lib/core/hostid.h" #include "lib/core/hip_udp.h" #include "hipd.h" @@ -257,147 +256,6 @@ HIP_IFEL(hip_set_blind_off(), -1, "hip_set_blind_off failed\n"); break; #endif -#ifdef CONFIG_HIP_DHT - case HIP_MSG_DHT_GW: - { - char tmp_ip_str[20], tmp_ip_str6[39], tmp_host_name[256]; - int tmp_ttl, tmp_port, is_hostname = 0, is_ipv4 = 0, is_ipv6 = 0; - const char *pret; - int ret; - struct in_addr tmp_v4; - struct hip_opendht_gw_info *gw_info; - - HIP_IFEL(!(gw_info = hip_get_param(msg, HIP_PARAM_OPENDHT_GW_INFO)), - -1, "No gw struct found\n"); - memset(&tmp_ip_str, '\0', 20); - tmp_ttl = gw_info->ttl; - tmp_port = htons(gw_info->port); - memcpy(tmp_host_name, gw_info->host_name, strlen(gw_info->host_name)); - - //hostname - if (strlen(tmp_host_name) > 0) { - is_hostname = 1; - } //ipv4 address - else if (IN6_IS_ADDR_V4MAPPED(&gw_info->addr)) { - is_ipv4 = 1; - } //ipv6 address - else { - is_ipv6 = 1; - } - - if (is_hostname) { - ret = resolve_dht_gateway_info(tmp_host_name, - &opendht_serving_gateway, - tmp_port, AF_INET); - } else if (is_ipv4) { - IPV6_TO_IPV4_MAP(&gw_info->addr, &tmp_v4); - pret = inet_ntop(AF_INET, &tmp_v4, tmp_ip_str, 20); - HIP_DEBUG("Got address %s, port %d, TTL %d from hipconf\n", - tmp_ip_str, htons(gw_info->port), gw_info->ttl); - ret = resolve_dht_gateway_info(tmp_ip_str, - &opendht_serving_gateway, - tmp_port, AF_INET); - } else if (is_ipv6) { - pret = inet_ntop(AF_INET6, &gw_info->addr, tmp_ip_str6, 39); - HIP_DEBUG("Got address %s, port %d, TTL %d from hipconf\n", - tmp_ip_str6, htons(gw_info->port), gw_info->ttl); - ret = resolve_dht_gateway_info(tmp_ip_str6, - &opendht_serving_gateway, - tmp_port, AF_INET6); - } - - - if (ret == 0) { - HIP_DEBUG("Serving gateway changed\n"); - opendht_serving_gateway_ttl = tmp_ttl; - opendht_serving_gateway_port = tmp_port; - if (strlen(tmp_host_name) > 0) { - memset(opendht_host_name, '\0', sizeof(opendht_host_name)); - memcpy(opendht_host_name, tmp_host_name, strlen(tmp_host_name)); - } - hip_opendht_error_count = 0; - if (hip_opendht_sock_fqdn > 0) { - close(hip_opendht_sock_fqdn); - hip_opendht_sock_fqdn = init_dht_gateway_socket_gw(hip_opendht_sock_fqdn, opendht_serving_gateway); - hip_opendht_fqdn_sent = STATE_OPENDHT_IDLE; - } - if (hip_opendht_sock_hit > 0) { - close(hip_opendht_sock_hit); - hip_opendht_sock_hit = init_dht_gateway_socket_gw(hip_opendht_sock_hit, opendht_serving_gateway); - hip_opendht_hit_sent = STATE_OPENDHT_IDLE; - } - ret = hip_init_dht_sockets(&hip_opendht_sock_fqdn, &hip_opendht_fqdn_sent); - if (ret < 0) { - close(hip_opendht_sock_fqdn); - hip_opendht_sock_fqdn = -1; - } - ret = hip_init_dht_sockets(&hip_opendht_sock_hit, &hip_opendht_hit_sent); - if (ret < 0) { - close(hip_opendht_sock_hit); - hip_opendht_sock_hit = -1; - } - } else { - HIP_DEBUG("Error in changing the serving gateway!"); - } - } - break; - case HIP_MSG_DHT_SERVING_GW: - { - struct in_addr ip_gw; - struct in6_addr ip_gw_mapped; - int rett = 0, errr = 0; - struct sockaddr_in *sa; - if (opendht_serving_gateway == NULL) { - opendht_serving_gateway = malloc(sizeof(struct addrinfo)); - memset(opendht_serving_gateway, 0, sizeof(struct addrinfo)); - } - if (opendht_serving_gateway->ai_addr == NULL) { - opendht_serving_gateway->ai_addr = malloc(sizeof(struct sockaddr_in)); - memset(opendht_serving_gateway->ai_addr, 0, sizeof(struct sockaddr_in)); - } - sa = (struct sockaddr_in *) (void *) opendht_serving_gateway->ai_addr; - rett = inet_pton(AF_INET, inet_ntoa(sa->sin_addr), &ip_gw); - IPV4_TO_IPV6_MAP(&ip_gw, &ip_gw_mapped); - hip_msg_init(msg); - errr = hip_build_user_hdr(msg, HIP_MSG_DHT_SERVING_GW, 0); - if (errr) { - HIP_ERROR("Build hdr failed: %s\n", strerror(errr)); - } - if (hip_opendht_inuse == HIP_MSG_DHT_ON) { - /* FIXME -> see Bug 952 in bugzilla - * hip_build_param_opendht_gw_info expects the hostname - * as last parameter. - */ - errr = hip_build_param_opendht_gw_info(msg, &ip_gw_mapped, - opendht_serving_gateway_ttl, - opendht_serving_gateway_port, NULL); - } else { /* not in use mark port and ttl to 0 so 'client' knows */ - /* FIXME -> see Bug 952 in bugzilla - * hip_build_param_opendht_gw_info expects the hostname - * as last parameter. - */ - errr = hip_build_param_opendht_gw_info(msg, &ip_gw_mapped, 0, 0, NULL); - } - - if (errr) { - HIP_ERROR("Build param hit failed: %s\n", strerror(errr)); - goto out_err; - } - HIP_DEBUG("Building gw_info complete\n"); - } - break; - case HIP_MSG_DHT_SET: - { - struct hip_opendht_set *name_info; - err = 0; - HIP_IFEL(!(name_info = hip_get_param(msg, HIP_PARAM_OPENDHT_SET)), -1, - "no name struct found\n"); - _HIP_DEBUG("Name in name_info %s\n", name_info->name); - memcpy(opendht_name_mapping, &name_info->name, HIP_HOST_ID_HOSTNAME_LEN_MAX); - HIP_DEBUG("Name received from hipconf %s\n", &opendht_name_mapping); - } - break; -#endif /* CONFIG_HIP_DHT */ case HIP_MSG_CERT_SPKI_VERIFY: { HIP_DEBUG("Got an request to verify SPKI cert\n"); @@ -444,31 +302,6 @@ hip_recreate_all_precreated_r1_packets(); } break; -#ifdef CONFIG_HIP_DHT - case HIP_MSG_DHT_ON: - { - HIP_DEBUG("Setting DHT ON\n"); - hip_opendht_inuse = HIP_MSG_DHT_ON; - HIP_DEBUG("hip_opendht_inuse = %d (should be %d)\n", - hip_opendht_inuse, HIP_MSG_DHT_ON); - } - { - int dhterr = 0; - dhterr = hip_init_dht(); - if (dhterr < 0) { - HIP_DEBUG("Initializing DHT returned error\n"); - } - } - break; - case HIP_MSG_DHT_OFF: - { - HIP_DEBUG("Setting DHT OFF\n"); - hip_opendht_inuse = HIP_MSG_DHT_OFF; - HIP_DEBUG("hip_opendht_inuse = %d (should be %d)\n", - hip_opendht_inuse, HIP_MSG_DHT_OFF); - } - break; -#endif /* CONFIG_HIP_DHT */ case HIP_MSG_SET_HIPPROXY_ON: { @@ -708,15 +541,6 @@ 0, HIP_FLAG_CONTROL_TRAFFIC_ONLY); } - - // Refresh locators stored in DHT -#ifdef CONFIG_HIP_DHT - if (hip_opendht_inuse == HIP_MSG_DHT_ON) { - /* First remove the old one -samu */ - hip_dht_remove_current_hdrr(); - hip_register_to_dht(); - } -#endif } /* Workaround for bug id 880 until bug id 589 is implemented. @@ -962,15 +786,6 @@ err = hip_netdev_trigger_bex_msg(msg); goto out_err; break; -#ifdef CONFIG_HIP_DHT - case HIP_MSG_VERIFY_DHT_HDRR_RESP: // Added by Pardeep to verify signature and host id - /* This case verifies host id in the value (HDRR) against HIT used as a key for DHT - * And it also verifies the signature in HDRR - * This works on the hip common message sent to the daemon - * */ - hip_verify_hdrr(msg, NULL); - break; -#endif case HIP_MSG_USERSPACE_IPSEC: HIP_DUMP_MSG(msg); err = hip_userspace_ipsec_activate(msg); === modified file 'lib/conf/conf.c' --- lib/conf/conf.c 2010-05-12 13:57:56 +0000 +++ lib/conf/conf.c 2010-05-16 17:58:14 +0000 @@ -42,7 +42,6 @@ #include "lib/core/straddr.h" #include "conf.h" #include "lib/core/prefix.h" -#include "lib/dht/libhipdht.h" #include "lib/core/hostid.h" #include "lib/core/message.h" #include "lib/core/crypto.h" @@ -70,15 +69,13 @@ #define TYPE_CONFIG 11 #define TYPE_RUN EXEC_LOADLIB_HIP /* Should be 12 */ #define TYPE_TTL 13 -#define TYPE_GW 14 -#define TYPE_GET 15 +/* free slots */ #define TYPE_HA 16 #define TYPE_MHADDR 17 #define TYPE_DEBUG 18 #define TYPE_DAEMON 19 #define TYPE_LOCATOR 20 -#define TYPE_SET 21 /* DHT set <name> */ -#define TYPE_DHT 22 +/* free slots */ #define TYPE_OPPTCP 23 #define TYPE_ORDER 24 /* free slot */ @@ -143,10 +140,6 @@ #endif "heartbeat <seconds> (0 seconds means off)\n" "get ha all|HIT\n" - "opendht on|off\n" - "dht gw <IPv4|hostname> <port (OpenDHT default = 5851)> <TTL>\n" - "dht get <fqdn/hit>\n" - "dht set <name>\n" "locator on|off|get\n" "debug all|medium|none\n" "restart daemon\n" @@ -489,10 +482,6 @@ ret = ACTION_RUN; } else if (!strcmp("load", argv[1])) { ret = ACTION_LOAD; - } else if (!strcmp("dht", argv[1])) { - ret = ACTION_DHT; - } else if (!strcmp("opendht", argv[1])) { - ret = ACTION_OPENDHT; } else if (!strcmp("heartbeat", argv[1])) { ret = ACTION_HEARTBEAT; } else if (!strcmp("locator", argv[1])) { @@ -568,7 +557,6 @@ case ACTION_RST: case ACTION_BOS: case ACTION_LOCATOR: - case ACTION_OPENDHT: case ACTION_HEARTBEAT: case ACTION_HIT_TO_LSI: case ACTION_DATAPACKET: @@ -592,7 +580,6 @@ case ACTION_GET: case ACTION_RUN: case ACTION_LOAD: - case ACTION_DHT: case ACTION_HA: case ACTION_MHADDR: case ACTION_TRANSORDER: @@ -678,18 +665,10 @@ #endif else if (!strcmp("order", text)) { ret = TYPE_ORDER; - } else if (strcmp("opendht", argv[1]) == 0) { - ret = TYPE_DHT; } else if (strcmp("heartbeat", argv[1]) == 0) { ret = TYPE_HEARTBEAT; } else if (!strcmp("ttl", text)) { ret = TYPE_TTL; - } else if (!strcmp("gw", text)) { - ret = TYPE_GW; - } else if (!strcmp("get", text)) { - ret = TYPE_GET; - } else if (!strcmp("set", text)) { - ret = TYPE_SET; } else if (!strcmp("config", text)) { ret = TYPE_CONFIG; } @@ -750,8 +729,6 @@ case ACTION_GET: case ACTION_RUN: case ACTION_LOAD: - case ACTION_DHT: - case ACTION_OPENDHT: case ACTION_BUDDIES: case ACTION_HEARTBEAT: case ACTION_LOCATOR: @@ -1928,260 +1905,6 @@ } /** - * Function that is used to set the name sent to DHT in name/fqdn -> HIT -> IP mappings - * - * @param msg input/output message for the query/response for hipd - * @param action unused - * @param opt hostname - * @param optc 1 - * @param send_only 1 if no response from hipd should be requrested, or 0 if - * should block for a response from hipd - * @return zero on success, or negative error value on error. - */ -static int hip_conf_handle_set(hip_common_t *msg, - int action, - const char *opt[], - int optc, - int send_only) -{ - int err = 0; - int len_name = 0; - len_name = strlen(opt[0]); - HIP_DEBUG("Name received from user: %s (len = %d (max 256))\n", opt[0], len_name); - HIP_IFEL((len_name > 255), -1, "Name too long, max 256\n"); - - err = hip_build_user_hdr(msg, HIP_MSG_DHT_SET, 0); - if (err) { - HIP_ERROR("Failed to build user message header.: %s\n", strerror(err)); - goto out_err; - } - - err = hip_build_param_opendht_set(msg, opt[0]); - if (err) { - HIP_ERROR("build param hit failed: %s\n", strerror(err)); - goto out_err; - } -out_err: - return err; -} - -/** - * Function that is used to set the used gateway addr port and ttl with DHT - * e.g. hipconf dht gw <hostname|HIT|IP> 5851 600 - * - * @param msg input/output message for the query/response for hipd - * @param action unused - * @param opt hostname|HIT|IP, port and ttl (as strings) - * @param optc 3 - * @param send_only 1 if no response from hipd should be requrested, or 0 if - * should block for a response from hipd - * @return zero on success, or negative error value on error. - */ -static int hip_conf_handle_gw(hip_common_t *msg, - int action, - const char *opt[], - int optc, - int send_only) -{ - int err; - int ret_HIT = 0, ret_IP = 0, ret_HOSTNAME = 0; - struct in_addr ip_gw; - struct in6_addr ip_gw_mapped; - char hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX]; - - HIP_INFO("Resolving new gateway for openDHT %s\n", opt[0]); - - memset(hostname, '\0', HIP_HOST_ID_HOSTNAME_LEN_MAX); - - if (optc != 3) { - HIP_ERROR("Missing arguments\n"); - err = -EINVAL; - goto out_err; - } - - if (strlen(opt[0]) > 39) { //address longer than size of ipv6 address - HIP_ERROR("Address longer than maximum allowed\n"); - err = -EINVAL; - goto out_err; - } - - ret_IP = inet_pton(AF_INET, opt[0], &ip_gw); - ret_HIT = inet_pton(AF_INET6, opt[0], &ip_gw_mapped); - - if (!(ret_IP || ret_HIT)) { - memcpy(hostname, opt[0], HIP_HOST_ID_HOSTNAME_LEN_MAX - 1); - hostname[HIP_HOST_ID_HOSTNAME_LEN_MAX - 1] = '\0'; - ret_HOSTNAME = 1; - } - - if (ret_IP) { - IPV4_TO_IPV6_MAP(&ip_gw, &ip_gw_mapped); - } - - if (ret_IP || ret_HIT) { - HIP_DEBUG_IN6ADDR("Address ", &ip_gw_mapped); - } else { - HIP_DEBUG("Host name : %s\n", hostname); - } - - err = hip_build_user_hdr(msg, HIP_MSG_DHT_GW, 0); - if (err) { - HIP_ERROR("Failed to build user message header.: %s\n", strerror(err)); - goto out_err; - } - - err = hip_build_param_opendht_gw_info(msg, &ip_gw_mapped, - atoi(opt[2]), atoi(opt[1]), hostname); - if (err) { - HIP_ERROR("build param hit failed: %s\n", strerror(err)); - goto out_err; - } - -out_err: - return err; -} - -/** - * Function that gets data from DHT - * - * @param msg input/output message for the query/response for hipd - * @param action unused - * @param opt hostname or HIT as a string - * @param optc 1 - * @param send_only 1 if no response from hipd should be requrested, or 0 if - * should block for a response from hipd - * @return zero for success and negative on error - */ -static int hip_conf_handle_get(hip_common_t *msg, - int action, - const char *opt[], - int optc, - int send_only) -{ -#ifdef CONFIG_HIP_DHT - int err = 0, is_hit = 0, socket = 0; - hip_hit_t hit; - unsigned char dht_response[HIP_MAX_PACKET]; - struct addrinfo *serving_gateway; - struct hip_opendht_gw_info *gw_info; - struct hip_host_id *hid; - struct in_addr tmp_v4; - struct in6_addr reply6; - char tmp_ip_str[INET_ADDRSTRLEN]; - int tmp_ttl, tmp_port; - const char *pret; - - memset(&hit, 0, sizeof(hip_hit_t)); - - /* ASK THIS INFO FROM DAEMON */ - HIP_INFO("Asking serving gateway info from daemon...\n"); - HIP_IFEL(hip_build_user_hdr(msg, HIP_MSG_DHT_SERVING_GW, 0), -1, - "Building daemon header failed\n"); - HIP_IFEL(hip_send_recv_daemon_info(msg, send_only, 0), -1, - "Send recv daemon info failed\n"); - HIP_IFEL(!(gw_info = hip_get_param(msg, HIP_PARAM_OPENDHT_GW_INFO)), -1, - "No gw struct found\n"); - - /* Check if DHT was on */ - if ((gw_info->ttl == 0) && (gw_info->port == 0)) { - HIP_INFO("DHT is not in use\n"); - goto out_err; - } - memset(&tmp_ip_str, '\0', sizeof(tmp_ip_str)); - tmp_ttl = gw_info->ttl; - tmp_port = htons(gw_info->port); - IPV6_TO_IPV4_MAP(&gw_info->addr, &tmp_v4); - pret = inet_ntop(AF_INET, &tmp_v4, tmp_ip_str, 20); - HIP_INFO("Got address %s, port %d, TTL %d from daemon\n", - tmp_ip_str, tmp_port, tmp_ttl); - - is_hit = inet_pton(AF_INET6, opt[0], &hit); - - /* If this is 1 then it is hit (actually any ipv6 would do), if 0 then hostname */ - if (is_hit < 0 && errno == EAFNOSUPPORT) { - HIP_PERROR("inet_pton: not a valid address family\n"); - err = -EAFNOSUPPORT; - goto out_err; - } - - HIP_DEBUG("Resolve the gateway address\n"); - HIP_IFEL(resolve_dht_gateway_info(tmp_ip_str, &serving_gateway, tmp_port, AF_INET), 0, - "Resolve error!\n"); - - HIP_DEBUG("Initialize socket\n"); - socket = init_dht_gateway_socket_gw(socket, serving_gateway); - - _HIP_DEBUG("Connect the DHT socket\n"); - err = connect_dht_gateway(socket, serving_gateway, 1); - - HIP_DEBUG("Send get msg\n"); - HIP_IFEL((err = opendht_get(socket, (unsigned char *) opt[0], - (unsigned char *) tmp_ip_str, tmp_port)), 0, "DHT get error\n"); - - HIP_DEBUG("Read response\n"); - HIP_IFE((err = opendht_read_response(socket, dht_response)), -1); - - _HIP_DEBUG("is_hit %d err %d\n", is_hit, err); - - if (is_hit == 1 && err >= 0) { - _HIP_DUMP_MSG(dht_response); - _HIP_DEBUG("Returned locators above\n"); - /* hip_print_locator_addresses((struct hip_common *)dht_response); */ - /* Verify signature */ - HIP_IFEL(!(hid = hip_get_param((struct hip_common *) dht_response, - HIP_PARAM_HOST_ID)), -ENOENT, - "No HOST_ID found in DHT response\n"); - - HIP_IFEL((err = hip_verify_packet_signature((struct hip_common *) dht_response, - hid)), -1, - "Failed to verify the signature in HDRR\n"); - HIP_DEBUG("HDRR signature successfully verified\n"); - } else if (is_hit == 0 && err >= 0) { - memcpy(&((&reply6)->s6_addr), dht_response, sizeof(reply6.s6_addr)); - HIP_DEBUG_HIT("Returned HIT", &reply6); - } - hip_msg_init(msg); -out_err: - return err; -#else /* CONFIG_HIP_DHT */ - return -1; -#endif /* CONFIG_HIP_DHT */ -} - -/** - * Function that is used to set DHT on or off - * - * @param msg input/output message for the query/response for hipd - * @param action unused - * @param opt "on" or "off" - * @param optc 1 - * @param send_only 1 if no response from hipd should be requrested, or 0 if - * should block for a response from hipd - * @return zero for success and negative on error - */ -static int hip_conf_handle_dht_toggle(hip_common_t *msg, - int action, - const char *opt[], - int optc, - int send_only) -{ - int err = 0, status = 0; - - if (!strcmp("on", opt[0])) { - status = HIP_MSG_DHT_ON; - } else if (!strcmp("off", opt[0])) { - status = HIP_MSG_DHT_OFF; - } else { - HIP_IFEL(1, -1, "bad args\n"); - } - HIP_IFEL(hip_build_user_hdr(msg, status, 0), -1, - "Failed to build user message header.: %s\n", strerror(err)); - -out_err: - return err; -} - -/** * Set BUDDIES extension on or off * * @param msg input/output message for the query/response for hipd @@ -2628,12 +2351,10 @@ libs[0] = "libhiptool.so"; libs[1] = NULL; libs[2] = NULL; - libs[3] = "libhipopendht.so"; } else if (type == EXEC_LOADLIB_OPP) { libs[0] = "libopphip.so"; libs[1] = "libhiptool.so"; libs[2] = NULL; - libs[3] = "libhipopendht.so"; } hip_append_pathtolib(libs, lib_all, LIB_LENGTH); @@ -2754,8 +2475,8 @@ /** * Turn nsupdate extension on or off. The nsupdate extension publishes - * the HIT and IP address of the host on a given DNS server (as an alternative - * to DHT). Useful especially with mobility. + * the HIT and IP address of the host on a given DNS server. + * Useful especially with mobility. * * @param msg a pointer to the buffer where the message for hipd will * be written. @@ -3100,15 +2821,15 @@ hip_conf_handle_load, /* 11: TYPE_CONFIG */ hip_conf_handle_run_normal, /* 12: TYPE_RUN */ NULL, /* was 13: TYPE_TTL */ - hip_conf_handle_gw, /* 14: TYPE_GW */ - hip_conf_handle_get, /* 15: TYPE_GET */ + NULL, /* 14: unused */ + NULL, /* 15: unused */ hip_conf_handle_ha, /* 16: TYPE_HA */ hip_conf_handle_mhaddr, /* 17: TYPE_MHADDR */ hip_conf_handle_debug, /* 18: TYPE_DEBUG */ hip_conf_handle_restart, /* 19: TYPE_DAEMON */ hip_conf_handle_locator, /* 20: TYPE_LOCATOR */ - hip_conf_handle_set, /* 21: TYPE_SET */ - hip_conf_handle_dht_toggle, /* 22: TYPE_DHT */ + NULL, /* 21: unused */ + NULL, /* 22: unused */ hip_conf_handle_opptcp, /* 23: TYPE_OPPTCP */ hip_conf_handle_trans_order, /* 24: TYPE_ORDER */ NULL, === modified file 'lib/conf/conf.h' --- lib/conf/conf.h 2010-05-12 13:57:56 +0000 +++ lib/conf/conf.h 2010-05-16 17:58:14 +0000 @@ -72,7 +72,6 @@ # hit-to-ip set hit-to-ip.infrahip.net. # resolve HITs to locators in dynamic DNS zone\n\ nsupdate on # send dynamic DNS updates\n\ # add server rvs hiprvs.infrahip.net 50000 # Register to free RVS at infrahip\n\ -opendht on # turn DHT support on (use /etc/hip/dhtservers to define the used server)\n\ # heartbeat 10 # send ICMPv6 messages inside HIP tunnels\n\ # locator on # host sends all of its locators in base exchange\n\ # datapacket on # experimental draft hiccups extensions\n\ @@ -151,7 +150,7 @@ #define ACTION_GET 9 #define ACTION_RUN 10 #define ACTION_LOAD 11 -#define ACTION_DHT 12 +/* free slot */ #define ACTION_HA 13 #define ACTION_RST 14 #define ACTION_BOS 15 @@ -159,7 +158,7 @@ #define ACTION_MHADDR 17 #define ACTION_RESTART 18 #define ACTION_LOCATOR 19 -#define ACTION_OPENDHT 20 +/* free slot */ /* free slot (was for ACTION_OPPTCP 21) */ #define ACTION_TRANSORDER 22 #define ACTION_TCPTIMEOUT 23 /* add By Tao Wan, on 04.01.2008 */ === modified file 'lib/core/builder.c' --- lib/core/builder.c 2010-05-12 16:09:38 +0000 +++ lib/core/builder.c 2010-05-16 17:58:14 +0000 @@ -1151,7 +1151,6 @@ case HIP_MSG_SET_OPPORTUNISTIC_MODE: return "HIP_MSG_SET_OPPORTUNISTIC_MODE"; case HIP_MSG_SET_BLIND_ON: return "HIP_MSG_SET_BLIND_ON"; case HIP_MSG_SET_BLIND_OFF: return "HIP_MSG_SET_BLIND_OFF"; - case HIP_MSG_DHT_GW: return "HIP_MSG_DHT_GW"; case HIP_MSG_SET_DEBUG_ALL: return "HIP_MSG_SET_DEBUG_ALL"; case HIP_MSG_SET_DEBUG_MEDIUM: return "HIP_MSG_SET_DEBUG_MEDIUM"; case HIP_MSG_SET_DEBUG_NONE: return "HIP_MSG_SET_DEBUG_NONE"; @@ -1160,9 +1159,6 @@ case HIP_MSG_RESTART: return "HIP_MSG_RESTART"; case HIP_MSG_SET_LOCATOR_ON: return "HIP_MSG_SET_LOCATOR_ON"; case HIP_MSG_SET_LOCATOR_OFF: return "HIP_MSG_SET_LOCATOR_OFF"; - case HIP_MSG_DHT_SET: return "HIP_MSG_DHT_SET"; - case HIP_MSG_DHT_ON: return "HIP_MSG_DHT_ON"; - case HIP_MSG_DHT_OFF: return "HIP_MSG_DHT_OFF"; case HIP_MSG_HIT_TO_IP_ON: return "HIP_MSG_HIT_TO_IP_ON"; case HIP_MSG_HIT_TO_IP_OFF: return "HIP_MSG_HIT_TO_IP_OFF"; case HIP_MSG_HIT_TO_IP_SET: return "HIP_MSG_HIT_TO_IP_SET"; @@ -1203,7 +1199,6 @@ case HIP_MSG_NSUPDATE_ON: return "HIP_MSG_NSUPDATE_ON"; case HIP_MSG_NSUPDATE_OFF: return "HIP_MSG_NSUPDATE_OFF"; case HIP_MSG_HEARTBEAT: return "HIP_MSG_HEARTBEAT"; - case HIP_MSG_DHT_SERVING_GW: return "HIP_MSG_DHT_SERVING_GW"; case HIP_MSG_SET_NAT_PORT: return "HIP_MSG_SET_NAT_PORT"; case HIP_MSG_SHOTGUN_ON: return "HIP_MSG_SHOTGUN_ON"; case HIP_MSG_SHOTGUN_OFF: return "HIP_MSG_SHOTGUN_OFF"; @@ -1275,8 +1270,6 @@ case HIP_PARAM_KEYS: return "HIP_PARAM_KEYS"; case HIP_PARAM_LOCATOR: return "HIP_PARAM_LOCATOR"; case HIP_PARAM_NOTIFICATION: return "HIP_PARAM_NOTIFICATION"; - case HIP_PARAM_OPENDHT_GW_INFO: return "HIP_PARAM_OPENDHT_GW_INFO"; - case HIP_PARAM_OPENDHT_SET: return "HIP_PARAM_OPENDHT_SET"; case HIP_PARAM_PORTPAIR: return "HIP_PARAM_PORTPAIR"; case HIP_PARAM_PUZZLE: return "HIP_PARAM_PUZZLE"; case HIP_PARAM_CHALLENGE_REQUEST: return "HIP_PARAM_CHALLENGE_REQUEST"; @@ -3768,69 +3761,6 @@ } /** - * Append a parameter into a message that defines the hostname under - * which to publish HIT-IP records in a Distribute Hash Table (DHT). - * Can be used only for interprocess communications. - * - * @param msg a pointer to the message where the parameter will be - * appended - * @param name the hostname - * @return zero on success, or negative on failure - */ -int hip_build_param_opendht_set(struct hip_common *msg, const char *name) -{ - int err = 0; - struct hip_opendht_set name_info; - hip_set_param_type((struct hip_tlv_common *) &name_info, - HIP_PARAM_OPENDHT_SET); - hip_calc_param_len((struct hip_tlv_common *) &name_info, - sizeof(struct hip_opendht_set) - - sizeof(struct hip_tlv_common)); - strcpy(name_info.name, name); - err = hip_build_param(msg, &name_info); - return err; -} - -/** - * Append a parameter into a message to set the DHT gateway. - * Can be used only for interprocess communications. - * - * @param msg a pointer to the message where the parameter will be - * appended - * @param addr the address of the DTH gateway - * @param ttl time to live (TTL) value for published records in the DHT - * @param port the the transport layer port of the DHT service - * @param host_name optional hostname for the DHT gateway - * @return zero on success, or negative on failure - */ -int hip_build_param_opendht_gw_info(struct hip_common *msg, - struct in6_addr *addr, - uint32_t ttl, - uint16_t port, - char *host_name) -{ - int err = 0; - struct hip_opendht_gw_info gw_info; - - hip_set_param_type((struct hip_tlv_common *) &gw_info, - HIP_PARAM_OPENDHT_GW_INFO); - hip_calc_param_len((struct hip_tlv_common *) &gw_info, - sizeof(struct hip_opendht_gw_info) - - sizeof(struct hip_tlv_common)); - gw_info.ttl = ttl; - gw_info.port = htons(port); - //added +1 because the \0 was not being copied at the end of the string - if (host_name != NULL) { - memcpy(&gw_info.host_name, host_name, strlen(host_name) + 1); - } else { - memset(&gw_info.host_name, '\0', sizeof(gw_info.host_name)); - } - ipv6_addr_copy(&gw_info.addr, addr); - err = hip_build_param(msg, &gw_info); - return err; -} - -/** * Build and append a SPKI infor parameter into a HIP control message (on-the-wire) * * @param msg a pointer to the message where the parameter will be @@ -3937,29 +3867,6 @@ } /** - * Build and append a HDRR parameter into a HIP control message. Used for - * publishing host identifiers in a DHT. - * - * @param msg a pointer to the message where the parameter will be - * appended - * @param hdrr_info a prefilled hdrr_info structure - * @return zero on success, or negative on failure - * @see <a href="http://tools.ietf.org/html/draft-ahrenholz-hiprg-dht";> - * draft-ahrenholz-hiprg-dht</a> - */ -int hip_build_param_hip_hdrr_info(struct hip_common *msg, - struct hip_hdrr_info *hdrr_info) -{ - int err = 0; - hip_set_param_type((struct hip_tlv_common *) hdrr_info, HIP_PARAM_HDRR_INFO); - hip_calc_param_len((struct hip_tlv_common *) hdrr_info, - sizeof(struct hip_hdrr_info) - - sizeof(struct hip_tlv_common)); - err = hip_build_param(msg, hdrr_info); - return err; -} - -/** * Build an append a zone parameter for hit-to-ip extension. * * @param msg a pointer to the message where the parameter will be === modified file 'lib/core/builder.h' --- lib/core/builder.h 2010-05-12 16:09:38 +0000 +++ lib/core/builder.h 2010-05-16 17:58:14 +0000 @@ -163,12 +163,6 @@ int hip_build_param_cert_x509_resp(struct hip_common *, char *, int); int hip_build_param_cert_x509_ver(struct hip_common *, char *, int); -int hip_build_param_opendht_set(struct hip_common *, const char *); -int hip_build_param_opendht_gw_info(struct hip_common *, - struct in6_addr *, - uint32_t, - uint16_t, - char *); int hip_build_param_hit_to_ip_set(struct hip_common *, const char *); int hip_build_user_hdr(struct hip_common *, hip_hdr_type_t, hip_hdr_err_t); void hip_calc_hdr_len(struct hip_common *); @@ -226,8 +220,6 @@ struct endpoint_hip **endpoint, se_hip_flags_t endpoint_flags, const char *hostname); -int hip_build_param_hip_hdrr_info(struct hip_common *msg, - struct hip_hdrr_info *hdrr_info); int hip_build_param_reg_info(hip_common_t *msg, const void *service_list, const unsigned int service_count); === modified file 'lib/core/hostsfiles.c' --- lib/core/hostsfiles.c 2010-04-13 15:59:48 +0000 +++ lib/core/hostsfiles.c 2010-05-16 17:58:14 +0000 @@ -207,53 +207,6 @@ } /** - * A "for-each" iterator function for hosts files to calculate - * the number of non-commented lines - * - * @param entry a hosts file line entry - * @param arg unused, but required by the API - * @param result an int pointer where the number of lines - * will be calculated - * @return always one - */ -static int hip_calc_lines_in_hosts(const struct hosts_file_line *entry, - const void *arg, - void *result) -{ - int *res = (int *) result; - (*res)++; - return 1; -} - -/** - * A "for-each" iterator function for hosts files that returns the Nth - * identifier (address, LSI or HIT) from a hosts file - * - * @param entry a hosts file line entry - * @param arg the N as an int pointer - * @param result An output argument where the matching matching address will be - * written. IPv4 addresses are written in IPv6 mapped format and - * the minimum buffer length is sizeof(struct in6_addr). - * @return zero on match or one otherwise - */ -static int hip_get_nth_id_from_hosts(const struct hosts_file_line *entry, - const void *arg, - void *result) -{ - int err = 1; - const int *nth = (const int *) arg; - int *total_past = (int *) result; - - if (*nth == *total_past) { - ipv6_addr_copy(result, &entry->id); - err = 0; - } else { - (*total_past)++; - } - return err; -} - -/** * "For-each" loop to iterate through /etc/hosts or /etc/hip/hosts file, line * by line. * @@ -496,64 +449,6 @@ } /** - * Fetch a random host name from a hosts file. Currently this - * is used for selecting a random DHT node for load balancing. - * - * @param filename the hosts file path and file name - * @param hostname the hostname will be written here - * @param id_str The address, LSI or HIT corresponding to the - * the hostname will be written here as a string. - * @return zero on successful match or non-zero on failure - */ -int hip_get_random_hostname_id_from_hosts(char *filename, - char *hostname, - char *id_str) -{ - int lines = 0, err = 0, nth; - struct in6_addr id; - - memset(&id, 0, sizeof(struct in6_addr)); - - /* ignore return value, returns always error */ - hip_for_each_hosts_file_line(filename, - hip_calc_lines_in_hosts, - NULL, - &lines); - HIP_IFEL((lines == 0), -1, - "No lines in host file %s\n", filename); - - srand(time(NULL)); - nth = rand() % lines; - - err = hip_for_each_hosts_file_line(filename, - hip_get_nth_id_from_hosts, - &nth, - &id); - HIP_IFEL(err, -1, "Failed to get random id\n"); - - err = hip_for_each_hosts_file_line(filename, - hip_map_first_id_to_hostname_from_hosts, - &id, - hostname); - HIP_IFEL(err, -1, "Failed to map to hostname\n"); - - if (IN6_IS_ADDR_V4MAPPED(&id)) { - struct in_addr id4; - IPV6_TO_IPV4_MAP(&id, &id4); - HIP_IFEL(!inet_ntop(AF_INET, &id4, id_str, - INET_ADDRSTRLEN), -1, - "inet_ntop failed\n"); - } else { - HIP_IFEL(!inet_ntop(AF_INET6, &id, id_str, - INET6_ADDRSTRLEN), -1, - "inet_ntop failed\n"); - } - -out_err: - return err; -} - -/** * This function maps a HIT or a LSI (nodename) to an IP address using the two hosts files. * The function implements this in two steps. First, it maps the HIT or LSI to an hostname * from /etc/hip/hosts or /etc/hosts. Second, it maps the hostname to a IP address from === modified file 'lib/core/hostsfiles.h' --- lib/core/hostsfiles.h 2010-04-29 14:59:33 +0000 +++ lib/core/hostsfiles.h 2010-05-16 17:58:14 +0000 @@ -34,9 +34,6 @@ hip_lsi_t *lsi, struct in6_addr *ip); int hip_map_lsi_to_hostname_from_hosts(hip_lsi_t *lsi, char *hostname); -int hip_get_random_hostname_id_from_hosts(char *filename, - char *hostname, - char *id_str); int hip_host_file_info_exists_lsi(hip_lsi_t *lsi); #endif /* HIP_LIB_CORE_HOSTSFILES_H */ === modified file 'lib/core/icomm.h' --- lib/core/icomm.h 2010-05-12 16:09:38 +0000 +++ lib/core/icomm.h 2010-05-16 17:58:14 +0000 @@ -58,8 +58,7 @@ /* Free slots here */ #define HIP_MSG_GET_HITS 21 #define HIP_MSG_GET_HA_INFO 22 -#define HIP_MSG_DHT_SERVING_GW 24 -/* free slot */ +/* free slots */ #define HIP_MSG_GET_LSI_PEER 26 /* several free slots here */ #define HIP_MSG_HEARTBEAT 31 @@ -86,12 +85,10 @@ #define HIP_MSG_SET_OPPORTUNISTIC_MODE 78 #define HIP_MSG_SET_BLIND_ON 79 #define HIP_MSG_SET_BLIND_OFF 80 -/** Socket option for hipconf to change the used gateway with OpenDHT */ -#define HIP_MSG_DHT_GW 81 +/* free slot */ #define HIP_MSG_SET_DEBUG_ALL 82 #define HIP_MSG_SET_DEBUG_MEDIUM 83 #define HIP_MSG_SET_DEBUG_NONE 84 -/** Socket option for hipconf to ask about the used gateway with OpenDHT */ #define HIP_MSG_LOCATOR_GET 85 #define HIP_MSG_MHADDR_ACTIVE 86 #define HIP_MSG_MHADDR_LAZY 87 @@ -99,9 +96,7 @@ #define HIP_MSG_RESTART 88 #define HIP_MSG_SET_LOCATOR_ON 89 #define HIP_MSG_SET_LOCATOR_OFF 90 -#define HIP_MSG_DHT_SET 91 -#define HIP_MSG_DHT_ON 92 -#define HIP_MSG_DHT_OFF 93 +/* free slots */ #define HIP_MSG_SET_OPPTCP_ON 94 #define HIP_MSG_SET_OPPTCP_OFF 95 @@ -165,7 +160,6 @@ /* free slot */ #define HIP_MSG_FW_BEX_DONE 157 #define HIP_MSG_RESTART_DUMMY_INTERFACE 158 -#define HIP_MSG_VERIFY_DHT_HDRR_RESP 159 /* free slots */ #define HIP_MSG_BUDDIES_ON 162 #define HIP_MSG_BUDDIES_OFF 163 === modified file 'lib/core/message.c' --- lib/core/message.c 2010-04-16 01:36:19 +0000 +++ lib/core/message.c 2010-05-16 17:58:14 +0000 @@ -36,19 +36,6 @@ * initializing itself. So, the use of asynchronous messages avoided * the chicken-egg-problem here. * - * It is also possible to send a synchronous message but process it - * asynchronously on the other end with the help of queues. An example - * of this is "hipconf dht get <hostname>" which is - * synchronous. However, hipd cannot process immediately because it - * has to wait for a response from DHT. As hipd is currently single - * threaded, it cannot block until it gets a response from the DHT - * because it could take for ever and other HIP connections should not - * be punished for this. As a solution, the DHT code in hipd implements a - * queue for the query messages and stores also the sender (hipconf - * process) port numbers. Hipd delivers the responses as soon as information - * is retrieved from the DHT. A similar solution was implemented for - * opportunistic mode connections. - * * It should be also noticed the there is an optional timeout period * to wait for responses of synchronous messages. When the timeout is * exceeded, the called function will return an error and unblocks the === modified file 'lib/core/protodefs.h' --- lib/core/protodefs.h 2010-05-12 16:09:38 +0000 +++ lib/core/protodefs.h 2010-05-16 17:58:14 +0000 @@ -48,7 +48,7 @@ #define HIP_CLOSE 18 #define HIP_CLOSE_ACK 19 /* 20 was already occupied by HIP_PSIG so shifting HIP_PSIG and HIP_TRIG plus 1*/ -#define HIP_HDRR 20 +/* free slot */ #define HIP_PSIG 21 ///< lightweight HIP pre signature #define HIP_TRIG 22 ///< lightweight HIP signature trigger #define HIP_LUPDATE 23 @@ -176,14 +176,14 @@ #define HIP_PARAM_KEYS 32779 #define HIP_PARAM_PSEUDO_HIT 32780 #define HIP_PARAM_BLIND_NONCE 32785 /**< Pass blind nonce */ -#define HIP_PARAM_OPENDHT_GW_INFO 32786 +/* free slot */ #define HIP_PARAM_ENCAPS_MSG 32787 #define HIP_PARAM_PORTPAIR 32788 #define HIP_PARAM_SRC_ADDR 32789 #define HIP_PARAM_DST_ADDR 32790 /* free slot */ #define HIP_PARAM_HA_INFO 32792 -#define HIP_PARAM_OPENDHT_SET 32793 +/* free slot */ #define HIP_PARAM_CERT_SPKI_INFO 32794 #define HIP_PARAM_SRC_TCP_PORT 32795 #define HIP_PARAM_DST_TCP_PORT 32796 @@ -204,7 +204,6 @@ #define HIP_PARAM_CERT_X509_RESP 32811 #define HIP_PARAM_ESP_PROT_TFM 32812 #define HIP_PARAM_TRANSFORM_ORDER 32813 -#define HIP_PARAM_HDRR_INFO 32814 /* free slots */ #define HIP_PARAM_SECRET 32817 #define HIP_PARAM_BRANCH_NODES 32818 @@ -1121,15 +1120,6 @@ uint16_t nonce; } __attribute__ ((packed)); -struct hip_opendht_gw_info { - hip_tlv_type_t type; - hip_tlv_len_t length; - struct in6_addr addr; - uint32_t ttl; - uint16_t port; - char host_name[256]; -} __attribute__ ((packed)); - struct hip_cert_x509_req { hip_tlv_type_t type; hip_tlv_len_t length; @@ -1149,12 +1139,6 @@ int transorder; } __attribute__ ((packed)); -struct hip_opendht_set { - hip_tlv_type_t type; - hip_tlv_len_t length; - char name[HIP_HOST_ID_HOSTNAME_LEN_MAX]; -} __attribute__ ((packed)); - #define HIT_TO_IP_ZONE_MAX_LEN 256 @@ -1164,15 +1148,6 @@ char name[HIT_TO_IP_ZONE_MAX_LEN]; } __attribute__ ((packed)); -struct hip_hdrr_info { - hip_tlv_type_t type; - hip_tlv_len_t length; - struct in6_addr dht_key; - /* 0 if succesfully verified otherwise negative */ - int sig_verified; - int hit_verified; -} __attribute__ ((packed)); - struct hip_heartbeat { hip_tlv_type_t type; hip_tlv_len_t length; === removed directory 'lib/dht' === modified file 'packaging/hipl-deb.spec' --- packaging/hipl-deb.spec 2010-05-12 16:09:38 +0000 +++ packaging/hipl-deb.spec 2010-05-16 17:58:14 +0000 @@ -9,7 +9,7 @@ Vendor: InfraHIP License: GPLv2 Group: System Environment/Kernel -BuildRequires: automake, autoconf, libtool, gcc, libssl-dev, libxml2-dev, xmlto, doxygen, iptables-dev, libcap-dev +BuildRequires: automake, autoconf, libtool, gcc, libssl-dev, xmlto, doxygen, iptables-dev, libcap-dev ExclusiveOS: linux BuildRoot: %{_tmppath}/%{name}-%{version}-root Prefix: /usr @@ -82,7 +82,7 @@ %package lib Summary: HIP for Linux libraries Group: System Environment/Kernel -Requires: openssl, libxml2, iptables, libcap2 +Requires: openssl, iptables, libcap2 %description lib %package daemon @@ -110,7 +110,7 @@ %package dnsproxy Requires: python, hipl-lib -Summary: Name look-up proxy for HIP for Linux. Intercepts DNS look-ups and returns HIT or LSIs when corresponding entries are found in DNS, DHT or hosts files +Summary: Name look-up proxy for HIP for Linux. Intercepts DNS look-ups and returns HIT or LSIs when corresponding entries are found in DNS or hosts files Group: System Environment/Kernel %description dnsproxy === modified file 'packaging/hipl-rpm.spec' --- packaging/hipl-rpm.spec 2010-05-12 16:09:38 +0000 +++ packaging/hipl-rpm.spec 2010-05-16 17:58:14 +0000 @@ -8,7 +8,7 @@ Vendor: InfraHIP License: GPLv2 Group: System Environment/Kernel -BuildRequires: gcc gcc-c++ openssl-devel libxml2-devel iptables-devel xmlto libtool libcap-devel autoconf automake xmlto rpm-build +BuildRequires: gcc gcc-c++ openssl-devel iptables-devel xmlto libtool libcap-devel autoconf automake xmlto rpm-build ExclusiveOS: linux BuildRoot: %{_tmppath}/%{name}-%{version}-root Prefix: /usr @@ -65,7 +65,7 @@ %package lib Summary: HIP for Linux libraries Group: System Environment/Kernel -Requires: openssl libxml2 iptables libcap +Requires: openssl iptables libcap %description lib %package daemon @@ -93,7 +93,7 @@ %package dnsproxy Requires: python hipl-lib -Summary: Name look-up proxy for HIP for Linux. Intercepts DNS look-ups and returns HIT or LSIs when corresponding entries are found in DNS, DHT or hosts files +Summary: Name look-up proxy for HIP for Linux. Intercepts DNS look-ups and returns HIT or LSIs when corresponding entries are found in DNS or hosts files Group: System Environment/Kernel %description dnsproxy === modified file 'packaging/openwrt/package/Makefile' --- packaging/openwrt/package/Makefile 2010-05-12 16:09:38 +0000 +++ packaging/openwrt/package/Makefile 2010-05-16 17:58:14 +0000 @@ -71,7 +71,7 @@ #note: modules will be automatically selected for compilation and #will be required by ipkg on the openwrt box #TODO remove unnecessary modules - DEPENDS:=+libconfig +kmod-crypto-aes +kmod-crypto-hmac +kmod-crypto-null +kmod-crypto-sha1 +kmod-ipv6 +libgcc +libopenssl +libxml2 + DEPENDS:=+libconfig +kmod-crypto-aes +kmod-crypto-hmac +kmod-crypto-null +kmod-crypto-sha1 +kmod-ipv6 +libgcc +libopenssl TITLE:=HIPL common files URL:=http://hipl.hiit.fi/ endef @@ -82,12 +82,11 @@ CONFIGURE_VARS += \ LIBS="-lz" \ - CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2 -I$(STAGING_DIR)/usr/include/libconfig" + CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libconfig" define Build/Configure $(call Build/Configure/Default, \ --enable-shared \ - --disable-dht \ --disable-debug \ ); endef === modified file 'tools/hipdnsproxy/hipdnsproxy' --- tools/hipdnsproxy/hipdnsproxy 2010-04-28 17:49:19 +0000 +++ tools/hipdnsproxy/hipdnsproxy 2010-05-16 17:58:14 +0000 @@ -18,7 +18,7 @@ # - Non-HIP records # - Hostname to HIT resolution # - HITs and LSIs from /etc/hip/hosts -# - On-the-fly generated LSI; HIT either from from DNS, DHT or hosts +# - On-the-fly generated LSI; HIT either from from DNS or hosts # - HI records from DNS # - HITs from Bamboo via hipd # - PTR records: maps HITs to hostnames from /etc/hip/hosts @@ -312,7 +312,6 @@ gp.sent_queue = [] gp.sent_queue_d = {} # Keyed by ('server_ip',server_port,query_id) tuple gp.prefix = None - gp.disable_dht = False # required for ifconfig and hipconf in Fedora # (rpm and "make install" targets) os.environ['PATH'] += ':/sbin:/usr/sbin:/usr/local/sbin' @@ -515,21 +514,6 @@ f.write('%s\n' % myid) f.close() - def dht_lookup(gp, nam): - #gp.fout.write("DHT look up\n") - cmd = "hipconf dht get " + nam + " 2>&1" - #gp.fout.write("Command: %s\n" % (cmd)) - p = Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout - result = p.readline() - # xx fixme: we should query cache for PTR records - while result: - start = result.find("2001:001") - end = result.find('\n') - if start != -1 and end != -1: - return result[start:end] - result = p.readline() - return None - # Add local HITs to hosts files (bug id 737). # xx fixme: should we really write the local hits # to a file rather than just adding them @@ -661,15 +645,8 @@ dns_hit_found = True break - dhthit = None - if not gp.disable_dht and not dns_hit_found: - dhthit = gp.dht_lookup(qname) - if dhthit is not None: - gp.fout.write('DHT match: %s %s\n' % (qname, dhthit)) - g1['answers'].append([qname, 55, 1, gp.hosts_ttl ,dhthit]) - lsi = None - hit_found = dns_hit_found or dhthit is not None + hit_found = dns_hit_found is not None if hit_found: hit_ans = [] lsi_ans = [] @@ -678,13 +655,8 @@ if a1[1] != 55: continue - if dhthit is not None: # already an AAAA record - hit = dhthit - a1[1] = 28 - hit_ans.append(a1) - else: - hit = socket.inet_ntop(socket.AF_INET6, a1[7]) - hit_ans.append([qname, 28, 1, a1[3], hit]) + hit = socket.inet_ntop(socket.AF_INET6, a1[7]) + hit_ans.append([qname, 28, 1, a1[3], hit]) if qtype == 1 and not gp.disable_lsi: lsi = gp.map_hit_to_lsi(hit) @@ -1000,7 +972,6 @@ 'dns-timeout=', 'leave-resolv-conf', 'hip-domain-prefix=', - 'nodht', ]) except getopt.error, msg: usage(1, msg) @@ -1036,8 +1007,6 @@ gp.overwrite_resolv_conf = False elif opt == '--hip-domain-prefix': gp.prefix = arg + '.' - elif opt == '--nodht': - gp.disable_dht = True child = False; if (gp.fork): === modified file 'tools/hipl_autobuild.sh' --- tools/hipl_autobuild.sh 2010-05-13 12:01:07 +0000 +++ tools/hipl_autobuild.sh 2010-05-16 17:58:14 +0000 @@ -109,10 +109,10 @@ run_program "make -j17 distcheck" # PISA configuration -compile --enable-firewall --disable-rvs --disable-hipproxy --disable-opportunistic --disable-dht --disable-blind --disable-profiling --enable-debug --enable-midauth --disable-performance --disable-demo +compile --enable-firewall --disable-rvs --disable-hipproxy --disable-opportunistic --disable-blind --disable-profiling --enable-debug --enable-midauth --disable-performance --disable-demo # Alternative path to vanilla -compile --enable-firewall --disable-rvs --disable-hipproxy --disable-opportunistic --disable-dht --enable-blind --enable-profiling --disable-debug --enable-midauth --enable-performance --enable-demo +compile --enable-firewall --disable-rvs --disable-hipproxy --disable-opportunistic --enable-blind --enable-profiling --disable-debug --enable-midauth --enable-performance --enable-demo # Compile HIPL within an OpenWrt checkout CONFIGURATION="OpenWrt ARM crosscompile"