]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix compiling on GNU/Hurd. [skip appveyor]
authorDenis Ovsienko <[email protected]>
Sun, 4 Feb 2024 15:31:19 +0000 (15:31 +0000)
committerDenis Ovsienko <[email protected]>
Sun, 4 Feb 2024 15:43:34 +0000 (15:43 +0000)
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.

CHANGES
README.md
print-bgp.c
print-icmp.c

diff --git a/CHANGES b/CHANGES
index f92576191f961440a8b37c68b81e9d586c8232c6..90d6a16207d36bc76d765f4457cf99cf3cb271d6 100644 (file)
--- 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!)
index 653e4da3ab789a7a5f254730c853d0812d033bab..e0e88c3e2624b8351c44b7cd07530a971dc9c477 100644 (file)
--- 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
index fe8a430c8a5c1774d90d78c0424fe81e6d4d37b1..81a95b859669fb0c2abaa0df28f21d8a19875f72 100644 (file)
@@ -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;
index 46af4f35df4b51a12e8ef0e6f0e3d63db6880fdd..a4564b53587b8f8e5cac1292df6dbfdba86a80c6 100644 (file)
@@ -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";