[LTP] [PATCH 0/3] Netlink helper functions refactoring

Martin Doucha mdoucha@suse.cz
Fri Oct 13 17:17:13 CEST 2023


Let's refactor the rtnetlink helper functions for generic use where possible.
The Netlink context structure can be used for other Netlink protocols like
NETLINK_CRYPTO or NETLINK_NETFILTER. One of the exceptions is
the NETLINK_KOBJECT_UEVENT protocol which returns raw data without the usual
headers.

The first patch replaces the tst_rtnl_* and RTNL_* prefix with tst_netlink_*
and NETLINK_* respectively to signify that the functions can be used
for generic netlink communication. The attribute handling functions are
specific to the NETLINK_ROUTE protocol so they keep the old prefix.

The last patch then replaces old netlink send/receive helper functions
with the context-based helpers in crypto test code.

Coming soon is a new netfilter CVE test which will also use the refactored
code.

Martin Doucha (3):
  tst_rtnetlink: Refactor helper function for generic use
  tst_netlink_destroy_context(): Allow safely passing NULL context
  crypto: Replace old netlink helper functions with netlink contexts

 doc/network-c-api.txt                   | 159 +++++++++++-----------
 include/tst_crypto.h                    |  67 +---------
 include/tst_netdevice.h                 |   2 +-
 include/tst_netlink.h                   | 171 ++++++++++++++----------
 include/tst_rtnetlink.h                 | 108 ---------------
 lib/tst_crypto.c                        |  90 +++----------
 lib/tst_netdevice.c                     |  95 ++++++-------
 lib/{tst_rtnetlink.c => tst_netlink.c}  |  88 ++++++------
 testcases/cve/tcindex01.c               |   4 +-
 testcases/kernel/crypto/crypto_user01.c |  58 +++-----
 testcases/kernel/crypto/crypto_user02.c |  17 +--
 testcases/kernel/crypto/pcrypt_aead01.c |  10 +-
 12 files changed, 331 insertions(+), 538 deletions(-)
 delete mode 100644 include/tst_rtnetlink.h
 rename lib/{tst_rtnetlink.c => tst_netlink.c} (77%)

-- 
2.42.0



More information about the ltp mailing list