SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
Solaris ping command and Config.pl association
Author Message
Post Solaris ping command and Config.pl association 
Hello all,

After a couple weeks of shutting down my workstation over the weekend, I noticed that the server didn't remove it from the "blackout" list. After looking into it (I won't tell you how much time it took...*grrrr*), I found that the ping command wasn't returning a positive error status, when using the "-s" parameter. Thus:

/usr/sbin/ping -s <non-responding IP> 56 1
...
echo $?
0 <-- should have been positive

I verified this on Solaris 2.6 and 2.7. The ping command works correctly on Solaris 2.8 (and probably 2.9). Couldn't find anything on sunsolve or elsewhere. The result was that the ping test succeeded. Then the xfer routines kicked in which failed with "Got fatal error during xfer (Connection to <host> failed)" messages. The quick fix was to just use "ping $host 1" as the test and while it doesn't allow for RTT, the code in Lib.pm (CheckHostAlive) will return zero if it can't match any "time" string. Craig, ever think about using the Perl "ping" library? Just wondering, mind you.

I also noticed an oddity, perhaps by design (Craig?). Even if you haven't defined a host in the "conf/hosts" file, you can still use BackupPC_dump to do a backup. Several conditions must be met, mind you (share, share password, etc.). The host directory must exist, also. This could be interesting for quick tests but the code seems to only use the "server" config.pl even if you have created one in the host's directory. I assume this is due to the fact that the daemon doesn't know about the host and any attempt to access {Conf} will always point to the server config. Perhaps a check for config validity before allowing a backup?

Just fyi....

- Wade

Post Solaris ping command and Config.pl association 
After a couple weeks of shutting down my workstation over the weekend, I
noticed that the server didn't remove it from the "blackout" list.
After looking into it (I won't tell you how much time it
took...*grrrr*), I found that the ping command wasn't returning a
positive error status, when using the "-s" parameter. Thus:

/usr/sbin/ping -s <non-responding IP> 56 1
...
echo $?
0 <-- should have been positive

I verified this on Solaris 2.6 and 2.7. The ping command works
correctly on Solaris 2.8 (and probably 2.9). Couldn't find anything on
sunsolve or elsewhere. The result was that the ping test succeeded.
Then the xfer routines kicked in which failed with "Got fatal error
during xfer (Connection to <host> failed)" messages. The quick fix was
to just use "ping $host 1" as the test and while it doesn't allow for
RTT, the code in Lib.pm (CheckHostAlive) will return zero if it can't
match any "time" string.

Good detective work. I should add this to the FAQ, although I haven't
started it yet.

Craig, ever think about using the Perl "ping" library? Just wondering,
mind you.

Real pings (ICMP) needs to run as root. Typically /usr/sbin/ping
is setuid root. So that's not an option since we don't want to
setuid root. Net::Ping also supports a UDP or TCP ping (not sure
which ports it uses), which might not work on all hosts. I also
wanted to minimize the number of additional perl modules that need
to be installed, but the price to pay is users having to deal with
numerous versions of ping.

In BackupPC 2.0.0 an undocumented feature is that all commands (eg: the
ping command) can be replaced in the config file by snippets of perl code.
So you could use Net::Ping if you want just by using the correct settings
in config.pl.

I also noticed an oddity, perhaps by design (Craig?). Even if you
haven't defined a host in the "conf/hosts" file, you can still use
BackupPC_dump to do a backup. Several conditions must be met, mind you
(share, share password, etc.). The host directory must exist, also.
This could be interesting for quick tests but the code seems to only use
the "server" config.pl even if you have created one in the host's
directory. I assume this is due to the fact that the daemon doesn't
know about the host and any attempt to access {Conf} will always point
to the server config. Perhaps a check for config validity before
allowing a backup?

You're right: it never checks that the host exists. This wasn't deliberate;
I wasn't thinking about the case of BackupPC_dump being used manually.
It probably even creates a host directory too, which is undesirable if
you run it manually and mis-type the host name. I'll add a check to the
code.

Craig


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger
for complex code. Debugging C/C++ programs can leave you feeling lost and
disoriented. TotalView can help you find your way. Available on major UNIX
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB