diff -Naur nagios-HEAD-old/base/commands.c nagios-HEAD/base/commands.c --- nagios-HEAD-old/base/commands.c 2010-10-23 13:00:46.000000000 +0300 +++ nagios-HEAD/base/commands.c 2010-12-09 04:10:35.000000000 +0200 @@ -2060,9 +2060,12 @@ real_host_name=temp_host->name; break; } - } + else if(!strcmp(host_name,temp_host->address6)){ + real_host_name=temp_host->name; + break; + } } - + } /* we couldn't find the host */ if(real_host_name==NULL){ logit(NSLOG_RUNTIME_WARNING,TRUE,"Warning: Passive check result was received for service '%s' on host '%s', but the host could not be found!\n",svc_description,host_name); @@ -2201,9 +2204,12 @@ real_host_name=temp_host->name; break; } - } + else if(!strcmp(host_name,temp_host->address6)){ + real_host_name=temp_host->name; + break; + } } - + } /* we couldn't find the host */ if(temp_host==NULL){ logit(NSLOG_RUNTIME_WARNING,TRUE,"Warning: Passive check result was received for host '%s', but the host could not be found!\n",host_name); diff -Naur nagios-HEAD-old/cgi/config.c nagios-HEAD/cgi/config.c --- nagios-HEAD-old/cgi/config.c 2010-10-28 15:31:40.000000000 +0300 +++ nagios-HEAD/cgi/config.c 2010-12-09 04:04:04.000000000 +0200 @@ -477,6 +477,7 @@ printf("Host Name"); printf("Alias/Description"); printf("Address"); + printf("Address6"); printf("Parent Hosts"); printf("Max. Check Attempts"); printf("Check Interval\n"); @@ -536,6 +537,7 @@ url_encode(temp_host->name),CONFIG_CGI,url_encode(temp_host->name),html_encode(temp_host->name,FALSE)); printf("%s\n",bg_class,html_encode(temp_host->alias,FALSE)); printf("%s\n",bg_class,html_encode(temp_host->address,FALSE)); + printf("%s\n",bg_class,html_encode(temp_host->address6,FALSE)); printf("",bg_class); for(temp_hostsmember=temp_host->parent_hosts;temp_hostsmember!=NULL;temp_hostsmember=temp_hostsmember->next){ diff -Naur nagios-HEAD-old/cgi/extinfo.c nagios-HEAD/cgi/extinfo.c --- nagios-HEAD-old/cgi/extinfo.c 2010-11-05 01:42:18.000000000 +0200 +++ nagios-HEAD/cgi/extinfo.c 2010-12-09 04:02:18.000000000 +0200 @@ -247,6 +247,9 @@ printf("function nagios_get_host_address()\n{\n"); printf("return \"%s\";\n",temp_host->address); printf("}\n"); + printf("function nagios_get_host_address6()\n{\n"); + printf("return \"%s\";\n",temp_host->address6); + printf("}\n"); if(temp_service!=NULL){ printf("function nagios_get_service_description()\n{\n"); printf("return \"%s\";\n",temp_service->description); @@ -351,7 +354,7 @@ if(found==FALSE) printf("No hostgroups"); printf("
\n"); - printf("
%s
\n",temp_host->address); + printf("
%s, %s
\n",temp_host->address,temp_host->address6); } if(display_type==DISPLAY_SERVICE_INFO){ printf("
Service
%s
On Host
\n",service_desc); @@ -371,7 +374,7 @@ printf("No servicegroups."); printf("
\n"); - printf("
%s
\n",temp_host->address); + printf("
%s, %s
\n",temp_host->address,temp_host->address6); } if(display_type==DISPLAY_HOSTGROUP_INFO){ printf("
Hostgroup
\n"); diff -Naur nagios-HEAD-old/cgi/status.c nagios-HEAD/cgi/status.c --- nagios-HEAD-old/cgi/status.c 2010-10-28 15:31:40.000000000 +0300 +++ nagios-HEAD/cgi/status.c 2010-12-09 04:14:20.000000000 +0200 @@ -274,6 +274,11 @@ host_name=strdup(temp_host->name); break; } + if(!strcmp(host_name,temp_host->address6)){ + free(host_name); + host_name=strdup(temp_host->name); + break; + } } if(temp_host==NULL){ for(temp_host=host_list;temp_host!=NULL;temp_host=temp_host->next){ diff -Naur nagios-HEAD-old/cgi/statusmap.c nagios-HEAD/cgi/statusmap.c --- nagios-HEAD-old/cgi/statusmap.c 2010-10-28 15:31:40.000000000 +0300 +++ nagios-HEAD/cgi/statusmap.c 2010-12-09 04:02:55.000000000 +0200 @@ -1955,6 +1955,7 @@ printf("Name:%s",escape_string(hst->name)); printf("Alias:%s",escape_string(hst->alias)); printf("Address:%s",html_encode(hst->address,TRUE)); + printf("Address6:%s",html_encode(hst->address6,TRUE)); printf("State:"); /* get the status of the host (pending, up, down, or unreachable) */ diff -Naur nagios-HEAD-old/cgi/statuswml.c nagios-HEAD/cgi/statuswml.c --- nagios-HEAD-old/cgi/statuswml.c 2009-06-19 07:30:26.000000000 +0300 +++ nagios-HEAD/cgi/statuswml.c 2010-12-09 04:00:31.000000000 +0200 @@ -952,7 +952,9 @@ printf("Host Commands
\n"); printf("Ping Host\n",STATUSWML_CGI,temp_host->address); + printf("Ping6 Host\n",STATUSWML_CGI,temp_host->address6); printf("Traceroute\n",STATUSWML_CGI,temp_host->address); + printf("Traceroute6\n",STATUSWML_CGI,temp_host->address6); if(temp_hoststatus->status!=HOST_UP && temp_hoststatus->status!=HOST_PENDING) printf("Acknowledge Problem\n"); diff -Naur nagios-HEAD-old/common/macros.c nagios-HEAD/common/macros.c --- nagios-HEAD-old/common/macros.c 2010-10-29 13:25:28.000000000 +0300 +++ nagios-HEAD/common/macros.c 2010-12-09 10:37:31.000000000 +0200 @@ -644,6 +644,7 @@ case MACRO_HOSTNAME: case MACRO_HOSTALIAS: case MACRO_HOSTADDRESS: + case MACRO_HOSTADDRESS6: case MACRO_LASTHOSTCHECK: case MACRO_LASTHOSTSTATECHANGE: case MACRO_HOSTOUTPUT: @@ -1574,6 +1575,9 @@ case MACRO_HOSTADDRESS: *output=(char *)strdup(temp_host->address); break; + case MACRO_HOSTADDRESS6: + *output=(char *)strdup(temp_host->address6); + break; #ifdef NSCORE case MACRO_HOSTSTATE: if(temp_host->current_state==HOST_DOWN) @@ -2496,6 +2500,7 @@ add_macrox_name(HOSTNAME); add_macrox_name(HOSTALIAS); add_macrox_name(HOSTADDRESS); + add_macrox_name(HOSTADDRESS6); add_macrox_name(SERVICEDESC); add_macrox_name(SERVICESTATE); add_macrox_name(SERVICESTATEID); @@ -2871,6 +2876,7 @@ case MACRO_HOSTDISPLAYNAME: case MACRO_HOSTALIAS: case MACRO_HOSTADDRESS: + case MACRO_HOSTADDRESS6: case MACRO_HOSTSTATE: case MACRO_HOSTSTATEID: case MACRO_HOSTCHECKTYPE: diff -Naur nagios-HEAD-old/common/objects.c nagios-HEAD/common/objects.c --- nagios-HEAD-old/common/objects.c 2010-11-11 12:11:24.000000000 +0200 +++ nagios-HEAD/common/objects.c 2010-12-09 03:45:58.000000000 +0200 @@ -593,7 +593,7 @@ /* add a new host definition */ -host *add_host(char *name, char *display_name, char *alias, char *address, char *check_period, int initial_state, double check_interval, double retry_interval, int max_attempts, int notify_up, int notify_down, int notify_unreachable, int notify_flapping, int notify_downtime, double notification_interval, double first_notification_delay, char *notification_period, int notifications_enabled, char *check_command, int checks_enabled, int accept_passive_checks, char *event_handler, int event_handler_enabled, int flap_detection_enabled, double low_flap_threshold, double high_flap_threshold, int flap_detection_on_up, int flap_detection_on_down, int flap_detection_on_unreachable, int stalk_on_up, int stalk_on_down, int stalk_on_unreachable, int process_perfdata, int failure_prediction_enabled, char *failure_prediction_options, int check_freshness, int freshness_threshold, char *notes, char *notes_url, char *action_url, char *icon_image, char *icon_image_alt, char *vrml_image, char *statusmap_image, int x_2d, int y_2d, int have_2d_coords, double x_3d, double y_3d, double z_3d, int have_3d_coords, int should_be_drawn, int retain_status_information, int retain_nonstatus_information, int obsess_over_host){ +host *add_host(char *name, char *display_name, char *alias, char *address, char *address6, char *check_period, int initial_state, double check_interval, double retry_interval, int max_attempts, int notify_up, int notify_down, int notify_unreachable, int notify_flapping, int notify_downtime, double notification_interval, double first_notification_delay, char *notification_period, int notifications_enabled, char *check_command, int checks_enabled, int accept_passive_checks, char *event_handler, int event_handler_enabled, int flap_detection_enabled, double low_flap_threshold, double high_flap_threshold, int flap_detection_on_up, int flap_detection_on_down, int flap_detection_on_unreachable, int stalk_on_up, int stalk_on_down, int stalk_on_unreachable, int process_perfdata, int failure_prediction_enabled, char *failure_prediction_options, int check_freshness, int freshness_threshold, char *notes, char *notes_url, char *action_url, char *icon_image, char *icon_image_alt, char *vrml_image, char *statusmap_image, int x_2d, int y_2d, int have_2d_coords, double x_3d, double y_3d, double z_3d, int have_3d_coords, int should_be_drawn, int retain_status_information, int retain_nonstatus_information, int obsess_over_host){ host *new_host=NULL; int result=OK; #ifdef NSCORE @@ -641,6 +641,8 @@ result=ERROR; if((new_host->address=(char *)strdup(address))==NULL) result=ERROR; + if((new_host->address6=(char *)strdup(address6))==NULL) + result=ERROR; if(check_period){ if((new_host->check_period=(char *)strdup(check_period))==NULL) result=ERROR; @@ -819,6 +821,7 @@ my_free(new_host->notification_period); my_free(new_host->check_period); my_free(new_host->address); + my_free(new_host->address6); my_free(new_host->alias); my_free(new_host->display_name); my_free(new_host->name); @@ -3298,6 +3301,7 @@ my_free(this_host->display_name); my_free(this_host->alias); my_free(this_host->address); + my_free(this_host->address6); #ifdef NSCORE my_free(this_host->plugin_output); my_free(this_host->long_plugin_output); diff -Naur nagios-HEAD-old/include/macros.h nagios-HEAD/include/macros.h --- nagios-HEAD-old/include/macros.h 2010-10-28 15:31:40.000000000 +0300 +++ nagios-HEAD/include/macros.h 2010-12-09 10:41:15.000000000 +0200 @@ -40,7 +40,7 @@ #define MAX_USER_MACROS 256 /* maximum number of $USERx$ macros */ -#define MACRO_X_COUNT 153 /* size of macro_x[] array */ +#define MACRO_X_COUNT 154 /* size of macro_x[] array */ struct nagios_macros { char *x[MACRO_X_COUNT]; @@ -214,6 +214,7 @@ #define MACRO_LASTHOSTSTATEID 150 #define MACRO_LASTSERVICESTATE 151 #define MACRO_LASTSERVICESTATEID 152 +#define MACRO_HOSTADDRESS6 153 diff -Naur nagios-HEAD-old/include/objects.h nagios-HEAD/include/objects.h --- nagios-HEAD-old/include/objects.h 2010-11-11 12:11:24.000000000 +0200 +++ nagios-HEAD/include/objects.h 2010-12-09 04:06:05.000000000 +0200 @@ -269,6 +269,7 @@ char *display_name; char *alias; char *address; + char *address6; hostsmember *parent_hosts; hostsmember *child_hosts; servicesmember *services; @@ -639,7 +640,7 @@ commandsmember *add_service_notification_command_to_contact(contact *,char *); /* adds a service notification command to a contact definition */ commandsmember *add_host_notification_command_to_contact(contact *,char *); /* adds a host notification command to a contact definition */ customvariablesmember *add_custom_variable_to_contact(contact *,char *,char *); /* adds a custom variable to a service definition */ -host *add_host(char *,char *,char *,char *,char *,int,double,double,int,int,int,int,int,int,double,double,char *,int,char *,int,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,char *,char *,int,int,int,double,double,double,int,int,int,int,int); /* adds a host definition */ +host *add_host(char *,char *,char *,char *,char *,char *,int,double,double,int,int,int,int,int,int,double,double,char *,int,char *,int,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,char *,char *,int,int,int,double,double,double,int,int,int,int,int); /* adds a host definition */ hostsmember *add_parent_host_to_host(host *,char *); /* adds a parent host to a host definition */ hostsmember *add_child_link_to_host(host *,host *); /* adds a child host to a host definition */ contactgroupsmember *add_contactgroup_to_host(host *,char *); /* adds a contactgroup to a host definition */ diff -Naur nagios-HEAD-old/t/Makefile nagios-HEAD/t/Makefile --- nagios-HEAD-old/t/Makefile 1970-01-01 03:00:00.000000000 +0300 +++ nagios-HEAD/t/Makefile 2010-12-09 04:06:38.000000000 +0200 @@ -0,0 +1,11 @@ +# Makefile for Nagios tests using perl + +all: + +test: + prove *.t + +clean: + +distclean: + diff -Naur nagios-HEAD-old/t-tap/test_events.c nagios-HEAD/t-tap/test_events.c --- nagios-HEAD-old/t-tap/test_events.c 2010-11-10 10:57:31.000000000 +0200 +++ nagios-HEAD/t-tap/test_events.c 2010-12-09 03:46:20.000000000 +0200 @@ -231,6 +231,7 @@ host1=(host *)malloc(sizeof(host)); host1->name=strdup("Host1"); host1->address=strdup("127.0.0.1"); + host1->address6=strdup("::1"); host1->retry_interval=1; host1->check_interval=5; host1->check_options=0; diff -Naur nagios-HEAD-old/xdata/xodtemplate.c nagios-HEAD/xdata/xodtemplate.c --- nagios-HEAD-old/xdata/xodtemplate.c 2010-11-16 12:31:08.000000000 +0200 +++ nagios-HEAD/xdata/xodtemplate.c 2010-12-09 04:12:49.000000000 +0200 @@ -2370,6 +2370,10 @@ if((temp_host->address=(char *)strdup(value))==NULL) result=ERROR; } + else if(!strcmp(variable,"address6")){ + if((temp_host->address6=(char *)strdup(value))==NULL) + result=ERROR; + } else if(!strcmp(variable,"parents")){ if(strcmp(value,XODTEMPLATE_NULL)){ if((temp_host->parents=(char *)strdup(value))==NULL) @@ -6763,6 +6767,8 @@ this_host->alias=(char *)strdup(template_host->alias); if(this_host->address==NULL && template_host->address!=NULL) this_host->address=(char *)strdup(template_host->address); + if(this_host->address6==NULL && template_host->address6!=NULL) + this_host->address6=(char *)strdup(template_host->address6); xodtemplate_get_inherited_string(&template_host->have_parents,&template_host->parents,&this_host->have_parents,&this_host->parents); xodtemplate_get_inherited_string(&template_host->have_host_groups,&template_host->host_groups,&this_host->have_host_groups,&this_host->host_groups); @@ -9037,9 +9043,11 @@ this_host->alias=(char *)strdup(this_host->host_name); if(this_host->address==NULL && this_host->host_name!=NULL) this_host->address=(char *)strdup(this_host->host_name); + if(this_host->address6==NULL && this_host->host_name!=NULL) + this_host->address6=(char *)strdup(this_host->host_name); /* add the host definition */ - new_host=add_host(this_host->host_name,this_host->display_name,this_host->alias,(this_host->address==NULL)?this_host->host_name:this_host->address,this_host->check_period,this_host->initial_state,this_host->check_interval,this_host->retry_interval,this_host->max_check_attempts,this_host->notify_on_recovery,this_host->notify_on_down,this_host->notify_on_unreachable,this_host->notify_on_flapping,this_host->notify_on_downtime,this_host->notification_interval,this_host->first_notification_delay,this_host->notification_period,this_host->notifications_enabled,this_host->check_command,this_host->active_checks_enabled,this_host->passive_checks_enabled,this_host->event_handler,this_host->event_handler_enabled,this_host->flap_detection_enabled,this_host->low_flap_threshold,this_host->high_flap_threshold,this_host->flap_detection_on_up,this_host->flap_detection_on_down,this_host->flap_detection_on_unreachable,this_host->stalk_on_up,this_host->stalk_on_down,this_host->stalk_on_unreachable,this_host->process_perf_data,this_host->failure_prediction_enabled,this_host->failure_prediction_options,this_host->check_freshness,this_host->freshness_threshold,this_host->notes,this_host->notes_url,this_host->action_url,this_host->icon_image,this_host->icon_image_alt,this_host->vrml_image,this_host->statusmap_image,this_host->x_2d,this_host->y_2d,this_host->have_2d_coords,this_host->x_3d,this_host->y_3d,this_host->z_3d,this_host->have_3d_coords,TRUE,this_host->retain_status_information,this_host->retain_nonstatus_information,this_host->obsess_over_host); + new_host=add_host(this_host->host_name,this_host->display_name,this_host->alias,(this_host->address==NULL)?this_host->host_name:this_host->address,(this_host->address6==NULL)?this_host->host_name:this_host->address6,this_host->check_period,this_host->initial_state,this_host->check_interval,this_host->retry_interval,this_host->max_check_attempts,this_host->notify_on_recovery,this_host->notify_on_down,this_host->notify_on_unreachable,this_host->notify_on_flapping,this_host->notify_on_downtime,this_host->notification_interval,this_host->first_notification_delay,this_host->notification_period,this_host->notifications_enabled,this_host->check_command,this_host->active_checks_enabled,this_host->passive_checks_enabled,this_host->event_handler,this_host->event_handler_enabled,this_host->flap_detection_enabled,this_host->low_flap_threshold,this_host->high_flap_threshold,this_host->flap_detection_on_up,this_host->flap_detection_on_down,this_host->flap_detection_on_unreachable,this_host->stalk_on_up,this_host->stalk_on_down,this_host->stalk_on_unreachable,this_host->process_perf_data,this_host->failure_prediction_enabled,this_host->failure_prediction_options,this_host->check_freshness,this_host->freshness_threshold,this_host->notes,this_host->notes_url,this_host->action_url,this_host->icon_image,this_host->icon_image_alt,this_host->vrml_image,this_host->statusmap_image,this_host->x_2d,this_host->y_2d,this_host->have_2d_coords,this_host->x_3d,this_host->y_3d,this_host->z_3d,this_host->have_3d_coords,TRUE,this_host->retain_status_information,this_host->retain_nonstatus_information,this_host->obsess_over_host); /* return with an error if we couldn't add the host */ @@ -10431,6 +10439,8 @@ fprintf(fp,"\talias\t%s\n",temp_host->alias); if(temp_host->address) fprintf(fp,"\taddress\t%s\n",temp_host->address); + if(temp_host->address6) + fprintf(fp,"\taddress6\t%s\n",temp_host->address6); if(temp_host->parents) fprintf(fp,"\tparents\t%s\n",temp_host->parents); if(temp_host->check_period) @@ -11634,6 +11644,7 @@ my_free(this_host->host_name); my_free(this_host->alias); my_free(this_host->address); + my_free(this_host->address6); my_free(this_host->parents); my_free(this_host->host_groups); my_free(this_host->check_command); diff -Naur nagios-HEAD-old/xdata/xodtemplate.h nagios-HEAD/xdata/xodtemplate.h --- nagios-HEAD-old/xdata/xodtemplate.h 2010-10-23 12:57:22.000000000 +0300 +++ nagios-HEAD/xdata/xodtemplate.h 2010-12-09 04:12:23.000000000 +0200 @@ -229,6 +229,7 @@ char *display_name; char *alias; char *address; + char *address6; char *parents; char *host_groups; char *check_command;