diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-04-17 16:32:39 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-04-20 03:48:48 +0200 |
commit | 88232ec1ec5ecf4aa5de439cff3d5e2b7adcac93 (patch) | |
tree | 3b7255875d4f657e0cf0e3087ecab918f3d01ba3 /net/handshake/netlink.c | |
parent | net/handshake: Add a kernel API for requesting a TLSv1.3 handshake (diff) | |
download | linux-88232ec1ec5ecf4aa5de439cff3d5e2b7adcac93.tar.xz linux-88232ec1ec5ecf4aa5de439cff3d5e2b7adcac93.zip |
net/handshake: Add Kunit tests for the handshake consumer API
These verify the API contracts and help exercise lifetime rules for
consumer sockets and handshake_req structures.
One way to run these tests:
./tools/testing/kunit/kunit.py run --kunitconfig ./net/handshake/.kunitconfig
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/handshake/netlink.c')
-rw-r--r-- | net/handshake/netlink.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/handshake/netlink.c b/net/handshake/netlink.c index 7264cac04047..8ea0ff993f9f 100644 --- a/net/handshake/netlink.c +++ b/net/handshake/netlink.c @@ -18,6 +18,8 @@ #include <net/genetlink.h> #include <net/netns/generic.h> +#include <kunit/visibility.h> + #include <uapi/linux/handshake.h> #include "handshake.h" #include "genl.h" @@ -38,6 +40,10 @@ int handshake_genl_notify(struct net *net, const struct handshake_proto *proto, struct sk_buff *msg; void *hdr; + /* Disable notifications during unit testing */ + if (!test_bit(HANDSHAKE_F_PROTO_NOTIFY, &proto->hp_flags)) + return 0; + if (!genl_has_listeners(&handshake_nl_family, net, proto->hp_handler_class)) return -ESRCH; @@ -262,6 +268,7 @@ struct handshake_net *handshake_pernet(struct net *net) return handshake_net_id ? net_generic(net, handshake_net_id) : NULL; } +EXPORT_SYMBOL_IF_KUNIT(handshake_pernet); static int __init handshake_init(void) { |