]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
cleanup: use ICMP definitions from linux/icmp.h when possible
authorSami Kerola <kerolasa@iki.fi>
Mon, 29 Aug 2016 16:46:36 +0000 (17:46 +0100)
committerSami Kerola <kerolasa@iki.fi>
Mon, 29 Aug 2016 16:46:36 +0000 (17:46 +0100)
configure.ac
net.c

index 5f449a62c4d377d1fc937b8b551c74126aa8ff11..d2e88bc80217f68b257b026b4fe5a07677c2a2cf 100644 (file)
@@ -41,6 +41,7 @@ AC_CHECK_HEADERS([ \
   cursesX.h \
   error.h \
   fcntl.h \
+  linux/icmp.h \
   ncurses.h \
   ncurses/curses.h \
   socket.h \
diff --git a/net.c b/net.c
index a70c095e95d5ac38b831bfa616bb42c727276d57..eb9bd5e60812ab4c79ba493ef700aa4ea6a70372 100644 (file)
--- a/net.c
+++ b/net.c
@@ -44,7 +44,9 @@
 #else
 #include "portability/error.h"
 #endif
-
+#ifdef HAVE_LINUX_ICMP_H
+#include <linux/icmp.h>
+#endif
 
 #include "mtr.h"
 #include "net.h"
@@ -118,15 +120,12 @@ struct IPHeader {
   uint32_t daddr;
 };
   
-
-#define ICMP_ECHO              8
+#ifndef ICMP_ECHOREPLY
 #define ICMP_ECHOREPLY         0
-
-#define ICMP_TSTAMP            13
-#define ICMP_TSTAMPREPLY       14
-
+#define ICMP_DEST_UNREACH      3
+#define ICMP_ECHO              8
 #define ICMP_TIME_EXCEEDED     11
-#define ICMP_UNREACHABLE        3
+#endif
 
 #ifndef SOL_IP
 #define SOL_IP 0
@@ -894,7 +893,7 @@ extern void net_process_return(struct mtr_ctl *ctl)
     fromaddress = (ip_t *) &(fsa4->sin_addr);
     echoreplytype = ICMP_ECHOREPLY;
     timeexceededtype = ICMP_TIME_EXCEEDED;
-    unreachabletype = ICMP_UNREACHABLE;
+    unreachabletype = ICMP_DEST_UNREACH;
     break;
 #ifdef ENABLE_IPV6
   case AF_INET6: