[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Feature request for hobbitping / small client bugs



Hello Henrik

Is it possible to add a function to set the networkadress that hobbitping use for network tests ?

In our enviorment we use a service ip for hobbit and all firewall rules are made for this adress, so its important that Hobbit use this adress to ping the clients.
For fping i found a patch that works for me (see fping-2.4b2_to+interface.patch.txt) 

FPING="/usr/local/bin/fping -I 192.168.1.22"    # Path and options for the 'fping' program.

Two small things for the hobbitclient:

On Solaris Systems i get a error about top:
/opt/hobbitclient/client/bin/hobbitclient-sunos.sh: top: not found
when i set the full path for top in hobbitclient-sunos.sh it works fine
echo "[top]"
/usr/local/bin/top -b 20

With ./runclient.sh status i get the client (Solaris & Linux) dosent run, but it runs fine:
 
[hobbit (at) altara client]$ ./runclient.sh status
Hobbit client (clientlaunch) does not appear to be running
[hobbit (at) altara client]$ ps -ef | grep hobbit
hobbit   20015     1  0 Jun08 ?        00:00:00 /opt/hobbit/client/bin/hobbitlaunch --config=/opt/hobbit/client/etc/clientlaunch.cfg --log=/opt/hobbit/client/logs/clientlaunch.log --pidfile=/opt/hobbit/client/logs/clientlaunch.altara.rtc.ch.pid
hobbit   29367     1  0 08:39 ?        00:00:00 sh -c vmstat 300 2 1>/opt/hobbit/client/tmp/hobbit_vmstat.altara.rtc.ch.29351 2>&1; mv /opt/hobbit/client/tmp/hobbit_vmstat.altara.rtc.ch.29351 /opt/hobbit/client/tmp/hobbit_vmstat.altara.rtc.ch
hobbit   29369 29367  0 08:39 ?        00:00:00 vmstat 300 2
hobbit   29488 29435  0 08:41 pts/3    00:00:00 grep hobbit


Regards,
Roland
diff -urN fping-2.4b2_to.orig/fping.c fping-2.4b2_to/fping.c
--- fping-2.4b2_to.orig/fping.c	2001-07-20 19:10:26.000000000 +0200
+++ fping-2.4b2_to/fping.c	2004-03-06 07:32:08.000000000 +0100
@@ -387,6 +387,9 @@
 	struct protoent *proto;
 	char *buf;
 	uid_t uid;
+	struct sockaddr_in src_addr;
+	char *src_ip;
+	int bind_to_local_ip = 0;
 
 	/* check if we are root */
 
@@ -409,6 +412,7 @@
 	if( s < 0 )
 		errno_crash_and_burn( "can't create raw socket" );
 
+
 	if( ( uid = getuid() ) )
 	{
 		seteuid( getuid() );
@@ -424,7 +428,7 @@
 
 	/* get command line options */
 
-	while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:" ) ) != EOF )
+	while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:I:" ) ) != EOF )
 	{
 		switch( c )
 		{
@@ -433,6 +437,13 @@
 				usage();
 
 			break;
+
+		case 'I':
+			if ( !(src_ip = optarg) )
+				usage();
+			bind_to_local_ip = 1;
+			
+			break;
 		
 		case 'r':
 			if( !( retry = ( u_int )atoi( optarg ) ) )
@@ -655,6 +666,17 @@
 	
 	trials = ( count > retry + 1 ) ? count : retry + 1;
 
+	if( bind_to_local_ip )
+	{
+		/* bind to the socket */
+		src_addr.sin_family = AF_INET;
+		src_addr.sin_addr.s_addr = inet_addr(src_ip);
+		src_addr.sin_port = htons(0);
+	
+		if (bind(s, (struct sockaddr *) &src_addr, sizeof(src_addr)) < 0)
+			errno_crash_and_burn( "can't bind source to address" );
+	}
+
 #if defined( DEBUG ) || defined( _DEBUG )
 	if( debugging & DBG_TRACE )
 		trace_flag = 1;