utils: nfbpf_compile: Replace pcap_compile_nopcap()
Phil Sutter
reviewerPATCH 1/2 utils: nfbpf_compile: Replace pcap_compile_nopcap()
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 <[email protected]>
--- utils/nfbpf_compile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
utils/nfbpf_compile.c +9 -1
@@ -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 ; }
Signature · 1 line
2.40.0
Phil Sutter
reviewerPATCH 2/2 nft-shared: Drop unused include
Code does not refer to struct xt_comment_info anymore.
Fixes 3bb497c61d743 ("xtables: Fix for deleting rules with comment")
Signed-off-by Phil Sutter <[email protected]>
--- iptables/nft-shared.c | 1 - 1 file changed, 1 deletion(-)
iptables/nft-shared.c +0 -1
@@ -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>
Signature · 1 line
2.40.0
Phil Sutter
reviewerQuoted 5 lines · Phil Sutter
The function is deprecated. Eliminate the warning by use of
pcap_open_dead(),pcap_compile()andpcap_close()just howpcap_compile_nopcap()is implemented internally in libpcap.Signed-off-by Phil Sutter <[email protected]>
Series applied.