From: Denis Ovsienko Date: Sun, 4 Feb 2024 15:31:19 +0000 (+0000) Subject: Fix compiling on GNU/Hurd. [skip appveyor] X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/6cf3ea7d0f7c43440f74c93b95a7864f30fc68b4 Fix compiling on GNU/Hurd. [skip appveyor] GNU/Hurd does not define MAXHOSTNAMELEN because it does not define HOST_NAME_MAX, even if __USE_POSIX is defined. This causes the following: ./print-bgp.c:1997:14: error: 'MAXHOSTNAMELEN' undeclared (first use in this function) ./print-bgp.c:2965:14: error: 'MAXHOSTNAMELEN' undeclared (first use in this function) ./print-icmp.c:502:11: error: 'MAXHOSTNAMELEN' undeclared (first use in this function) However, the above code should not depend on this OS-specific detail to size its temporary printing buffers, so just hard-code the sizes. --- diff --git a/CHANGES b/CHANGES index f9257619..90d6a162 100644 --- a/CHANGES +++ b/CHANGES @@ -40,6 +40,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group Detect OS IPv6 support using AF_INET6 only. Remove all remaining support for BSD/OS, IRIX, {OSF/1, Digital Unix, Tru64 Unix}, SINIX and Ultrix. + Fix compiling on GNU/Hurd. DayOfTheWeek, Month DD, YYYY / The Tcpdump Group Summary for 4.99.5 tcpdump release (so far!) diff --git a/README.md b/README.md index 653e4da3..e0e88c3e 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ tcpdump compiles and works on at least the following platforms: * Haiku * HP-UX 11i * illumos (OmniOS, OpenIndiana) +* GNU/Hurd * GNU/Linux * {Mac} OS X / macOS * NetBSD diff --git a/print-bgp.c b/print-bgp.c index fe8a430c..81a95b85 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -1994,7 +1994,7 @@ bgp_attr_print(netdissect_options *ndo, int advance; u_int tlen; const u_char *tptr; - char buf[MAXHOSTNAMELEN + 100]; + char buf[512]; u_int as_size; int add_path4, add_path6; int ret; @@ -2962,7 +2962,7 @@ bgp_update_print(netdissect_options *ndo, { const u_char *p; u_int withdrawn_routes_len; - char buf[MAXHOSTNAMELEN + 100]; + char buf[512]; int wpfx; u_int len; int i; diff --git a/print-icmp.c b/print-icmp.c index 46af4f35..a4564b53 100644 --- a/print-icmp.c +++ b/print-icmp.c @@ -499,7 +499,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen, const char *str; const uint8_t *obj_tptr; u_int hlen; - char buf[MAXHOSTNAMELEN + 100]; + char buf[512]; struct cksum_vec vec[1]; ndo->ndo_protocol = "icmp";