[Nagiosplug-checkins] CVS: nagiosplug/plugins check_ssh.c,1.7,1.8 check_tcp.c,1.23,1.24 netutils.c,1.8,1.9 netutils.h,1.4,1.5

Jeremy T. Bouse undrgrid at users.sourceforge.net
Sat Jun 28 23:37:04 CEST 2003


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv16381/plugins

Modified Files:
	check_ssh.c check_tcp.c netutils.c netutils.h 
Log Message:
Added address_family extern int variable to netutils to allow for -4 & -6 
	options for explicit connection protocol
Added support for -4 & -6 options to check_ssh and check_tcp for testing


Index: check_ssh.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ssh.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** check_ssh.c	11 Mar 2003 22:22:11 -0000	1.7
--- check_ssh.c	29 Jun 2003 06:36:55 -0000	1.8
***************
*** 69,72 ****
--- 69,74 ----
  		{"version", no_argument, 0, 'V'},
  		{"help", no_argument, 0, 'h'},
+ 		{"use-ipv4", no_argument, 0, '4'},
+ 		{"use-ipv6", no_argument, 0, '6'},
  		{"verbose", no_argument, 0, 'v'},
  		{"timeout", required_argument, 0, 't'},
***************
*** 83,87 ****
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+Vhvt:H:p:", long_options, &option_index);
  
  		if (c == -1 || c == EOF)
--- 85,89 ----
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+Vhv46t:H:p:", long_options, &option_index);
  
  		if (c == -1 || c == EOF)
***************
*** 105,108 ****
--- 107,116 ----
  			socket_timeout = atoi (optarg);
  			break;
+ 		case '4':
+ 			address_family = AF_INET;
+ 			break;
+ 		case '6':
+ 			address_family = AF_INET6;
+ 			break;
  		case 'H':									/* host */
  			if (is_host (optarg) == FALSE)
***************
*** 218,222 ****
  		 " %s -t [timeout] -p [port] <host>\n"
  		 " %s -V prints version info\n"
! 		 " %s -h prints more detailed help\n", progname, progname, progname);
  }
  
--- 226,233 ----
  		 " %s -t [timeout] -p [port] <host>\n"
  		 " %s -V prints version info\n"
! 		 " %s -4 use IPv4 connection\n"
! 		 " %s -6 use IPv6 connection\n"
! 		 " %s -h prints more detailed help\n", 
! 		 progname, progname, progname, progname, progname);
  }
  

Index: check_tcp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** check_tcp.c	2 Jun 2003 14:43:36 -0000	1.23
--- check_tcp.c	29 Jun 2003 06:36:55 -0000	1.24
***************
*** 30,34 ****
  -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\
  	[-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\
!   [-t to_sec] [-r refuse_state] [-v]\n";
  
  const char *options = "\
--- 30,34 ----
  -H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\
  	[-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\
! 	[-t to_sec] [-r refuse_state] [-v] [-4] [-6]\n";
  
  const char *options = "\
***************
*** 38,41 ****
--- 38,45 ----
   -p, --port=INTEGER\n\
      Port number\n\
+  -4, --use-ipv4\n\
+     Use IPv4 connection\n\
+  -6, --use-ipv6\n\
+     Use IPv6 connection\n\
   -s, --send=STRING\n\
      String to send to the server\n\
***************
*** 393,396 ****
--- 397,402 ----
  		{"delay", required_argument, 0, 'd'},
  		{"refuse", required_argument, 0, 'r'},
+ 		{"use-ipv4", no_argument, 0, '4'},
+ 		{"use-ipv6", no_argument, 0, '6'},
  		{"verbose", no_argument, 0, 'v'},
  		{"version", no_argument, 0, 'V'},
***************
*** 420,424 ****
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+hVvH:s:e:q:m:c:w:t:p:C:W:d:Sr:",
  		                 long_options, &option_index);
  
--- 426,430 ----
  
  	while (1) {
! 		c = getopt_long (argc, argv, "+hVv46H:s:e:q:m:c:w:t:p:C:W:d:Sr:",
  		                 long_options, &option_index);
  
***************
*** 439,442 ****
--- 445,454 ----
  		case 'v':                 /* verbose mode */
  			verbose = TRUE;
+ 			break;
+ 		case '4':
+ 			address_family = AF_INET;
+ 			break;
+ 		case '6':
+ 			address_family = AF_INET6;
  			break;
  		case 'H':                 /* hostname */

Index: netutils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** netutils.c	27 Jun 2003 18:47:45 -0000	1.8
--- netutils.c	29 Jun 2003 06:36:55 -0000	1.9
***************
*** 36,39 ****
--- 36,40 ----
  int econn_refuse_state = STATE_CRITICAL;
  int was_refused = FALSE;
+ int address_family = AF_UNSPEC;
  
  /* handles socket timeouts */
***************
*** 255,259 ****
  
  	memset (&hints, 0, sizeof (hints));
! 	hints.ai_family = PF_UNSPEC;
  	hints.ai_protocol = proto;
  	hints.ai_socktype = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;
--- 256,260 ----
  
  	memset (&hints, 0, sizeof (hints));
! 	hints.ai_family = address_family;
  	hints.ai_protocol = proto;
  	hints.ai_socktype = (proto == IPPROTO_UDP) ? SOCK_DGRAM : SOCK_STREAM;

Index: netutils.h
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/netutils.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** netutils.h	18 Mar 2003 07:57:48 -0000	1.4
--- netutils.h	29 Jun 2003 06:36:55 -0000	1.5
***************
*** 62,63 ****
--- 62,64 ----
  extern int econn_refuse_state;
  extern int was_refused;
+ extern int address_family;





More information about the Commits mailing list