]> git.gsnw.org Git - fping.git/commitdiff
make fping fail if it cannot bind the interface (-I)
authorKonrad Bucheli <kb@open.ch>
Thu, 5 Dec 2019 15:42:40 +0000 (16:42 +0100)
committerKonrad Bucheli <kb@open.ch>
Thu, 5 Dec 2019 15:42:40 +0000 (16:42 +0100)
CHANGELOG.md
src/fping.c

index b2875907768fb098fa064085d04b65979bf0cee7..3f02d3566fb72724a5e17948c691fa50c7745b7f 100644 (file)
@@ -5,6 +5,7 @@ UNRELEASED
 
 - Corrected long option name of -s to --stats (#148, thanks @wopfel)
 - Do not fail if using fping6 with -6 flag (#149, thanks @stromnet)
+- Fail if interface binding (-I) does not work (by @kbucheli)
 
 fping 4.2 (2019-02-19)
 ======================
index 9650db9185d64551ea5f3db90e9ca5f24adb5c79..7e33ea080535dfe10f6fafd2b26341afa5199a3e 100644 (file)
@@ -626,7 +626,7 @@ int main(int argc, char** argv)
 
         case 'x':
             if (!(min_reachable = (unsigned int)atoi(optparse_state.optarg)))
-                usage(1); 
+                usage(1);
             break;
 
         case 'f':
@@ -658,12 +658,14 @@ int main(int argc, char** argv)
             if (socket4 >= 0) {
                 if (setsockopt(socket4, SOL_SOCKET, SO_BINDTODEVICE, optparse_state.optarg, strlen(optparse_state.optarg))) {
                     perror("binding to specific interface (SO_BINTODEVICE)");
+                    exit(1);
                 }
             }
 #ifdef IPV6
             if (socket6 >= 0) {
                 if (setsockopt(socket6, SOL_SOCKET, SO_BINDTODEVICE, optparse_state.optarg, strlen(optparse_state.optarg))) {
                     perror("binding to specific interface (SO_BINTODEVICE), IPV6");
+                    exit(1);
                 }
             }
 #endif