blob: ab7768e9dead32b20f29dc765cbfc6ae48725dfe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#! /usr/bin/perl
#
# Wrapper around ping
use strict;
use warnings;
use NetAddr::IP;
use feature ":5.10";
my $ip = new NetAddr::IP $ARGV[0];
return unless defined $ip;
given ($ip->version) {
when (4) {
exec { '/bin/ping' } 'ping', @ARGV
or die "Can't exec ping";
}
when (6) {
exec { '/bin/ping6' } 'ping6', @ARGV
or die "Can't exec ping6";
}
default {
die "Unknown address: $ARGV[0]\n";
}
}
|