$NetBSD: patch-ac,v 1.3 2025/08/20 13:32:18 pho Exp $ Use BSD names rather than Linux names for ICMP-related cpp macros. Linux apparently supports both but this is required on *BSD. --- pinger.c.orig 2014-09-07 09:40:11.000000000 +0000 +++ pinger.c @@ -317,42 +317,49 @@ static gchar *pr_icmph(struct icmp *icp) g_string_assign(s, "Echo Reply"); /* XXX ID + Seq + Data */ break; - case ICMP_DEST_UNREACH: + case ICMP_UNREACH: switch (icp->icmp_code) { - case ICMP_NET_UNREACH: + case ICMP_UNREACH_NET: g_string_assign(s, "Destination Net Unreachable"); break; - case ICMP_HOST_UNREACH: + case ICMP_UNREACH_HOST: g_string_assign(s, "Destination Host Unreachable"); break; - case ICMP_PROT_UNREACH: + case ICMP_UNREACH_PROTOCOL: g_string_assign(s, "Destination Protocol Unreachable"); break; - case ICMP_PORT_UNREACH: + case ICMP_UNREACH_PORT: g_string_assign(s, "Destination Port Unreachable"); break; - case ICMP_FRAG_NEEDED: + case ICMP_UNREACH_NEEDFRAG: g_string_assign(s, "Frag needed and DF set"); break; - case ICMP_SR_FAILED: + case ICMP_UNREACH_SRCFAIL: g_string_assign(s, "Source Route Failed"); break; - case ICMP_NET_UNKNOWN: + case ICMP_UNREACH_NET_UNKNOWN: g_string_assign(s, "Network Unknown"); break; - case ICMP_HOST_UNKNOWN: + case ICMP_UNREACH_HOST_UNKNOWN: g_string_assign(s, "Host Unknown"); break; - case ICMP_HOST_ISOLATED: + case ICMP_UNREACH_ISOLATED: g_string_assign(s, "Host Isolated"); break; - case ICMP_NET_UNR_TOS: + case ICMP_UNREACH_TOSNET: g_string_assign(s, "Destination Network Unreachable At This TOS"); break; - case ICMP_HOST_UNR_TOS: + case ICMP_UNREACH_TOSHOST: g_string_assign(s, "Destination Host Unreachable At This TOS"); break; +#if defined(__DragonFly__) + case ICMP_UNREACH_FILTER_PROHIB: +#else + case ICMP_UNREACH_ADMIN_PROHIBIT: +#endif + g_string_assign(s, "Packet Prohibited"); + break; #ifdef ICMP_PKT_FILTERED case ICMP_PKT_FILTERED: g_string_assign(s, "Packet Filtered"); @@ -374,21 +381,21 @@ static gchar *pr_icmph(struct icmp *icp) break; } break; - case ICMP_SOURCE_QUENCH: + case ICMP_SOURCEQUENCH: g_string_assign(s, "Source Quench"); break; case ICMP_REDIRECT: switch (icp->icmp_code) { - case ICMP_REDIR_NET: + case ICMP_REDIRECT_NET: g_string_assign(s, "Redirect Network"); break; - case ICMP_REDIR_HOST: + case ICMP_REDIRECT_HOST: g_string_assign(s, "Redirect Host"); break; - case ICMP_REDIR_NETTOS: + case ICMP_REDIRECT_TOSNET: g_string_assign(s, "Redirect Type of Service and Network"); break; - case ICMP_REDIR_HOSTTOS: + case ICMP_REDIRECT_TOSHOST: g_string_assign(s, "Redirect Type of Service and Host"); break; default: @@ -402,12 +409,12 @@ static gchar *pr_icmph(struct icmp *icp) g_string_assign(s, "Echo Request"); /* XXX ID + Seq + Data */ break; - case ICMP_TIME_EXCEEDED: + case ICMP_TIMXCEED: switch (icp->icmp_code) { - case ICMP_EXC_TTL: + case ICMP_TIMXCEED_INTRANS: g_string_assign(s, "Time to live exceeded"); break; - case ICMP_EXC_FRAGTIME: + case ICMP_TIMXCEED_REASS: g_string_assign(s, "Frag reassembly time exceeded"); break; default: @@ -416,23 +423,23 @@ static gchar *pr_icmph(struct icmp *icp) break; } break; - case ICMP_PARAMETERPROB: + case ICMP_PARAMPROB: g_string_sprintf(s, "Parameter problem: IP address = %s", inet_ntoa(icp->icmp_gwaddr)); break; - case ICMP_TIMESTAMP: + case ICMP_TSTAMP: g_string_assign(s, "Timestamp"); /* XXX ID + Seq + 3 timestamps */ break; - case ICMP_TIMESTAMPREPLY: + case ICMP_TSTAMPREPLY: g_string_assign(s, "Timestamp Reply"); /* XXX ID + Seq + 3 timestamps */ break; - case ICMP_INFO_REQUEST: + case ICMP_IREQ: g_string_assign(s, "Information Request"); /* XXX ID + Seq */ break; - case ICMP_INFO_REPLY: + case ICMP_IREQREPLY: g_string_assign(s, "Information Reply"); /* XXX ID + Seq */ break; @@ -510,7 +517,7 @@ static gchar *pr_icmph6(struct icmp6_hdr break; } break; - case ICMP_PARAMETERPROB: + case ICMP_PARAMPROB: switch (icmp->icmp6_code) { case ICMP6_PARAMPROB_HEADER: g_string_assign(s, "Erroneous header field"); @@ -597,9 +604,9 @@ static void pr_pack(u_char *buf, int cc, switch (icp->icmp_type) { case ICMP_ECHO: return; - case ICMP_DEST_UNREACH: - case ICMP_TIME_EXCEEDED: - case ICMP_PARAMETERPROB: + case ICMP_UNREACH: + case ICMP_TIMXCEED: + case ICMP_PARAMPROB: { struct ip *iph = (struct ip *) (&icp->icmp_data); struct icmp *icp1 =