ktest: make ktest work with Netlink loaded as a module.

MFC after:	2 weeks
This commit is contained in:
Alexander V. Chernikov 2023-06-01 07:25:41 +00:00
parent 08300d8494
commit 0eb0d23335
3 changed files with 4 additions and 2 deletions

View File

@ -9,5 +9,6 @@ SYSDIR?=${SRCTOP}/sys
KMOD= ktest_example KMOD= ktest_example
SRCS= ktest_example.c SRCS= ktest_example.c
SRCS+= opt_netlink.h
.include <bsd.kmod.mk> .include <bsd.kmod.mk>

View File

@ -94,7 +94,7 @@ static struct ktest_module_info _module_info = { \
}; \ }; \
\ \
static moduledata_t _module_data = { \ static moduledata_t _module_data = { \
"__" #_n "_module", \ #_n, \
ktest_default_modevent, \ ktest_default_modevent, \
&_module_info, \ &_module_info, \
}; \ }; \
@ -102,6 +102,7 @@ static moduledata_t _module_data = { \
DECLARE_MODULE(ktest_##_n, _module_data, SI_SUB_PSEUDO, SI_ORDER_ANY); \ DECLARE_MODULE(ktest_##_n, _module_data, SI_SUB_PSEUDO, SI_ORDER_ANY); \
MODULE_VERSION(ktest_##_n, 1); \ MODULE_VERSION(ktest_##_n, 1); \
MODULE_DEPEND(ktest_##_n, ktestmod, 1, 1, 1); \ MODULE_DEPEND(ktest_##_n, ktestmod, 1, 1, 1); \
MODULE_DEPEND(ktest_##_n, netlink, 1, 1, 1); \
#endif /* _KERNEL */ #endif /* _KERNEL */

View File

@ -91,7 +91,7 @@ class KtestLoader(object):
ret = [] ret = []
for rx_msg in NetlinkMultipartIterator(self.nlsock, nlmsg_seq, self.family_id): for rx_msg in NetlinkMultipartIterator(self.nlsock, nlmsg_seq, self.family_id):
# test_msg.print_message() # rx_msg.print_message()
tst = { tst = {
"mod_name": rx_msg.get_nla(KtestAttrType.KTEST_ATTR_MOD_NAME).text, "mod_name": rx_msg.get_nla(KtestAttrType.KTEST_ATTR_MOD_NAME).text,
"name": rx_msg.get_nla(KtestAttrType.KTEST_ATTR_TEST_NAME).text, "name": rx_msg.get_nla(KtestAttrType.KTEST_ATTR_TEST_NAME).text,