From: Sami Kerola Date: Mon, 29 Aug 2016 16:46:36 +0000 (+0100) Subject: cleanup: use ICMP definitions from linux/icmp.h when possible X-Git-Tag: v0.88~26^2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf2b21aee28f570fac4b7d1c30c9240eb5c2c62d;p=thirdparty%2Fmtr.git cleanup: use ICMP definitions from linux/icmp.h when possible --- diff --git a/configure.ac b/configure.ac index 5f449a6..d2e88bc 100644 --- a/configure.ac +++ b/configure.ac @@ -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 a70c095..eb9bd5e 100644 --- a/net.c +++ b/net.c @@ -44,7 +44,9 @@ #else #include "portability/error.h" #endif - +#ifdef HAVE_LINUX_ICMP_H +#include +#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: