From e2bc56287d428518c2603d9ff28923ad480fb8dc Mon Sep 17 00:00:00 2001 From: max Date: Mon, 26 Aug 2019 18:37:52 +0300 Subject: [PATCH] src/config/opt.c: parse localhost(r-host parametr '-a') as 127.0.0.1 src/Makefile.am: some change for uninstall --- src/Makefile.am | 6 +++++- src/config/opt.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 254ec15ec..e8663f4ba 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -97,7 +97,8 @@ DEFS = @DEFS@ -DLOCALEDIR=\"${localedir}\" #nodist_include_HEADERS = config/config.h.in teonetincludedir=$(includedir)/teonet - +teobaseincludedir=$(includedir)/teobase +teocclincludedir=$(includedir)/teoccl #teonetinclude_HEADERS = nobase_teonetinclude_HEADERS = \ crypt.h \ @@ -223,3 +224,6 @@ libteonet_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(LIBRARY_MAJOR_VERSION):0:0 uninstall-local: -rm -r $(teonetincludedir) + -rm -r $(teobaseincludedir) + -rm -r $(teocclincludedir) + diff --git a/src/config/opt.c b/src/config/opt.c index 1a6f99f9f..5a427f932 100644 --- a/src/config/opt.c +++ b/src/config/opt.c @@ -206,9 +206,15 @@ char ** ksnet_optRead(int argc, char **argv, ksnet_cfg *conf, conf->r_tcp_port = atoi(optarg); break; - case 'a': - strncpy((char*)conf->r_host_addr, optarg, KSN_BUFFER_SM_SIZE/2); - break; + case 'a': { + const char *localhost_str = "localhost"; + const char *localhost_num = "127.0.0.1"; + if (!strncmp(localhost_str, optarg, strlen(localhost_str))) { + strncpy((char*)conf->r_host_addr, localhost_num, strlen(localhost_num)); + } else { + strncpy((char*)conf->r_host_addr, optarg, KSN_BUFFER_SM_SIZE/2); + } + } break; case 'i': strncpy((char*)conf->vpn_ip, optarg, KSN_BUFFER_SM_SIZE/2);