From 5dbbc52b066b2047c4bc30be7fd29dbb3febaf96 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Tue, 30 Aug 2022 20:15:31 -0700 Subject: [PATCH] ipfw: use PF_DIVERT on modern FreeBSD --- src/source-ipfw.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/source-ipfw.c b/src/source-ipfw.c index 4e768d3ccc..366895da25 100644 --- a/src/source-ipfw.c +++ b/src/source-ipfw.c @@ -335,7 +335,11 @@ TmEcode ReceiveIPFWThreadInit(ThreadVars *tv, const void *initdata, void **data) IPFWMutexInit(nq); /* We need a divert socket to play with */ +#ifdef PF_DIVERT + if ((nq->fd = socket(PF_DIVERT, SOCK_RAW, 0)) == -1) { +#else if ((nq->fd = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT)) == -1) { +#endif SCLogError(SC_ERR_IPFW_SOCK,"Can't create divert socket: %s", strerror(errno)); SCReturnInt(TM_ECODE_FAILED); }