From: Doug MacEachern Date: Wed, 29 Aug 2007 20:09:52 +0000 (+0200) Subject: Provide a fallback if `ICMP6_ECHO_REQUEST' or `ICMP6_ECHO_REPLY' is not defined. X-Git-Tag: Net-Oping-1.00~4^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fe3b4647c8bb2a1d26be40f181f2355233f2729f;p=liboping.git Provide a fallback if `ICMP6_ECHO_REQUEST' or `ICMP6_ECHO_REPLY' is not defined. 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 */ --- diff --git a/src/liboping.c b/src/liboping.c index 9b91b6d..c521a7d 100644 --- a/src/liboping.c +++ b/src/liboping.c @@ -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;