remove __UMH__ (user-mode HIP) ifdefs throughout code

this was always defined, as kernel-only mode is no longer supported


git-svn-id: svn://svn.code.sf.net/p/openhip/code/hip/trunk@224 4c5cb64f-9889-4596-9799-84b02dc3effa
This commit is contained in:
Jeff Ahrenholz 2012-03-19 22:32:32 +00:00
parent ff3ef026f6
commit 8b477c0b94
9 changed files with 9 additions and 111 deletions

View File

@ -46,7 +46,7 @@ SRCW32 = win32
# /MT is for threading /MD for MSVCRT.LIB
# /GZ enable runtime debug checks, /Zi enable debugging information, /MDd debug lib
# /MDd for debug
CFLAGS= /MD /Ox /O2 /Ob2 /W3 /WX /Gs0 /GF /Gy /Zi /Zp1 /nologo -DWIN32_LEAN_AND_MEAN $(INC) -D__UMH__ -D__WIN32__ -DCONFIG_HIP -DSYSCONFDIR="\".\""
CFLAGS= /MD /Ox /O2 /Ob2 /W3 /WX /Gs0 /GF /Gy /Zi /Zp1 /nologo -DWIN32_LEAN_AND_MEAN $(INC) -D__WIN32__ -DCONFIG_HIP -DSYSCONFDIR="\".\""
OBJS = $(SRC)\$(SRCPROTO)\hip_addr.obj \
$(SRC)\$(SRCPROTO)\hip_cache.obj \

View File

@ -41,15 +41,15 @@ SRC_PROTO = protocol/hip_addr.c protocol/hip_cache.c protocol/hip_dht.c \
SRC_UTIL = util/hip_util.c util/hip_xml.c
# Linux main files
SRC_MAIN_UMH = linux/hip_linux_umh.c
SRC_HIP = linux/hip_linux_umh.c
# Hitgen source files
SRC_HITGEN = util/hitgen.c util/hip_util.c protocol/hip_globals.c
hitgen_CFLAGS = -DHITGEN -D__UMH__
hitgen_CFLAGS = -DHITGEN
# Usermode version
hip_CFLAGS = -D__UMH__
hip_CFLAGS =
SRC_USERMODE = usermode/hip_umh_main.c \
usermode/hip_dns.c \
usermode/hip_esp.c \
@ -77,7 +77,7 @@ endif
# different targets
hitgen_SOURCES = $(SRC_HITGEN)
hip_SOURCES = $(SRC_PROTO) $(SRC_UTIL) $(SRC_MAIN_UMH) $(SRC_USERMODE)
hip_SOURCES = $(SRC_HIP) $(SRC_PROTO) $(SRC_UTIL) $(SRC_USERMODE)
hipstatus_SOURCES = util/usermode-status.c
AM_COLOR_TESTS=always

View File

@ -261,9 +261,7 @@ void log_hipopts();
#ifdef __WIN32__
void log_WinError(int code);
#endif
#ifdef __UMH__
int do_bcast();
#endif
void hip_sleep(int seconds);
void hip_writelock();
void hip_exit(int signal);

View File

@ -101,35 +101,4 @@ enum responses {
HIP_STATUS_REPLY_MAX
};
/* Problems with multiple definitions of the arrays below */
#ifndef __UMH__
/*
* Useful text definitions
*/
const char enc_alg_texts[7][28] = {
"",
"AES CBC with HMAC SHA1",
"3DES CBC with HMAC SHA1",
"3DES CBC with HMAC MD5",
"BLOWFISH CBC with HMAC SHA1",
"NULL with HMAC SHA1",
"NULL with HMAC MD5",
};
const char state_texts[9][16] = {
"Unassociated",
"I1 Sent",
"I2 Sent",
"R2 Sent",
"Established",
"Rekeying",
"Closing",
"Closed",
"E Failed",
};
#endif
#endif /* _HIP_STATUS_H_ */

View File

