traviscross / mtr

Official repository for mtr, a network diagnostic tool
http://www.bitwizard.nl/mtr/
GNU General Public License v2.0
2.64k stars 337 forks source link

"Address not available" interrupts working mtr #514

Open arekm opened 2 weeks ago

arekm commented 2 weeks ago

Scenario: mtr some-address

now our machine gets kicked out out wifi AP or network is restarted. mtr will, in such case (kicked out of AP; so for some short time it has no ip address assigned), exit with "Address not available" error.

But IMO if it mtr was started and was working for some time and only then "Address not available" happened then it shouldn't stop but instead just report failed packets.

Failure was introduced by @matt-kimball in commit 4149c2cfbe63881105142f00a0ce6e32b0712b78

Maybe just revert that part:

diff --git a/ui/cmdpipe.c b/ui/cmdpipe.c
index 81acb9c..10de21d 100644
--- a/ui/cmdpipe.c
+++ b/ui/cmdpipe.c
@@ -663,11 +663,6 @@ void handle_reply_errors(
         error(EXIT_FAILURE, 0, "Address in use");
     }

-    if (!strcmp(reply_name, "address-not-available")) {
-        display_close(ctl);
-        error(EXIT_FAILURE, 0, "Address not available");
-    }
-
     if (!strcmp(reply_name, "unexpected-error")) {
         display_close(ctl);
         error(EXIT_FAILURE, 0, "Unexpected mtr-packet error");

or add some if (only if this error comes up for first packet) then fail?

matt-kimball commented 2 weeks ago

I don't think it's great that errors like that completely kill the process, but I don't think ignoring them would be good either.

When running mtr in an interactive mode, it would be better to report the error as part of the user interface, and when in non-interactive mode including them in the generated report.

Of course, this is a non-trivial change to things.