Next
====
+## New features
+
+- The -g, --generate option now also supports IPv6 addresses (#376,
+ thanks @auerswal)
+
## Bugfixes and other changes
- Fix fallback to SO\_TIMESTAMP if SO\_TIMESTAMPNS is not available (#375,
than the static buffer are no longer interpreted as more than one line
(#378, thanks @auerswal)
-## New features
-
-- The -g, --generate option now also supports IPv6 addresses (#376,
- thanks @auerswal)
+- Typo fix in error message when SO\_BINDTODEVICE fails
fping 5.3 (2025-01-02)
======================
#!/usr/bin/perl -w
-use Test::Command tests => 16;
+use Test::Command tests => 28;
use Test::More;
# -i n interval between sending ping packets (in millisec) (default 25)
+# -I IFACE bind to a particular interface, not always available
# -l loop sending pings forever
# -k set fwmark on ping packets
# -m ping multiple interfaces on target host
$cmd->stderr_is_eq("");
}
+# fping -I IFACE
+SKIP: {
+if($^O ne 'linux') {
+ skip '-I option functionality is only tested on Linux', 3;
+}
+my $cmd = Test::Command->new(cmd => 'fping -I lo 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 -I IFACE
+SKIP: {
+if($^O ne 'linux') {
+ skip '-I option functionality is only tested on Linux', 3;
+}
+if($ENV{SKIP_IPV6}) {
+ skip 'Skip IPv6 tests', 3;
+}
+my $cmd = Test::Command->new(cmd => 'fping -6 -I lo ::1');
+$cmd->exit_is_num(0);
+$cmd->stdout_is_eq("::1 is alive\n");
+$cmd->stderr_is_eq("");
+}
+
+# fping -I IFACE
+SKIP: {
+if($^O ne 'linux') {
+ skip '-I option functionality is only tested on Linux', 3;
+}
+my $cmd = Test::Command->new(cmd => 'fping -I NotAnInterface 127.0.0.1');
+$cmd->exit_is_num(1);
+$cmd->stdout_is_eq("");
+$cmd->stderr_like(qr{binding to specific interface \(SO_BINDTODEVICE\):.*\n});
+}
+
+# fping -I IFACE
+SKIP: {
+if($^O ne 'darwin') {
+ skip 'test for unsupported -I on macOS', 3;
+}
+my $cmd = Test::Command->new(cmd => 'fping -I lo0 127.0.0.1');
+$cmd->exit_is_num(3);
+$cmd->stdout_is_eq("fping: cant bind to a particular net interface since SO_BINDTODEVICE is not supported on your os.\n");
+$cmd->stderr_is_eq("");
+}
+
# fping -l
{
my $cmd = Test::Command->new(cmd => '(sleep 2; pkill fping)& fping -p 900 -l 127.0.0.1');
#ifdef SO_BINDTODEVICE
if (socket4 >= 0) {
if (p_setsockopt(suid, socket4, SOL_SOCKET, SO_BINDTODEVICE, optparse_state.optarg, strlen(optparse_state.optarg))) {
- perror("binding to specific interface (SO_BINTODEVICE)");
+ perror("binding to specific interface (SO_BINDTODEVICE)");
exit(1);
}
}
#ifdef IPV6
if (socket6 >= 0) {
if (p_setsockopt(suid, socket6, SOL_SOCKET, SO_BINDTODEVICE, optparse_state.optarg, strlen(optparse_state.optarg))) {
- perror("binding to specific interface (SO_BINTODEVICE), IPV6");
+ perror("binding to specific interface (SO_BINDTODEVICE), IPV6");
exit(1);
}
}