--- check_tcp.c-orig	2006-03-29 09:33:36.000000000 -0700
+++ check_tcp.c	2006-09-29 14:06:25.055175226 -0600
@@ -52,6 +52,7 @@
 
 static int server_port = 0;
 static char *server_address = NULL;
+static char *source_address = NULL;
 static char *server_send = NULL;
 static char *server_quit = NULL;
 static char **server_expect;
@@ -214,7 +215,7 @@
 	/* try to connect to the host at the given port number */
 	gettimeofday (&tv, NULL);
 
-	result = np_net_connect (server_address, server_port, &sd, PROTOCOL);
+	result = np_net_connect (server_address, server_port, &sd, PROTOCOL, source_address);
 	if (result == STATE_CRITICAL) return STATE_CRITICAL;
 
 #ifdef HAVE_SSL
@@ -422,7 +423,7 @@
 	}
 
 	while (1) {
-		c = getopt_long (argc, argv, "+hVv46EH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:",
+		c = getopt_long (argc, argv, "+hVv46EH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:I:",
 		                 longopts, &option);
 
 		if (c == -1 || c == EOF || c == 1)
@@ -453,6 +454,9 @@
 		case 'H':                 /* hostname */
 			server_address = optarg;
 			break;
+		case 'I':                 /* local source interface address */
+			source_address = optarg;
+			break;
 		case 'c':                 /* critical */
 			if (!is_intnonneg (optarg))
 				usage4 (_("Critical threshold must be a positive integer"));
@@ -644,6 +648,7 @@
                   [-s <send string>] [-e <expect string>] [-q <quit string>]\n\
                   [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>]\n\
                   [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n\
-                  [-D <days to cert expiry>] [-S <use SSL>] [-E]\n", progname);
+                  [-D <days to cert expiry>] [-S <use SSL>] [-E]\n\
+                  [-I source interface address]\n", progname);
 }
 