* [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters
@ 2024-05-15 13:44 Martin Doucha
2024-05-15 13:44 ` [LTP] [PATCH v2 2/2] tcindex01: Pass if the tcindex module is blacklisted Martin Doucha
2024-05-15 14:03 ` [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters Cyril Hrubis
0 siblings, 2 replies; 5+ messages in thread
From: Martin Doucha @ 2024-05-15 13:44 UTC (permalink / raw)
To: ltp
Add a permissive variant of the NETDEV_ADD_TRAFFIC_FILTER() macro
for tests which expect the command to fail.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
Changes since v1: New patch
include/tst_netdevice.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/tst_netdevice.h b/include/tst_netdevice.h
index 8d40148a6..2394f9c7f 100644
--- a/include/tst_netdevice.h
+++ b/include/tst_netdevice.h
@@ -179,6 +179,11 @@ int tst_netdev_add_traffic_filter(const char *file, const int lineno,
tst_netdev_add_traffic_filter(__FILE__, __LINE__, 1, (ifname), \
(parent), (handle), (protocol), (priority), (f_kind), (config))
+#define NETDEV_ADD_TRAFFIC_FILTER_RET(ifname, parent, handle, protocol, \
+ priority, f_kind, config) \
+ tst_netdev_add_traffic_filter(__FILE__, __LINE__, 0, (ifname), \
+ (parent), (handle), (protocol), (priority), (f_kind), (config))
+
int tst_netdev_remove_traffic_filter(const char *file, const int lineno,
int strict, const char *ifname, unsigned int parent,
unsigned int handle, unsigned int protocol, unsigned int priority,
--
2.44.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [LTP] [PATCH v2 2/2] tcindex01: Pass if the tcindex module is blacklisted
2024-05-15 13:44 [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters Martin Doucha
@ 2024-05-15 13:44 ` Martin Doucha
2024-05-15 14:03 ` Cyril Hrubis
2024-05-15 14:03 ` [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters Cyril Hrubis
1 sibling, 1 reply; 5+ messages in thread
From: Martin Doucha @ 2024-05-15 13:44 UTC (permalink / raw)
To: ltp
The tcindex01 test currently fails if the tcindex module is enabled
in kernel config but cannot be autoloaded. Some distros chose
to blacklist the module rather than remove it completely, thus
check for autoload failure and pass in that case.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
Changes since v1:
- Use NETDEV_ADD_TRAFFIC_FILTER_RET() macro instead of the underlying function
testcases/cve/tcindex01.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/testcases/cve/tcindex01.c b/testcases/cve/tcindex01.c
index 70e5639f1..e9c8a9a90 100644
--- a/testcases/cve/tcindex01.c
+++ b/testcases/cve/tcindex01.c
@@ -106,12 +106,23 @@ static void run(void)
NETDEV_ADD_QDISC(DEVNAME, AF_UNSPEC, TC_H_ROOT, qd_handle, "htb",
qd_config);
NETDEV_ADD_TRAFFIC_CLASS(DEVNAME, qd_handle, clsid, "htb", cls_config);
- NETDEV_ADD_TRAFFIC_FILTER(DEVNAME, qd_handle, 10, ETH_P_IP, 1,
- "tcindex", f_config);
+ ret = NETDEV_ADD_TRAFFIC_FILTER_RET(DEVNAME, qd_handle, 10, ETH_P_IP,
+ 1, "tcindex", f_config);
+ TST_ERR = tst_netlink_errno;
+
+ if (!ret && TST_ERR == ENOENT) {
+ tst_res(TPASS | TTERRNO,
+ "tcindex module is blacklisted or unavailable");
+ return;
+ }
+
+ if (!ret)
+ tst_brk(TBROK | TTERRNO, "Cannot add tcindex filter");
+
NETDEV_REMOVE_TRAFFIC_FILTER(DEVNAME, qd_handle, 10, ETH_P_IP,
1, "tcindex");
- ret = tst_netdev_add_traffic_filter(__FILE__, __LINE__, 0, DEVNAME,
- qd_handle, 10, ETH_P_IP, 1, "tcindex", f_config);
+ ret = NETDEV_ADD_TRAFFIC_FILTER_RET(DEVNAME, qd_handle, 10, ETH_P_IP,
+ 1, "tcindex", f_config);
TST_ERR = tst_netlink_errno;
NETDEV_REMOVE_QDISC(DEVNAME, AF_UNSPEC, TC_H_ROOT, qd_handle, "htb");
--
2.44.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters
2024-05-15 13:44 [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters Martin Doucha
2024-05-15 13:44 ` [LTP] [PATCH v2 2/2] tcindex01: Pass if the tcindex module is blacklisted Martin Doucha
@ 2024-05-15 14:03 ` Cyril Hrubis
1 sibling, 0 replies; 5+ messages in thread
From: Cyril Hrubis @ 2024-05-15 14:03 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 2/2] tcindex01: Pass if the tcindex module is blacklisted
2024-05-15 13:44 ` [LTP] [PATCH v2 2/2] tcindex01: Pass if the tcindex module is blacklisted Martin Doucha
@ 2024-05-15 14:03 ` Cyril Hrubis
2024-05-16 1:12 ` Petr Vorel
0 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2024-05-15 14:03 UTC (permalink / raw)
To: Martin Doucha; +Cc: ltp
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH v2 2/2] tcindex01: Pass if the tcindex module is blacklisted
2024-05-15 14:03 ` Cyril Hrubis
@ 2024-05-16 1:12 ` Petr Vorel
0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2024-05-16 1:12 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
Hi Martin, Cyril,
patchset merged. Thanks to both!
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-16 1:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 13:44 [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters Martin Doucha
2024-05-15 13:44 ` [LTP] [PATCH v2 2/2] tcindex01: Pass if the tcindex module is blacklisted Martin Doucha
2024-05-15 14:03 ` Cyril Hrubis
2024-05-16 1:12 ` Petr Vorel
2024-05-15 14:03 ` [LTP] [PATCH v2 1/2] tst_netdevice: Add permissive macro for adding traffic filters Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox