As I was saying on my previous submition I'm not sure that checking for /proc/net/if_inet6 is useful at this point. that also mean that if the os support ipv6 and the LISTEN param is not set the server will switch to an IPV6 scheme by default. Is this acceptable ?
regards, JP Le 26 mars 2012 12:02, Eduardo Silva <[email protected]> a écrit : > i have created a bug for this issue: > > http://bugs.monkey-project.com/ticket/139 > > On Mon, Mar 26, 2012 at 2:02 AM, Jean-Paul Bonnet <[email protected]> > wrote: > > Hum this patch is no good, > > I'll submit an other one when I get back from work > > > > regards, > > JP > > > > Le 25 mars 2012 22:48, Jean-Paul Bonnet <[email protected]> a écrit : > > > >> Hi > >> > >> Here is a patch for the cheetah bug. > >> Not sure if the check on /proc/net/if_inet6 is the perfect solution or > >> even relevant in this situation > >> A review and some pointers would be much appreciated. > >> > >> regards, > >> JP > >> > >> Le 25 mars 2012 19:29, Eduardo Silva <[email protected]> a écrit : > >> > >>> Hi, > >>> > >>> the right fix is that mk_api->config->listen_addr should never be NULL. > >>> > >>> regards, > >>> > >>> On Sun, Mar 25, 2012 at 12:03 AM, Sourabh Chandak < > [email protected]> > >>> wrote: > >>> > Hi, > >>> > > >>> > Fixed the segmentation fault which occurred when the command to > >>> > retrieve > >>> > global configuration is called. > >>> > > >>> > -- > >>> > Sourabh Chandak > >>> > > >>> > > >>> > > >>> > >>> > >>> > >>> -- > >>> Eduardo Silva > >>> http://edsiper.linuxchile.cl > >>> http://www.monkey-project.com > >>> _______________________________________________ > >>> Monkey mailing list > >>> [email protected] > >>> http://lists.monkey-project.com/listinfo/monkey > >> > >> > > > > > > -- > Eduardo Silva > http://edsiper.linuxchile.cl > http://www.monkey-project.com >
From 46b53b04cabe7666d280cbe8438f41cabb210b05 Mon Sep 17 00:00:00 2001 From: jpbonnet <[email protected]> Date: Mon, 26 Mar 2012 19:45:23 +0100 Subject: [PATCH] cheetah: #139 invalid value for config->listen_addr --- plugins/cheetah/cmd.c | 5 +++-- src/include/mk_config.h | 3 ++- src/include/mk_utils.h | 2 +- src/mk_config.c | 10 ++++++++-- src/mk_utils.c | 10 ++++++++++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/plugins/cheetah/cmd.c b/plugins/cheetah/cmd.c index b3a8e7c..c9fa255 100644 --- a/plugins/cheetah/cmd.c +++ b/plugins/cheetah/cmd.c @@ -311,8 +311,9 @@ void mk_cheetah_cmd_config() CHEETAH_WRITE("Basic configuration"); CHEETAH_WRITE("\n-------------------"); CHEETAH_WRITE("\nServer Port : %i", mk_api->config->serverport); - - if (strcmp(mk_api->config->listen_addr, "0.0.0.0") == 0) { + + if (strcmp(mk_api->config->listen_addr, "0.0.0.0") || + strcmp(mk_api->config->listen_addr, "::") == 0) { CHEETAH_WRITE("\nListen : All interfaces"); } else { diff --git a/src/include/mk_config.h b/src/include/mk_config.h index 7efb8fc..8a9af59 100644 --- a/src/include/mk_config.h +++ b/src/include/mk_config.h @@ -33,7 +33,8 @@ #endif #define M_DEFAULT_CONFIG_FILE "monkey.conf" -#define MK_DEFAULT_LISTEN_ADDR NULL +#define MK_DEFAULT_LISTEN_ADDR_IPV4 "0.0.0.0" +#define MK_DEFAULT_LISTEN_ADDR_IPV6 "::" #define MK_WORKERS_DEFAULT 1 #define VALUE_ON "on" diff --git a/src/include/mk_utils.h b/src/include/mk_utils.h index b52ca73..17df997 100644 --- a/src/include/mk_utils.h +++ b/src/include/mk_utils.h @@ -81,5 +81,5 @@ int mk_utils_worker_rename(const char *title); void mk_utils_stacktrace(void); #endif - +int mk_utils_file_exists(const char *path); #endif diff --git a/src/mk_config.c b/src/mk_config.c index e47f5c7..e80823a 100644 --- a/src/mk_config.c +++ b/src/mk_config.c @@ -401,8 +401,12 @@ static void mk_config_read_files(char *path_conf, char *file_conf) /* Listen */ config->listen_addr = mk_config_section_getval(section, "Listen", MK_CONFIG_VAL_STR); + if (!config->listen_addr && mk_utils_file_exists("/proc/net/if_inet6")) { + config->listen_addr = MK_DEFAULT_LISTEN_ADDR_IPV6; + } + if (!config->listen_addr) { - config->listen_addr = MK_DEFAULT_LISTEN_ADDR; + config->listen_addr = MK_DEFAULT_LISTEN_ADDR_IPV4; } /* Connection port */ @@ -672,7 +676,7 @@ void mk_config_set_init_values(void) config->max_keep_alive_request = 50; config->resume = MK_TRUE; config->standard_port = 80; - config->listen_addr = MK_DEFAULT_LISTEN_ADDR; + config->listen_addr = NULL; config->serverport = 2001; config->symlink = MK_FALSE; config->nhosts = 0; @@ -770,3 +774,5 @@ void mk_config_sanity_check() close(fd); } } + + diff --git a/src/mk_utils.c b/src/mk_utils.c index be00b9c..f9fa68b 100644 --- a/src/mk_utils.c +++ b/src/mk_utils.c @@ -569,3 +569,13 @@ void mk_utils_stacktrace(void) } #endif + +int mk_utils_file_exists(const char* path) +{ + int exist = access(path, F_OK); + if (exist == 0) { + return 1; + } else { + return 0; + } +} -- 1.7.4.1
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
