If user did not pass --with-zlib and it is not available, simply turn
off rule compat expression compression. It is not strictly necessary and
users may not care.
While at it, drop the conditional AC_DEFINE() call: In fact,
AC_CHECK_LIB() does that already.
Fixes: ff5f6a208efcc ("nft-ruleparse: Fallback to compat expressions in userdata")
Signed-off-by: Phil Sutter <phil@nwl.cc>
[enable_profiling="$enableval"], [enable_profiling="no"])
AC_ARG_WITH([zlib], [AS_HELP_STRING([--without-zlib],
[Disable payload compression of rule compat expressions])],
[enable_profiling="$enableval"], [enable_profiling="no"])
AC_ARG_WITH([zlib], [AS_HELP_STRING([--without-zlib],
[Disable payload compression of rule compat expressions])],
AS_IF([test "x$with_zlib" != xno], [
AC_CHECK_LIB([z], [compress], ,
AS_IF([test "x$with_zlib" != xno], [
AC_CHECK_LIB([z], [compress], ,
- AC_MSG_ERROR([No suitable version of zlib found]))
- AC_DEFINE([HAVE_ZLIB], [1], [Define if you have zlib])
+ [if test "x$with_zlib" != xcheck; then
+ AC_MSG_ERROR([No suitable version of zlib found])
+ fi; with_zlib=no])
])
AC_MSG_CHECKING([whether $LD knows -Wl,--no-undefined])
])
AC_MSG_CHECKING([whether $LD knows -Wl,--no-undefined])
nftables support: ${enable_nftables}
connlabel support: ${enable_connlabel}
profiling support: ${enable_profiling}
nftables support: ${enable_nftables}
connlabel support: ${enable_connlabel}
profiling support: ${enable_profiling}
- compress rule compat expressions: ${with_zlib}
+ compress rule compat expressions: ${with_zlib/check/yes}
Build parameters:
Put plugins into executable (static): ${enable_static}
Build parameters:
Put plugins into executable (static): ${enable_static}
#include <string.h>
#include <xtables.h>
#include <string.h>
#include <xtables.h>
const void *data, size_t datalen)
{
size_t datalen_out = datalen;
const void *data, size_t datalen)
{
size_t datalen_out = datalen;
compress(rue->data, &datalen_out, data, datalen);
rue->flags |= RUE_FLAG_ZIP;
#else
compress(rue->data, &datalen_out, data, datalen);
rue->flags |= RUE_FLAG_ZIP;
#else
static struct nftnl_expr *
nftnl_expr_from_zipped_udata_ext(struct rule_udata_ext *rue)
{
static struct nftnl_expr *
nftnl_expr_from_zipped_udata_ext(struct rule_udata_ext *rue)
{
uLongf datalen = rue->orig_size;
struct nftnl_expr *expr = NULL;
void *data;
uLongf datalen = rue->orig_size;
struct nftnl_expr *expr = NULL;
void *data;