[],
[AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))],
[AC_DEFINE([HAVE_LIBNET_CAPABILITIES],[1], (libnet_have_capabilities_patch))])
+
+
+ # check if the argument to libnet_init is char* or const char*
+ AC_MSG_CHECKING([libnet_init dev type])
+ STORECFLAGS="${CFLAGS}"
+ if test `basename $CC` = "clang"; then
+ CFLAGS="${CFLAGS} -Werror=incompatible-pointer-types"
+ else
+ CFLAGS="${CFLAGS} -Werror"
+ fi
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [
+ #include <stdio.h>
+ #include <libnet.h>
+ ],
+ [[
+ const char dev[32] = "";
+ char ebuf[LIBNET_ERRBUF_SIZE];
+ (void)libnet_init(LIBNET_LINK, dev, ebuf);
+ ]])],
+ [libnet_init_const="yes"],
+ [libnet_init_const="no"])
+ AC_MSG_RESULT($libnet_init_const)
+ if test "x$libnet_init_const" = "xyes"; then
+ AC_DEFINE([HAVE_LIBNET_INIT_CONST], [1], [libnet_init takes const argument])
+ fi
+ CFLAGS="${STORECFLAGS}"
fi
else
AC_MSG_RESULT(no)
#ifdef HAVE_LIBNET11
+#ifndef HAVE_LIBNET_INIT_CONST
+#define LIBNET_INIT_CAST (char *)
+#else
+#define LIBNET_INIT_CAST
+#endif
+
/** set to true in main if we're setting caps. We need it here if we're using
* reject rules as libnet 1.1 is not compatible with caps. */
extern int sc_set_caps;
devname = p->livedev->dev;
SCLogDebug("Will emit reject packet on dev %s", devname);
}
- if ((c = libnet_init(LIBNET_RAW4, devname, ebuf)) == NULL) {
+ if ((c = libnet_init(LIBNET_RAW4, LIBNET_INIT_CAST devname, ebuf)) == NULL) {
SCLogError(SC_ERR_LIBNET_INIT,"libnet_init failed: %s", ebuf);
return 1;
}
if (IS_SURI_HOST_MODE_SNIFFER_ONLY(host_mode) && (p->livedev)) {
devname = p->livedev->dev;
}
- if ((c = libnet_init(LIBNET_RAW4, devname, ebuf)) == NULL) {
+ if ((c = libnet_init(LIBNET_RAW4, LIBNET_INIT_CAST devname, ebuf)) == NULL) {
SCLogError(SC_ERR_LIBNET_INIT,"libnet_inint failed: %s", ebuf);
return 1;
}
if (IS_SURI_HOST_MODE_SNIFFER_ONLY(host_mode) && (p->livedev)) {
devname = p->livedev->dev;
}
- if ((c = libnet_init(LIBNET_RAW6, devname, ebuf)) == NULL) {
+ if ((c = libnet_init(LIBNET_RAW6, LIBNET_INIT_CAST devname, ebuf)) == NULL) {
SCLogError(SC_ERR_LIBNET_INIT,"libnet_init failed: %s", ebuf);
return 1;
}
if (IS_SURI_HOST_MODE_SNIFFER_ONLY(host_mode) && (p->livedev)) {
devname = p->livedev->dev;
}
- if ((c = libnet_init(LIBNET_RAW6, devname, ebuf)) == NULL) {
+ if ((c = libnet_init(LIBNET_RAW6, LIBNET_INIT_CAST devname, ebuf)) == NULL) {
SCLogError(SC_ERR_LIBNET_INIT,"libnet_inint failed: %s", ebuf);
return 1;
}