check_ntp_time ipv6 error
-
- Posts: 2
- Joined: Fri Apr 30, 2021 2:39 am
check_ntp_time ipv6 error
When monitoring NTP server by check_ntp_time with -6 option to check ipv6 connection, sometimes show alerts of "can not create new socket". There is no alert when monitoring with "-4" for ipv4 connection. Anyone could suggest solution to this case? Thanks a lot.
-
- Posts: 2
- Joined: Fri Apr 30, 2021 2:39 am
Re: check_ntp_time ipv6 error
Solved: check ai_tmp->ai_family == address_family before creating socket in check_ntp_time.c
source code:
https://github.com/nagios-plugins/nagio ... ntp_time.c
line 354:
//original
socklist=socket(ai_tmp->ai_family, SOCK_DGRAM, IPPROTO_UDP);
if(socklist == -1) {
perror(NULL);
die(STATE_UNKNOWN, "can not create new socket");
}
//Add a 'if' check
if {ai_tmp->ai_family == address_family) {
socklist=socket(ai_tmp->ai_family, SOCK_DGRAM, IPPROTO_UDP);
if(socklist == -1) {
perror(NULL);
die(STATE_UNKNOWN, "can not create new socket");
}
}
source code:
https://github.com/nagios-plugins/nagio ... ntp_time.c
line 354:
//original
socklist=socket(ai_tmp->ai_family, SOCK_DGRAM, IPPROTO_UDP);
if(socklist == -1) {
perror(NULL);
die(STATE_UNKNOWN, "can not create new socket");
}
//Add a 'if' check
if {ai_tmp->ai_family == address_family) {
socklist=socket(ai_tmp->ai_family, SOCK_DGRAM, IPPROTO_UDP);
if(socklist == -1) {
perror(NULL);
die(STATE_UNKNOWN, "can not create new socket");
}
}