7768ba8
diff -up ./plugins-scripts/check_ntp.pl.fix_ipv6 ./plugins-scripts/check_ntp.pl
7768ba8
--- ./plugins-scripts/check_ntp.pl.fix_ipv6	2019-08-29 21:07:13.497504795 +0000
7768ba8
+++ ./plugins-scripts/check_ntp.pl	2019-08-29 21:11:48.626816686 +0000
7768ba8
@@ -112,13 +112,23 @@ if (defined $opt_j || defined $opt_k ) {
7768ba8
 }
7768ba8
 
7768ba8
 $opt_H = shift unless ($opt_H);
7768ba8
-my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/);
7768ba8
+
7768ba8
+## From https://bugzilla.redhat.com/show_bug.cgi?id=1731468 
7768ba8
+my $host = $opt_H if ($opt_H &&
7768ba8
+		      ($opt_H =~ m/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/ ||      # IPv4
7768ba8
+		       $opt_H =~ m/^([0-9a-f]{1,4}:){7}([0-9a-f]{1,4})$/i || # IPv6 without ::
7768ba8
+		       $opt_H =~ m/^:(:[0-9a-f]{1,4})+$/i ||                 # IPv6 with leading ::
7768ba8
+		       $opt_H =~ m/^([0-9a-f]{1,4}:)+:$/i ||                 # IPv6 with trailing ::
7768ba8
+		       $opt_H =~ m/^([0-9a-f]{1,4}:)+(:[0-9a-f]{1,4})+$/i || # IPv6 with middle ::
7768ba8
+		       $opt_H =~ m/^[a-z0-9][-a-z0-9]*(\.[a-z0-9][-a-z0-9]*)*$/)); # hostnames
7768ba8
+
7768ba8
 unless ($host) {
7768ba8
 	print "No target host specified\n";
7768ba8
 	print_usage();
7768ba8
 	exit $ERRORS{'UNKNOWN'};
7768ba8
 }
7768ba8
 
7768ba8
+
7768ba8
 my ($timeout, $owarn, $ocrit, $jwarn, $jcrit);
7768ba8
 
7768ba8
 $timeout = $TIMEOUT;