Skip to content

Commit 6cf3ea7

Browse files
committed
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.
1 parent ec780ab commit 6cf3ea7

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
4040
Detect OS IPv6 support using AF_INET6 only.
4141
Remove all remaining support for BSD/OS, IRIX, {OSF/1, Digital Unix,
4242
Tru64 Unix}, SINIX and Ultrix.
43+
Fix compiling on GNU/Hurd.
4344

4445
DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
4546
Summary for 4.99.5 tcpdump release (so far!)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ tcpdump compiles and works on at least the following platforms:
3131
* Haiku
3232
* HP-UX 11i
3333
* illumos (OmniOS, OpenIndiana)
34+
* GNU/Hurd
3435
* GNU/Linux
3536
* {Mac} OS X / macOS
3637
* NetBSD

print-bgp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,7 @@ bgp_attr_print(netdissect_options *ndo,
19941994
int advance;
19951995
u_int tlen;
19961996
const u_char *tptr;
1997-
char buf[MAXHOSTNAMELEN + 100];
1997+
char buf[512];
19981998
u_int as_size;
19991999
int add_path4, add_path6;
20002000
int ret;
@@ -2962,7 +2962,7 @@ bgp_update_print(netdissect_options *ndo,
29622962
{
29632963
const u_char *p;
29642964
u_int withdrawn_routes_len;
2965-
char buf[MAXHOSTNAMELEN + 100];
2965+
char buf[512];
29662966
int wpfx;
29672967
u_int len;
29682968
int i;

print-icmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ icmp_print(netdissect_options *ndo, const u_char *bp, u_int plen,
499499
const char *str;
500500
const uint8_t *obj_tptr;
501501
u_int hlen;
502-
char buf[MAXHOSTNAMELEN + 100];
502+
char buf[512];
503503
struct cksum_vec vec[1];
504504

505505
ndo->ndo_protocol = "icmp";

0 commit comments

Comments
 (0)