Code

Provide a fallback if `ICMP6_ECHO_REQUEST' or `ICMP6_ECHO_REPLY' is not defined.
authorDoug MacEachern <dougm@hyperic.com>
Wed, 29 Aug 2007 20:09:52 +0000 (22:09 +0200)
committerFlorian Forster <octo@verplant.org>
Wed, 29 Aug 2007 20:09:52 +0000 (22:09 +0200)
Hello,

I just started looking at liboping, looks great so far! I needed the attached
patch to compile on aix 5.2, works as expected once built. I chose to hardwire
the constant values due to conflicts when including aix's netinet/ip6_icmp.h.
I can try to untangle if desired but prefer to spend as little time on aix as
possible :)

% uname -a
AIX orange 2 5 000919934C00

% find /usr/include/ -name "*.h" | xargs grep ICMP6_ | egrep '128|129'
/usr/include/netinet/ip6_icmp.h:#define ICMP6_ECHO      128 /* echo service */
/usr/include/netinet/ip6_icmp.h:#define ICMP6_ECHOREPLY 129 /* echo reply */

src/liboping.c

index 9b91b6d40f0214963c025aeb6af9e7f3f4246575..c521a7dd400338eff5ed62a70bef9e786f4faf9a 100644 (file)
@@ -288,6 +288,22 @@ static pinghost_t *ping_receive_ipv4 (pinghost_t *ph, char *buffer, size_t buffe
        return (ptr);
 }
 
+#ifndef ICMP6_ECHO_REQUEST
+# ifdef ICMP6_ECHO /* AIX netinet/ip6_icmp.h */
+#  define ICMP6_ECHO_REQUEST ICMP6_ECHO
+# else
+#  define ICMP6_ECHO_REQUEST 128
+# endif
+#endif
+
+#ifndef ICMP6_ECHO_REPLY
+# ifdef ICMP6_ECHOREPLY /* AIX netinet/ip6_icmp.h */
+#  define ICMP6_ECHO_REPLY ICMP6_ECHOREPLY
+# else
+#  define ICMP6_ECHO_REPLY 129
+# endif
+#endif
+
 static pinghost_t *ping_receive_ipv6 (pinghost_t *ph, char *buffer, size_t buffer_len)
 {
        struct icmp6_hdr *icmp_hdr;