#include <net/if.h>
#include <net/route.h>
-#include <net/netisr.h>
-#include <net/zlib.h>
+#if IPCOMP_ZLIB
+#include <libkern/zlib.h>
+#endif
#include <kern/cpu_number.h>
#include <netinet6/ipcomp.h>
#include <net/net_osdep.h>
-static void *deflate_alloc __P((void *, u_int, u_int));
-static void deflate_free __P((void *, void *));
-static int deflate_common __P((struct mbuf *, struct mbuf *, size_t *, int));
-static int deflate_compress __P((struct mbuf *, struct mbuf *, size_t *));
-static int deflate_decompress __P((struct mbuf *, struct mbuf *, size_t *));
+#if IPCOMP_ZLIB
+static void *deflate_alloc(void *, u_int, u_int);
+static void deflate_free(void *, void *);
+static int deflate_common(struct mbuf *, struct mbuf *, size_t *, int);
+static int deflate_compress(struct mbuf *, struct mbuf *, size_t *);
+static int deflate_decompress(struct mbuf *, struct mbuf *, size_t *);
/*
* We need to use default window size (2^15 = 32Kbytes as of writing) for
static z_stream deflate_stream;
static z_stream inflate_stream;
+#endif /* IPCOMP_ZLIB */
+#if IPCOMP_ZLIB
static const struct ipcomp_algorithm ipcomp_algorithms[] = {
{ deflate_compress, deflate_decompress, 90 },
};
+#else
+static const struct ipcomp_algorithm ipcomp_algorithms[] __unused = {};
+#endif
const struct ipcomp_algorithm *
-ipcomp_algorithm_lookup(idx)
- int idx;
+ipcomp_algorithm_lookup(
+#if IPCOMP_ZLIB
+ int idx
+#else
+ __unused int idx
+#endif
+ )
{
-
+#if IPCOMP_ZLIB
if (idx == SADB_X_CALG_DEFLATE) {
/*
* Avert your gaze, ugly hack follows!
return &ipcomp_algorithms[0];
}
+#endif /* IPCOMP_ZLIB */
return NULL;
}
+#if IPCOMP_ZLIB
static void *
-deflate_alloc(aux, items, siz)
- void *aux;
- u_int items;
- u_int siz;
+deflate_alloc(
+ __unused void *aux,
+ u_int items,
+ u_int siz)
{
void *ptr;
- ptr = _MALLOC(items * siz, M_TEMP, M_WAIT);
+ ptr = _MALLOC(items * siz, M_TEMP, M_NOWAIT);
return ptr;
}
static void
-deflate_free(aux, ptr)
- void *aux;
- void *ptr;
+deflate_free(
+ __unused void *aux,
+ void *ptr)
{
FREE(ptr, M_TEMP);
}
/* inflate: Z_OK can indicate the end of decode */
if (mode && !p && zs->avail_out != 0)
goto terminate;
- else
- ; /*once more.*/
+
+ /* else once more.*/
} else {
if (zs->msg) {
ipseclog((LOG_ERR, "ipcomp_%scompress: "
return deflate_common(m, md, lenp, 1);
}
+#endif /* IPCOMP_ZLIB */