!10 enable DT check
From: @XWwalker Reviewed-by: @robertxw Signed-off-by: @robertxw
This commit is contained in:
commit
17011e3365
102
add-test-case-and-enable-in-rpmbuild.patch
Normal file
102
add-test-case-and-enable-in-rpmbuild.patch
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
From be875657f0fcaa2f87658a07c9de9fefb7f74f29 Mon Sep 17 00:00:00 2001
|
||||||
|
From: liubo <liubo335@huawei.com>
|
||||||
|
Date: Mon, 13 Mar 2023 19:58:35 +0800
|
||||||
|
Subject: [PATCH] add test case and enable in rpmbuild
|
||||||
|
|
||||||
|
---
|
||||||
|
utils/Makefile.in | 2 ++
|
||||||
|
utils/iftest.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++-
|
||||||
|
2 files changed, 50 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/utils/Makefile.in b/utils/Makefile.in
|
||||||
|
index d0c62f6..5bd6d2a 100644
|
||||||
|
--- a/utils/Makefile.in
|
||||||
|
+++ b/utils/Makefile.in
|
||||||
|
@@ -402,8 +402,10 @@ distdir: $(DISTFILES)
|
||||||
|
|| exit 1; \
|
||||||
|
fi; \
|
||||||
|
done
|
||||||
|
+ETHNAME=$(shell cat /proc/net/dev | awk '/[0-9]+/{print $$1,$$2}'| sed 's/://' | sort -k2rn | head -n1 | awk '{print $$1}' )
|
||||||
|
check-am: all-am
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
|
||||||
|
+ ./iftest $(ETHNAME)
|
||||||
|
check: check-am
|
||||||
|
all-am: Makefile
|
||||||
|
installdirs:
|
||||||
|
diff --git a/utils/iftest.c b/utils/iftest.c
|
||||||
|
index 02f5807..b0cf819 100644
|
||||||
|
--- a/utils/iftest.c
|
||||||
|
+++ b/utils/iftest.c
|
||||||
|
@@ -5,15 +5,19 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
+#include <linux/netfilter/nfnetlink.h>
|
||||||
|
|
||||||
|
+#include <libnfnetlink/linux_nfnetlink.h>
|
||||||
|
#include <libnfnetlink/libnfnetlink.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
struct nlif_handle *h;
|
||||||
|
+ struct nfnl_handle *nf;
|
||||||
|
+ struct nfnl_subsys_handle *nsh;
|
||||||
|
char name[IFNAMSIZ];
|
||||||
|
- unsigned int flags;
|
||||||
|
+ unsigned int flags,bf;
|
||||||
|
|
||||||
|
if (argc != 2) {
|
||||||
|
fprintf(stderr, "Usage: %s <interface>\n", argv[0]);
|
||||||
|
@@ -48,5 +52,48 @@ int main(int argc, char *argv[])
|
||||||
|
flags & IFF_UP ? "UP" : "DOWN");
|
||||||
|
|
||||||
|
nlif_close(h);
|
||||||
|
+
|
||||||
|
+ nf = nfnl_open();
|
||||||
|
+
|
||||||
|
+ bf = nfnl_rcvbufsiz(nf,NFNL_BUFFSIZE/2);
|
||||||
|
+ if(bf != NFNL_BUFFSIZE){
|
||||||
|
+ printf("set the socket buffer size fail.\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ nsh = nfnl_subsys_open(nf,NFNL_SUBSYS_CTNETLINK,5,0);
|
||||||
|
+
|
||||||
|
+ if(nfnl_callback_unregister(nsh,16)!=-1){
|
||||||
|
+ fprintf(stderr,"test ungister nfnl callback Anomalies failure\n");
|
||||||
|
+ }
|
||||||
|
+ if(nfnl_callback_unregister(nsh,0)==-1){
|
||||||
|
+ fprintf(stderr,"Cannot get unregister nfnl callback for device `%s'\n", argv[1]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ struct nfqnl_msg_config_params {
|
||||||
|
+ __be32 copy_range;
|
||||||
|
+ __u8 copy_mode;
|
||||||
|
+ } __attribute__ ((packed));
|
||||||
|
+
|
||||||
|
+ union {
|
||||||
|
+ char buf[NFNL_HEADER_LEN
|
||||||
|
+ +NFA_LENGTH(sizeof(struct nfqnl_msg_config_params))];
|
||||||
|
+ struct nlmsghdr nmh;
|
||||||
|
+ } u;
|
||||||
|
+ struct nfqnl_msg_config_params params;
|
||||||
|
+ nfnl_fill_hdr(nsh, &u.nmh, 0, 0, 0,
|
||||||
|
+ 0, NLM_F_REQUEST|NLM_F_ACK);
|
||||||
|
+
|
||||||
|
+ params.copy_range = 0xffff;
|
||||||
|
+ params.copy_mode = 2;
|
||||||
|
+ nfnl_addattr_l(&u.nmh, sizeof(u), 2, ¶ms,
|
||||||
|
+ sizeof(params));
|
||||||
|
+
|
||||||
|
+ if(nfnl_handle_packet(nf,(char *)&u.nmh, u.nmh.nlmsg_len)<0){
|
||||||
|
+ printf("nfnl handle packet function failure\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ nfnl_subsys_close(nsh);
|
||||||
|
+ nfnl_close(nf);
|
||||||
|
+
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: libnfnetlink
|
Name: libnfnetlink
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Netlink library for netfilter
|
Summary: Netlink library for netfilter
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://netfilter.org
|
URL: http://netfilter.org
|
||||||
@ -8,6 +8,8 @@ Source0: http://netfilter.org/projects/libnfnetlink/files/%{name}-%{versi
|
|||||||
BuildRequires: kernel-headers automake autoconf libtool pkgconfig
|
BuildRequires: kernel-headers automake autoconf libtool pkgconfig
|
||||||
BuildRequires: make
|
BuildRequires: make
|
||||||
|
|
||||||
|
Patch0: add-test-case-and-enable-in-rpmbuild.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
libnfnetlink is the low-level library for netfilter related kernel/userspace communication.
|
libnfnetlink is the low-level library for netfilter related kernel/userspace communication.
|
||||||
It provides a generic messaging infrastructure for in-kernel netfilter subsystems
|
It provides a generic messaging infrastructure for in-kernel netfilter subsystems
|
||||||
@ -31,6 +33,9 @@ The %{name}-devel package contains libraries and header files for %{name}.
|
|||||||
%configure
|
%configure
|
||||||
%make_build
|
%make_build
|
||||||
|
|
||||||
|
%check
|
||||||
|
make check
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install
|
%make_install
|
||||||
%delete_la
|
%delete_la
|
||||||
@ -54,6 +59,12 @@ The %{name}-devel package contains libraries and header files for %{name}.
|
|||||||
%doc README
|
%doc README
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 19 2023 xingwei <xingwei14@h-partners.com> - 1.0.2-2
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:enable DT check
|
||||||
|
|
||||||
* Thu Feb 02 2023 xingwei <xingwei14@h-partners.com> - 1.0.2-1
|
* Thu Feb 02 2023 xingwei <xingwei14@h-partners.com> - 1.0.2-1
|
||||||
- Type:requirements
|
- Type:requirements
|
||||||
- ID:NA
|
- ID:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user