Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fping not working on Synology DiskStation. #201

Closed
bolemo opened this issue Sep 3, 2020 · 6 comments
Closed

fping not working on Synology DiskStation. #201

bolemo opened this issue Sep 3, 2020 · 6 comments
Labels

Comments

@bolemo
Copy link

bolemo commented Sep 3, 2020

Tried from Entware, and compiling myself.

It installs, I can change permissions for setuid, but only fping -h returns something. Anything else returns nothing (and return code 4), even fping -v

root@Mnemosyne:~# ls -l /usr/local/sbin/fping 
-rwsr-xr-x 1 root root 115240 Sep  3 18:19 /usr/local/sbin/fping
root@Mnemosyne:~# file /usr/local/sbin/fping 
/usr/local/sbin/fping: setuid ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /opt/lib/ld-linux.so.3, for GNU/Linux 2.6.32, with debug_info, not stripped
root@Mnemosyne:~# fping -v
root@Mnemosyne:~# echo $?
4
root@Mnemosyne:~# uname -a
Linux Mnemosyne 3.2.40 #25426 SMP Wed Jul 8 03:10:10 CST 2020 armv7l GNU/Linux synology_comcerto2k_ds414j
@Kiskae
Copy link
Contributor

Kiskae commented Dec 23, 2020

I've run into this issue while running a newer version of the debian docker container. After looking at the system calls it appears to be caused by the absence of the /etc/protocols file causing the getprotobyname library call to fail.

While the code does include a message for this problem the error happens before the options are parsed and verbose_flag can be set, so the message never gets printed to stderr.

Considering crash_and_burn only happens in during an error it might be a good idea to remove the verbose_flag condition and always print the error. @schweikert

@georg-nielsen
Copy link

Hi,
Don't know if you have already solved this issue but I ran into the same and the solution was following when building fping from source. Disable IPv6 and enable IPv4:
./configure --disable-ipv6 --enable-ipv4 --prefix=/opt
and then make and make install

Best regards,
Georg.

@schweikert
Copy link
Owner

We should implement a better failure mode when this happens, i.e. output an error when getprotobyname fails. Anybody willing to create a pull request?

@schweikert schweikert added the bug label Aug 7, 2021
@shaferandrew
Copy link

I was experiencing this issue on an ASUSTOR AS6604 NAS with fping 5.0-1 installed via entware.

I fixed it by copying the /etc/protocols file from an Ubuntu 21.10 machine to the NAS /etc/protocols file. The Ubuntu file was significantly longer and had more entries, specifically for IPv6 protocols.

fping responded correctly after that.

@auerswal
Copy link
Collaborator

Hi,

from a cursory glance at the code I think moving verbose_flag = 1; from line 496 to line 465 in fping.c might suffice to make the error message visible. E.g., see the following completely untested (not even compile tested) patch:

diff --git a/src/fping.c b/src/fping.c
index af16061..054c665 100644
--- a/src/fping.c
+++ b/src/fping.c
@@ -463,6 +463,9 @@ int main(int argc, char** argv)
         usage(0);
     }
 
+    /* enable error messages during socket creation */
+    verbose_flag = 1;
+
     socket4 = open_ping_socket_ipv4(&socktype4);
 #ifdef __linux__
     /* We only treat SOCK_DGRAM differently on Linux, where the IPv4 header
@@ -493,7 +496,6 @@ int main(int argc, char** argv)
 
     optparse_init(&optparse_state, argv);
     ident4 = ident6 = htons(getpid() & 0xFFFF);
-    verbose_flag = 1;
     backoff_flag = 1;
     opterr = 1;
 

@schweikert
Copy link
Owner

error message behavior has been improved in #303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants