Committer: Tim Just <tim.just@xxxxxxxxxxxxxx> Date: 16/03/2010 at 15:24:49 Revision: 3684 Revision-id: tim.just@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Branch nick: tiny Log: Fixed bug in process_modules.py A semicolon was missing in the generated header files, if all modules are disabled. Added further checks, if the list of disabled modules is empty and if the modules directory exists. The last check is needed for out-of-source builds. Modified: M hipd/init.c M hipd/init.h M hipd/user.c M process_modules.py === modified file 'hipd/init.c' --- hipd/init.c 2010-03-16 12:57:53 +0000 +++ hipd/init.c 2010-03-16 13:24:41 +0000 @@ -8,16 +8,21 @@ /* required for s6_addr32 */ #define _BSD_SOURCE +#include <netinet/icmp6.h> #include <sys/prctl.h> +#include <sys/resource.h> +#include <sys/stat.h> +#include <sys/time.h> #include <sys/types.h> -#include <netinet/icmp6.h> +#include <sys/utsname.h> +#include <sys/wait.h> #include "config.h" +#include "init.h" #include "esp_prot_light_update.h" #include "hip_socket.h" -#include "init.h" -#include "oppdb.h" -#include "nat.h" +#include "nsupdate.h" +#include "modularization.h" #include "lib/core/common_defines.h" #include "lib/core/debug.h" #include "lib/core/hip_capability.h" @@ -26,6 +31,7 @@ #include "lib/core/hip_udp.h" #include "lib/core/hostsfiles.h" #include "lib/performance/performance.h" +#include "lib/tool/xfrmapi.h" #include "modules/hipd_modules.h" /** @@ -34,13 +40,6 @@ */ #define HIP_DAEMON_LOCK_FILE HIPL_LOCKDIR "/hipd.lock" -/* 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" - - #ifndef ANDROID_CHANGES /** ICMPV6_FILTER related stuff */ @@ -71,8 +70,6 @@ #endif /* ANDROID_CHANGES */ -/******************************************************************************/ -/** Catch SIGCHLD. */ static void hip_sig_chld(int signum) { #ifdef ANDROID_CHANGES @@ -229,8 +226,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 === modified file 'hipd/init.h' --- hipd/init.h 2010-03-08 15:47:13 +0000 +++ hipd/init.h 2010-03-16 13:24:41 +0000 @@ -1,28 +1,8 @@ #ifndef HIP_HIPD_INIT_H #define HIP_HIPD_INIT_H -#include <sys/types.h> -#include <sys/stat.h> #include <sys/socket.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <sys/wait.h> -#include <sys/utsname.h> - -#include "lib/tool/xfrmapi.h" -#include "lib/conf/hipconf.h" -#include "oppipdb.h" -#include "lib/core/debug.h" -#include "hiprelay.h" -#include "tcptimeout.h" -#include "hadb.h" -#include "nsupdate.h" - -/* - * HIP daemon initialization functions. - * - */ - +#include "lib/core/protodefs.h" extern hip_ipsec_func_set_t default_ipsec_func_set; extern int hip_firewall_sock_fd; @@ -39,5 +19,4 @@ 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/user.c' --- hipd/user.c 2010-03-11 16:19:14 +0000 +++ hipd/user.c 2010-03-16 13:24:41 +0000 @@ -19,6 +19,7 @@ #include "config.h" #include "user.h" #include "esp_prot_anchordb.h" +#include "nsupdate.h" #include "lib/core/hostid.h" #include "lib/core/hip_udp.h" #include "hipd.h" @@ -135,9 +136,9 @@ HIP_IFEL(hip_build_user_hdr(msg, SO_HIP_LOCATOR_GET, 0), -1, "Failed to build user message header.: %s\n", strerror(err)); - if ((err = hip_build_locators_old(msg, 0)) < 0) { - HIP_DEBUG("LOCATOR parameter building failed\n"); - } +// if ((err = hip_build_locators_old(msg, 0)) < 0) { +// HIP_DEBUG("LOCATOR parameter building failed\n"); +// } break; case SO_HIP_SET_LOCATOR_ON: HIP_DEBUG("Setting LOCATOR ON\n"); @@ -898,7 +899,7 @@ } case SO_HIP_MANUAL_UPDATE_PACKET: /// @todo : 13.11.2009: Should we use the msg? - err = hip_send_locators_to_all_peers(); +// err = hip_send_locators_to_all_peers(); break; default: HIP_ERROR("Unknown socket option (%d)\n", msg_type); === modified file 'process_modules.py' --- process_modules.py 2010-03-16 11:17:17 +0000 +++ process_modules.py 2010-03-16 13:24:41 +0000 @@ -1,9 +1,8 @@ #!/usr/bin/python import getopt, glob, os, sys, xml.dom.minidom - ### Constants ### -INFO_FILE_PATH = 'project_info.xml' +INFO_FILE_NAME = 'project_info.xml' APPLICATION_TAG_NAME = 'application' APPLICATION_ATTR_NAME = 'name' @@ -206,6 +205,9 @@ # pointers for each application def create_header_files(output_dir, suffix, applications, includes, init_functions): + if False == os.path.isdir(output_dir): + os.mkdir(output_dir) + for current_app in applications.keys(): hdr_file_path = os.path.join(output_dir, current_app + suffix) @@ -240,7 +242,7 @@ hdr_file.write('\nconst int num_modules_' + current_app + ' = 0;') hdr_file.write('\n\nstatic const pt2Function ' + current_app) - hdr_file.write('_init_functions[0] = {}') + hdr_file.write('_init_functions[0] = {};') hdr_file.write('\n\n#endif /* ' + app_string + ' */') hdr_file.close() @@ -258,7 +260,10 @@ makefile_modules = open(file_path, 'w') enabled_modules = module_info.keys() - all_modules = enabled_modules + list(disabled_modules) + if not disabled_modules: + all_modules = enabled_modules + else: + all_modules = enabled_modules + disabled_modules if 'all' == compile_type: compile_modules = all_modules @@ -303,10 +308,13 @@ else: assert False, "unhandled option" - disabled_modules = disabled_modules.rsplit(' ') + if disabled_modules: + disabled_modules = disabled_modules.rsplit(' ') - (applications, compile_type, disabled_modules) = parse_info_file(INFO_FILE_PATH, - disabled_modules) + (applications, + compile_type, + disabled_modules) = parse_info_file(os.path.join(srcdir, INFO_FILE_NAME), + disabled_modules) module_info = read_module_info(MODULES_DIR, disabled_modules,