@ -1110,12 +1110,10 @@ connect_retry:
log_(WARN, "DHT connect - bind error: %s\n", strerror(errno));
}
#ifdef __UMH__
if (g_state != 0)
{
return(-1);
}
#endif
if (retry && (retry_attempts > 0))
{
/* quit after a certain number of retries */

View File

@ -59,11 +59,9 @@
#include <netinet/ip.h> /* struct iphdr */
#include <unistd.h> /* fork(), getpid() */
#include <math.h> /* pow() */
#ifdef __UMH__
#include <pthread.h>
#include <netdb.h>
#endif
#endif
#include <sys/types.h> /* getpid() support, etc */
#include <signal.h> /* signal() */
#include <openssl/crypto.h> /* OpenSSL's crypto library */
@ -112,11 +110,9 @@ static void hip_retransmit_waiting_packets(struct timeval *time1);
int hip_trigger(struct sockaddr *dst);
int hip_trigger_rvs(struct sockaddr*rvs, hip_hit *responder);
#ifdef __UMH__
#ifndef __WIN32__
void post_init_tap();
#endif
#endif
#ifdef HIP_VPLS
void endbox_init();
#endif
@ -163,12 +159,6 @@ int main_loop(int argc, char **argv)
/* Initializing global variables */
memset(hip_assoc_table, 0, sizeof(hip_assoc_table));
#ifndef __UMH__
/* Initialize OpenSSL crypto library, if not already done
* in init_hip() */
init_crypto();
#endif
/*
* Set default options
* later modified by command-line parameters
@ -375,21 +365,6 @@ int main_loop(int argc, char **argv)
exit(1);
}
#ifndef __UMH__ /* don't mix pthreads with fork() */
if (OPT.daemon)
{
if (fork() > 0)
{
return(0);
}
/* TODO: properly daemonize the program here:
* change file mode mask
* setsid() obtain a new process group
* chdir("/")
* replace stdout, stderr, stdin
*/
}
#endif
if (init_log() < 0)
{
goto hip_main_error_exit;
@ -537,10 +512,8 @@ int main_loop(int argc, char **argv)
gettimeofday(&time1, NULL);
last_expire = time1.tv_sec;
hip_dht_update_my_entries(1); /* initalize and publish */
#ifdef __UMH__
#ifndef __WIN32__
post_init_tap();
#endif
#endif
/* Status socket */
if (hip_status_open() < 0)
@ -631,12 +604,10 @@ int main_loop(int argc, char **argv)
/* this line causes a performance hit, used for debugging... */
fflush_log();
#ifdef __UMH__
if (g_state != 0)
{
return(-EINTR);
}
#endif
/* prepare file descriptor sets */
FD_ZERO(&read_fdset);
@ -683,11 +654,9 @@ int main_loop(int argc, char **argv)
/* sometimes select receives interrupt in addition
* to the hip_exit() signal handler */
if (errno == EINTR)
#ifdef __UMH__
{ return(-EINTR); }
#else
{ hip_exit(SIGINT); }
#endif
{
return(-EINTR);
}
log_(WARN, "select() error: %s.\n", strerror(errno));
}
else if (err == 0)
@ -732,13 +701,11 @@ int main_loop(int argc, char **argv)
{
/* Something on HIP socket */
flags = 0;
#ifdef __UMH__
/* extra check to prevent recvmsg() from blocking */
if (g_state != 0)
{
return(-EINTR);
}
#endif
#ifdef __WIN32__
addr_from_len = sizeof(addr_from);
length = recvfrom(s_hip, buff, sizeof(buff), flags,

View File

@ -71,7 +71,6 @@
#include <hip/hip_proto.h>
#include <hip/hip_globals.h>
#include <hip/hip_funcs.h>
#ifdef __UMH__
#ifdef __WIN32__
#include <WinDNS.h>
#define NS_MAXDNAME DNS_MAX_NAME_LENGTH
@ -81,7 +80,6 @@
#include <resolv.h> /* res_search() */
#endif /* __WIN32__ */
#include <hip/hip_dns.h> /* DNS headers */
#endif
#ifdef HIP_VPLS
#include <hip/hip_cfg_api.h>
#endif
@ -567,9 +565,6 @@ int get_preferred_lsi(struct sockaddr *lsi)
{
hi_node *hi = NULL;
__u32 lsi32;
#ifndef __UMH__
int g_state = 0; /* dummy var */
#endif
#ifndef __WIN32__
struct timeval timeout;
#endif
@ -1364,7 +1359,6 @@ struct sockaddr *get_hip_dns_server()
}
}
#ifdef __UMH__
int is_dns_thread_disabled()
{
return(HCNF.disable_dns_thread);
@ -1683,8 +1677,6 @@ __u32 receive_hip_dns_response(unsigned char *buff, int len)
return(0);
}
#endif /* __UMH__ */
/*
* function hits_equal()
*/
@ -3456,10 +3448,8 @@ void log_WinError(int code)
log_(NORM, "error %d: %s", code, lpMsgBuf);
LocalFree(lpMsgBuf);
}
#endif
#ifdef __UMH__
/*
* Access HCNF.enable_bcast
*/
@ -3468,7 +3458,6 @@ int do_bcast()
return(HCNF.enable_bcast == TRUE);
}
#endif
/*
* Platform-independent sleep function.
@ -3551,11 +3540,7 @@ void hip_exit(int signal)
#ifndef __WIN32__
int err;
char lockname[255];
#endif
#ifdef __UMH__
#ifndef __WIN32__
struct sockaddr_storage lsi;
#endif
#endif
static int been_here_before = 0;
if (been_here_before)
@ -3608,22 +3593,17 @@ void hip_exit(int signal)
/* Allow config library to perform any shutdown ops */
hipcfg_close();
#endif
#ifdef __UMH__
#ifndef __WIN32__
/* in Linux UMH, remove /etc/resolv.conf entry */
lsi.ss_family = AF_INET;
get_preferred_lsi(SA(&lsi));
delete_local_hip_nameserver(
((struct sockaddr_in *)&lsi)->sin_addr.s_addr );
delete_local_hip_nameserver( ((struct sockaddr_in *)&lsi)->sin_addr.s_addr );
#endif /* __WIN32__ */
g_state = 2;
printf("Shutting down threads...\n");
/* do not pthread_exit() here because
* this is just the signal handler
*/
#else
exit(signal);
#endif /* __UMH__ */
}
#endif /* HITGEN */

