* (bugfix) Fix compatibility issue with AIX (#69, @blentzgh)
* (bugfix) Fix -q not suppressing some ICMP error messages (#83)
* (bugfix) Fix -M expecting an argument, when it shouldn't
+ * (bugfix) Fix option -H (ttl) for IPv6
+ * (bugfix) Fix option -M (don't fragment) for IPv6
+ * (bugfix) Fix option -O (ToS) for IPv6
2017-01-11 David Schweikert <david@schweikert.ch>
* Version 3.15
#!/usr/bin/perl -w
use Test::Command tests => 7;
+use Test::More;
# -i n interval between sending ping packets (in millisec) (default 25)
# -l loop sending pings forever
}
# fping -M
-{
-my $cmd = Test::Command->new(cmd => "fping -M 127.0.0.1");
-$cmd->exit_is_num(0);
-$cmd->stdout_is_eq("127.0.0.1 is alive\n");
-$cmd->stderr_is_eq("");
+SKIP: {
+ if($^O eq 'darwin') {
+ skip '-M option not supported on macOS', 3;
+ }
+ my $cmd = Test::Command->new(cmd => "fping -M 127.0.0.1");
+ $cmd->exit_is_num(0);
+ $cmd->stdout_is_eq("127.0.0.1 is alive\n");
+ $cmd->stderr_is_eq("");
}
# fping -m -> test-14-internet-hosts
}
# fping -M
-{
-my $cmd = Test::Command->new(cmd => "fping -r 0 -b 10000 -M 8.8.8.8");
-$cmd->exit_is_num(1);
-$cmd->stdout_is_eq("8.8.8.8 is unreachable\n");
-$cmd->stderr_is_eq("8.8.8.8: error while sending ping: Message too long\n");
+SKIP: {
+ if($^O eq 'darwin') {
+ skip '-M option not supported on macOS', 3;
+ }
+ my $cmd = Test::Command->new(cmd => "fping -r 0 -b 10000 -M 8.8.8.8");
+ $cmd->exit_is_num(1);
+ $cmd->stdout_is_eq("8.8.8.8 is unreachable\n");
+ $cmd->stderr_is_eq("8.8.8.8: error while sending ping: Message too long\n");
}
#ifdef IP_MTU_DISCOVER
{
int val = IP_PMTUDISC_DO;
+#ifndef IPV6
if (setsockopt(s, IPPROTO_IP, IP_MTU_DISCOVER, &val, sizeof(val))) {
+#else
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_MTU_DISCOVER, &val, sizeof(val))) {
+#endif
perror("setsockopt IP_MTU_DISCOVER");
}
}
case 'O':
if (sscanf(optarg,"%i",&tos)){
+#ifndef IPV6
if ( setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof(tos))) {
+#else
+ if ( setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos))) {
+#endif
perror("setting type of service octet IP_TOS");
}
}
/* set the TTL, if the -H option was set (otherwise ttl will be = 0) */
if(ttl > 0) {
+#ifndef IPV6
if (setsockopt(s, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl))) {
+#else
+ if (setsockopt(s, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl))) {
+#endif
perror("setting time to live");
}
}