Compare commits
10 Commits
13c2fa8904
...
d52d202e5e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d52d202e5e | ||
|
|
12734b4c1f | ||
|
|
57ac1fc742 | ||
|
|
3d2d2f3af4 | ||
|
|
bde908ed34 | ||
|
|
82c9220e74 | ||
|
|
6dab360a2c | ||
|
|
7a822206db | ||
|
|
49a5d048e5 | ||
|
|
ae04f6cdea |
94
backport-sync-uapi-header-with-nf-next.patch
Normal file
94
backport-sync-uapi-header-with-nf-next.patch
Normal file
@ -0,0 +1,94 @@
|
||||
From 5f6a7f009687f9790411e8e94b41423dcbe205b1 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Westphal <fw@strlen.de>
|
||||
Date: Mon, 2 Aug 2021 11:12:28 +0200
|
||||
Subject: include: sync uapi header with nf-next
|
||||
|
||||
Conflict: remove CTA_STATUS_MASK enum constant not provided by kernel.
|
||||
Reference: https://git.netfilter.org/libnetfilter_conntrack/commit/?id=5f6a7f009687f9790411e8e94b41423dcbe205b1
|
||||
|
||||
Signed-off-by: Florian Westphal <fw@strlen.de>
|
||||
---
|
||||
.../linux_nfnetlink_conntrack.h | 23 +++++++++++++++----
|
||||
1 file changed, 18 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h b/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h
|
||||
index aa45723..693f3d8 100644
|
||||
--- a/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h
|
||||
+++ b/include/libnetfilter_conntrack/linux_nfnetlink_conntrack.h
|
||||
@@ -58,6 +58,7 @@ enum ctattr_type {
|
||||
CTA_LABELS,
|
||||
CTA_LABELS_MASK,
|
||||
CTA_SYNPROXY,
|
||||
+ CTA_FILTER,
|
||||
__CTA_MAX
|
||||
};
|
||||
#define CTA_MAX (__CTA_MAX - 1)
|
||||
@@ -121,6 +122,7 @@ enum ctattr_protoinfo_dccp {
|
||||
CTA_PROTOINFO_DCCP_STATE,
|
||||
CTA_PROTOINFO_DCCP_ROLE,
|
||||
CTA_PROTOINFO_DCCP_HANDSHAKE_SEQ,
|
||||
+ CTA_PROTOINFO_DCCP_PAD,
|
||||
__CTA_PROTOINFO_DCCP_MAX,
|
||||
};
|
||||
#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
|
||||
@@ -140,6 +142,7 @@ enum ctattr_counters {
|
||||
CTA_COUNTERS_BYTES, /* 64bit counters */
|
||||
CTA_COUNTERS32_PACKETS, /* old 32bit counters, unused */
|
||||
CTA_COUNTERS32_BYTES, /* old 32bit counters, unused */
|
||||
+ CTA_COUNTERS_PAD,
|
||||
__CTA_COUNTERS_MAX
|
||||
};
|
||||
#define CTA_COUNTERS_MAX (__CTA_COUNTERS_MAX - 1)
|
||||
@@ -148,6 +151,7 @@ enum ctattr_tstamp {
|
||||
CTA_TIMESTAMP_UNSPEC,
|
||||
CTA_TIMESTAMP_START,
|
||||
CTA_TIMESTAMP_STOP,
|
||||
+ CTA_TIMESTAMP_PAD,
|
||||
__CTA_TIMESTAMP_MAX
|
||||
};
|
||||
#define CTA_TIMESTAMP_MAX (__CTA_TIMESTAMP_MAX - 1)
|
||||
@@ -242,13 +246,13 @@ enum ctattr_secctx {
|
||||
|
||||
enum ctattr_stats_cpu {
|
||||
CTA_STATS_UNSPEC,
|
||||
- CTA_STATS_SEARCHED,
|
||||
+ CTA_STATS_SEARCHED, /* no longer used */
|
||||
CTA_STATS_FOUND,
|
||||
- CTA_STATS_NEW,
|
||||
+ CTA_STATS_NEW, /* no longer used */
|
||||
CTA_STATS_INVALID,
|
||||
- CTA_STATS_IGNORE,
|
||||
- CTA_STATS_DELETE,
|
||||
- CTA_STATS_DELETE_LIST,
|
||||
+ CTA_STATS_IGNORE, /* no longer used */
|
||||
+ CTA_STATS_DELETE, /* no longer used */
|
||||
+ CTA_STATS_DELETE_LIST, /* no longer used */
|
||||
CTA_STATS_INSERT,
|
||||
CTA_STATS_INSERT_FAILED,
|
||||
CTA_STATS_DROP,
|
||||
@@ -262,6 +266,7 @@ enum ctattr_stats_cpu {
|
||||
enum ctattr_stats_global {
|
||||
CTA_STATS_GLOBAL_UNSPEC,
|
||||
CTA_STATS_GLOBAL_ENTRIES,
|
||||
+ CTA_STATS_GLOBAL_MAX_ENTRIES,
|
||||
__CTA_STATS_GLOBAL_MAX,
|
||||
};
|
||||
#define CTA_STATS_GLOBAL_MAX (__CTA_STATS_GLOBAL_MAX - 1)
|
||||
@@ -275,6 +280,14 @@ enum ctattr_expect_stats {
|
||||
};
|
||||
#define CTA_STATS_EXP_MAX (__CTA_STATS_EXP_MAX - 1)
|
||||
|
||||
+enum ctattr_filter {
|
||||
+ CTA_FILTER_UNSPEC,
|
||||
+ CTA_FILTER_ORIG_FLAGS,
|
||||
+ CTA_FILTER_REPLY_FLAGS,
|
||||
+ __CTA_FILTER_MAX
|
||||
+};
|
||||
+#define CTA_FILTER_MAX (__CTA_FILTER_MAX - 1)
|
||||
+
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
--
|
||||
2.33.0
|
||||
|
||||
90
enable-make-check-tests.patch
Normal file
90
enable-make-check-tests.patch
Normal file
@ -0,0 +1,90 @@
|
||||
From e02ad202d6eec5ee012e24cb1901167f07511055 Mon Sep 17 00:00:00 2001
|
||||
From: zhangwenhao <zhangwenhao8@huawei.com>
|
||||
Date: Thu, 28 Jan 2021 22:41:36 +0800
|
||||
Subject: [PATCH] enable make check tests
|
||||
|
||||
---
|
||||
tests/Makefile.in | 7 +++++++
|
||||
tests/ct_events_reliable.c | 4 +++-
|
||||
tests/qa-connlabel.conf | 11 +++++++++++
|
||||
tests/test_filter.c | 5 ++++-
|
||||
4 files changed, 25 insertions(+), 2 deletions(-)
|
||||
create mode 100644 tests/qa-connlabel.conf
|
||||
|
||||
diff --git a/tests/Makefile.in b/tests/Makefile.in
|
||||
index 7fb8924..4c600df 100644
|
||||
--- a/tests/Makefile.in
|
||||
+++ b/tests/Makefile.in
|
||||
@@ -520,6 +520,13 @@ distdir: $(DISTFILES)
|
||||
done
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
|
||||
+ ./test_api
|
||||
+ ./test_connlabel
|
||||
+ ./ct_stress 10000 & ./test_filter
|
||||
+ ../utils/conntrack_flush
|
||||
+ ./ct_stress 10000 & ./ct_events_reliable
|
||||
+ ../utils/conntrack_flush
|
||||
+
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
diff --git a/tests/ct_events_reliable.c b/tests/ct_events_reliable.c
|
||||
index b51d0e5..26ff8e9 100644
|
||||
--- a/tests/ct_events_reliable.c
|
||||
+++ b/tests/ct_events_reliable.c
|
||||
@@ -20,9 +20,11 @@ static int event_cb(enum nf_conntrack_msg_type type,
|
||||
else if (type == NFCT_T_DESTROY)
|
||||
destroy++;
|
||||
|
||||
- if ((++events % 10000) == 0)
|
||||
+ if ((++events % 3) == 0) {
|
||||
printf("%d events received (%d new, %d update, %d destroy)\n",
|
||||
events, new, update, destroy);
|
||||
+ return NFCT_CB_STOP;
|
||||
+ }
|
||||
|
||||
return NFCT_CB_CONTINUE;
|
||||
}
|
||||
diff --git a/tests/qa-connlabel.conf b/tests/qa-connlabel.conf
|
||||
new file mode 100644
|
||||
index 0000000..38c3115
|
||||
--- /dev/null
|
||||
+++ b/tests/qa-connlabel.conf
|
||||
@@ -0,0 +1,11 @@
|
||||
+0 zero
|
||||
+# duplicate names should be skipped
|
||||
+1 zero
|
||||
+1 test label 1
|
||||
+1 zero
|
||||
+# .. so this should have added bit 1 as "test label 1"
|
||||
+2 test label 2
|
||||
+# duplicate bit, should be skipped, too
|
||||
+2 duplicate
|
||||
+5 unused label
|
||||
+42 T
|
||||
diff --git a/tests/test_filter.c b/tests/test_filter.c
|
||||
index 7877819..efc7c3b 100644
|
||||
--- a/tests/test_filter.c
|
||||
+++ b/tests/test_filter.c
|
||||
@@ -20,7 +20,7 @@ static int event_cb(enum nf_conntrack_msg_type type,
|
||||
nfct_snprintf(buf, sizeof(buf), ct, type, NFCT_O_PLAIN, NFCT_OF_TIME);
|
||||
printf("%s\n", buf);
|
||||
|
||||
- if (++n == 10)
|
||||
+ if (++n == 1)
|
||||
return NFCT_CB_STOP;
|
||||
|
||||
return NFCT_CB_CONTINUE;
|
||||
@@ -61,6 +61,9 @@ int main(void)
|
||||
.addr = ntohl(inet_addr("127.0.0.1")) + i,
|
||||
.mask = 0xffffffff,
|
||||
};
|
||||
+ nfct_filter_set_logic(filter,
|
||||
+ NFCT_FILTER_SRC_IPV4,
|
||||
+ NFCT_FILTER_LOGIC_NEGATIVE);
|
||||
nfct_filter_add_attr(filter, NFCT_FILTER_SRC_IPV4, &fltr_ipv4);
|
||||
};
|
||||
|
||||
--
|
||||
2.23.0
|
||||
@ -1,13 +1,19 @@
|
||||
#needsrootforbuild
|
||||
|
||||
Name: libnetfilter_conntrack
|
||||
Version: 1.0.8
|
||||
Release: 1
|
||||
Release: 6
|
||||
Summary: A userspace library providing a API
|
||||
License: GPLv2+
|
||||
URL: http://netfilter.org
|
||||
Source0: http://netfilter.org/projects/libnetfilter_conntrack/files/%{name}-%{version}.tar.bz2
|
||||
|
||||
Patch0: enable-make-check-tests.patch
|
||||
Patch1: backport-sync-uapi-header-with-nf-next.patch
|
||||
|
||||
BuildRequires: pkgconfig kernel-headers
|
||||
BuildRequires: libmnl-devel >= 1.0.3 libnfnetlink-devel >= 1.0.1
|
||||
BuildRequires: make
|
||||
|
||||
%description
|
||||
libnetfilter_conntrack is a userspace library providing a programming
|
||||
@ -16,6 +22,7 @@ library is currently used by conntrack-tools among many other applications.
|
||||
|
||||
%package devel
|
||||
Summary: The development files for libnetfilter_conntrack
|
||||
BuildRequires: gcc
|
||||
Requires: kernel-headers libnfnetlink-devel >= 1.0.1
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
@ -34,6 +41,12 @@ This package contains development files.
|
||||
%make_install
|
||||
%delete_la
|
||||
|
||||
%check
|
||||
%if %{?openEuler:1}0
|
||||
sed -i '/.\/ct_stress 10000 & .\/test_filter/d' tests/Makefile.in
|
||||
%endif
|
||||
make check
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
@ -47,6 +60,36 @@ This package contains development files.
|
||||
%{_libdir}/*.so
|
||||
|
||||
%changelog
|
||||
* Fri Oct 27 2023 xingwei <xingwei14@h-partners.com> - 1.0.8-6
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:sync uapi header with nf next
|
||||
|
||||
* Mon Nov 28 2022 xingwei <xingwei14@h-partners.com> - 1.0.8-5
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:add make as BuildRequires for rpmbuild
|
||||
|
||||
* Tue Sep 20 2022 gaihuiying <eaglegai@163.com> - 1.0.8-4
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:remove filter tests
|
||||
|
||||
* Tue Sep 13 2022 seuzw <930zhaowei@163.com> - 1.0.8-3
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:enable test
|
||||
|
||||
* Thu May 27 2021 lijingyuan <lijingyuan3@huawei.com> - 1.0.8-2
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC:Add the compilation dependency of gcc.
|
||||
|
||||
* Wed Jul 22 2020 zhangxingliang <zhangxingliang3@huawei.com> - 1.0.8-1
|
||||
- Type:update
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user