Kernel TLS

Alexander Mihalicyn alexander at mihalicyn.com
Fri Nov 29 14:46:12 EST 2019


Hello,

I think you need to load "tls" kernel module first.

Regards, Alex

On Fri, Nov 29, 2019 at 11:37 AM Jeffrey Walton <noloader at gmail.com> wrote:
>
> Hi Everyone,
>
> I'm trying to run through the example at
> https://www.kernel.org/doc/html/latest/networking/tls.html#kernel-tls
> .
>
> I'm working on Fedora 31 x86_64 (fully patched). Running my program results in:
>
>     $ ./ktls
>     setsockopt failed, 2, No such file or directory
>
> I observed:
>
>     $ cat /proc/sys/net/ipv4/tcp_available_ulp
>     $
>
> Is there a way to enable ULP at boot? Or is this a kernel config
> option? Or maybe I am doing something else wrong?
>
> Below is the sample code.
>
> Jeff
>
> ==============================
>
> #include <stdio.h>
> #include <unistd.h>
> #include <errno.h>
> #include <string.h>
>
> #include <sys/socket.h>
> #include <sys/types.h>
>
> #include <linux/tls.h>
> #include <netinet/ip.h>
> #include <netinet/tcp.h>
>
> int main()
> {
>     int sock = socket(AF_INET, SOCK_STREAM, 0);
>     if (sock == -1)
>     {
>         printf("socket failed, %d, %s\n", errno, strerror(errno));
>         return 1;
>     }
>
>     if (setsockopt(sock, SOL_TCP, TCP_ULP, "tls", sizeof("tls")) == -1 )
>     {
>         printf("setsockopt failed, %d, %s\n", errno, strerror(errno));
>         return 1;
>     }
>
>     close (sock);
>     return 0;
> }
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



More information about the Kernelnewbies mailing list