View File

@ -67,9 +67,7 @@
#ifdef HIP_VPLS
#include <hip/hip_cfg_api.h>
#endif /* HIP_VPLS */
#ifdef __UMH__
#include <hip/hip_dns.h> /* DNS headers */
#endif
/*
* function locate_config_file()
@ -420,7 +418,6 @@ int read_peer_identities_from_hipcfg()
memcpy(hi->hit, np->hit, sizeof(hip_hit));
__u32 lsi = ntohl(HIT2LSI(hi->hit));
#ifdef __UMH__ /* must have an LSI in UMH */
if (hits_equal(hi->hit, zero_hit))
{
log_(WARN, "No HIT or LSI for %s,", hi->name);
@ -428,12 +425,9 @@ int read_peer_identities_from_hipcfg()
free_hi_node(hi);
continue;
}
#endif
hi->lsi.ss_family = AF_INET;
memcpy(SA2IP(&hi->lsi), &lsi, sizeof(__u32));
#ifdef __UMH__
log_(NORM, "%s ", logaddr(SA(&hi->lsi)));
#endif
/* get HI name */
strcpy(name, hi->name);
@ -564,7 +558,6 @@ int read_identities_file(char *filename, int mine)
if (!VALID_FAM(&hi->lsi))
{
__u32 lsi = ntohl(HIT2LSI(hi->hit));
#ifdef __UMH__ /* must have an LSI in UMH */
if (hits_equal(hi->hit, zero_hit))
{
log_(WARN, "No HIT or LSI for %s,",
@ -573,7 +566,6 @@ int read_identities_file(char *filename, int mine)
free_hi_node(hi);
continue;
}
#endif
hi->lsi.ss_family = AF_INET;
memcpy(SA2IP(&hi->lsi), &lsi, sizeof(__u32));
}
@ -1185,7 +1177,6 @@ int read_conf_file(char *filename)
{
HCNF.disable_notify = FALSE;
}
#ifdef __UMH__
}
else if (strcmp((char *)node->name,
"disable_dns_thread") == 0)
@ -1210,7 +1201,6 @@ int read_conf_file(char *filename)
{
HCNF.enable_bcast = FALSE;
}
#endif
}
else if (strcmp((char *)node->name,
"disable_udp") == 0)

View File

@ -59,10 +59,8 @@
#include <hip/hip_globals.h>
/* dummy globals to fix undefined variables when building */
#ifdef __UMH__
int g_state;
int netlsp[2];
#endif
#ifdef __WIN32__
#define access _access
@ -453,11 +451,9 @@ void generate_conf_file(char *filename)
xmlNewChild(root_node, NULL, BAD_CAST "save_known_identities",
BAD_CAST "no");
xmlNewChild(root_node, NULL, BAD_CAST "disable_notify", BAD_CAST "no");
#ifdef __UMH__
xmlNewChild(root_node, NULL, BAD_CAST "disable_dns_thread",
BAD_CAST "yes");
xmlNewChild(root_node, NULL, BAD_CAST "enable_broadcast",BAD_CAST "no");
#endif
xmlNewChild(root_node, NULL, BAD_CAST "disable_udp",
#ifdef __MACOSX__
BAD_CAST "yes");