[Swan-dev] [PATCH] ikev2_ipsec: include limits.h for HOST_NAME_MAX

Timo Teras timo.teras at iki.fi
Mon Aug 14 12:09:18 UTC 2017

HOST_NAME_MAX is defined in limits.h according to POSIX. Include it
appropriately in ikev2_ipseckey.c. Namely, this fixes a build failure
on ppc64le with musl c-library:

libreswan-3.21/programs/pluto/ikev2_ipseckey.c: In function 'build_dns_name':
libreswan-3.21/programs/pluto/ikev2_ipseckey.c:725:22: error: 'HOST_NAME_MAX' undeclared (first use in this function)
  if (id->name.len >= HOST_NAME_MAX)
libreswan-3.21/programs/pluto/ikev2_ipseckey.c:725:22: note: each undeclared identifier is reported only once for each function it appears in
libreswan-3.21/programs/pluto/ikev2_ipseckey.c: In function 'qry_st_init':
libreswan-3.21/programs/pluto/ikev2_ipseckey.c:773:15: error: 'HOST_NAME_MAX' undeclared (first use in this function)
  char log_buf[HOST_NAME_MAX * 2]; /* this is local */

diff -ru libreswan-3.21.orig/programs/pluto/ikev2_ipseckey.c libreswan-3.21/programs/pluto/ikev2_ipseckey.c
--- libreswan-3.21.orig/programs/pluto/ikev2_ipseckey.c	2017-08-09 20:47:34.000000000 +0000
+++ libreswan-3.21/programs/pluto/ikev2_ipseckey.c	2017-08-14 12:00:26.380840562 +0000
@@ -23,6 +23,7 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <limits.h>
 #include <errno.h>
 #include <arpa/inet.h> /* for inet_ntop */
 #include <arpa/nameser.h>

More information about the Swan-dev mailing list