Skip to content

Commit

Permalink
src/config/opt.c: parse localhost(r-host parametr '-a') as 127.0.0.1
Browse files Browse the repository at this point in the history
src/Makefile.am: some change for uninstall
  • Loading branch information
angelskieglazki committed Aug 26, 2019
1 parent 474b8f6 commit e2bc562
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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)

12 changes: 9 additions & 3 deletions src/config/opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e2bc562

Please sign in to comment.