* [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap()
@ 2023-04-21 16:04 Phil Sutter
2023-04-21 16:04 ` [iptables PATCH 2/2] nft-shared: Drop unused include Phil Sutter
2023-04-26 18:19 ` [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap() Phil Sutter
0 siblings, 2 replies; 3+ messages in thread
From: Phil Sutter @ 2023-04-21 16:04 UTC (permalink / raw)
To: netfilter-devel
The function is deprecated. Eliminate the warning by use of
pcap_open_dead(), pcap_compile() and pcap_close() just how
pcap_compile_nopcap() is implemented internally in libpcap.
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
utils/nfbpf_compile.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/utils/nfbpf_compile.c b/utils/nfbpf_compile.c
index 2c46c7b026cc8..c9e763dcf144c 100644
--- a/utils/nfbpf_compile.c
+++ b/utils/nfbpf_compile.c
@@ -17,6 +17,7 @@ int main(int argc, char **argv)
struct bpf_program program;
struct bpf_insn *ins;
int i, dlt = DLT_RAW;
+ pcap_t *pcap;
if (argc < 2 || argc > 3) {
fprintf(stderr, "Usage: %s [link] '<program>'\n\n"
@@ -36,9 +37,15 @@ int main(int argc, char **argv)
}
}
- if (pcap_compile_nopcap(65535, dlt, &program, argv[argc - 1], 1,
+ pcap = pcap_open_dead(dlt, 65535);
+ if (!pcap) {
+ fprintf(stderr, "Memory allocation failure\n");
+ return 1;
+ }
+ if (pcap_compile(pcap, &program, argv[argc - 1], 1,
PCAP_NETMASK_UNKNOWN)) {
fprintf(stderr, "Compilation error\n");
+ pcap_close(pcap);
return 1;
}
@@ -50,6 +57,7 @@ int main(int argc, char **argv)
printf("%u %u %u %u\n", ins->code, ins->jt, ins->jf, ins->k);
pcap_freecode(&program);
+ pcap_close(pcap);
return 0;
}
--
2.40.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [iptables PATCH 2/2] nft-shared: Drop unused include
2023-04-21 16:04 [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap() Phil Sutter
@ 2023-04-21 16:04 ` Phil Sutter
2023-04-26 18:19 ` [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap() Phil Sutter
1 sibling, 0 replies; 3+ messages in thread
From: Phil Sutter @ 2023-04-21 16:04 UTC (permalink / raw)
To: netfilter-devel
Code does not refer to struct xt_comment_info anymore.
Fixes: 3bb497c61d743 ("xtables: Fix for deleting rules with comment")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
iptables/nft-shared.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/iptables/nft-shared.c b/iptables/nft-shared.c
index c19d78e469722..79f6a7d3fbb85 100644
--- a/iptables/nft-shared.c
+++ b/iptables/nft-shared.c
@@ -22,7 +22,6 @@
#include <xtables.h>
#include <linux/netfilter/nf_log.h>
-#include <linux/netfilter/xt_comment.h>
#include <linux/netfilter/xt_limit.h>
#include <linux/netfilter/xt_NFLOG.h>
#include <linux/netfilter/xt_mark.h>
--
2.40.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap()
2023-04-21 16:04 [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap() Phil Sutter
2023-04-21 16:04 ` [iptables PATCH 2/2] nft-shared: Drop unused include Phil Sutter
@ 2023-04-26 18:19 ` Phil Sutter
1 sibling, 0 replies; 3+ messages in thread
From: Phil Sutter @ 2023-04-26 18:19 UTC (permalink / raw)
To: netfilter-devel
On Fri, Apr 21, 2023 at 06:04:08PM +0200, Phil Sutter wrote:
> The function is deprecated. Eliminate the warning by use of
> pcap_open_dead(), pcap_compile() and pcap_close() just how
> pcap_compile_nopcap() is implemented internally in libpcap.
>
> Signed-off-by: Phil Sutter <phil@nwl.cc>
Series applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-26 18:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 16:04 [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap() Phil Sutter
2023-04-21 16:04 ` [iptables PATCH 2/2] nft-shared: Drop unused include Phil Sutter
2023-04-26 18:19 ` [iptables PATCH 1/2] utils: nfbpf_compile: Replace pcap_compile_nopcap() Phil Sutter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox