Re: Kernel TLS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxx
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux