[Bug 291613] Alpine Linux 3.22: linux: jid 74 pid 98353 (apk): unsupported setsockopt level 6 optname 31
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 12 Aug 2026 03:56:18 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291613
Yuri Victorovich <yuri@freebsd.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yuri@freebsd.org
--- Comment #2 from Yuri Victorovich <yuri@freebsd.org> ---
Level 6: Corresponds to the protocol level IPPROTO_TCP (or SOL_TCP), which is
the protocol number for the Transmission Control Protocol.
Optname 31: Corresponds to TCP_ULP (Upper Layer Protocol), a Linux-specific
socket option used to attach a specialized subsystem—such as Kernel TLS
(kTLS)—directly onto an active TCP connection.
Example:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h> // Contains TCP_ULP definition on Linux
// Fallback definitions if compiling on older headers
#ifndef TCP_ULP
#define TCP_ULP 31
#endif
int main() {
// 1. Create a standard TCP socket
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
perror("Failed to create socket");
return EXIT_FAILURE;
}
// 2. Define the Upper Layer Protocol name (e.g., "tls")
const char *ulp_name = "tls";
// 3. Apply the ULP via setsockopt
// Level 6 = IPPROTO_TCP (or SOL_TCP)
// Optname 31 = TCP_ULP
int result = setsockopt(sock, IPPROTO_TCP, TCP_ULP, ulp_name,
strlen(ulp_name) + 1);
if (result < 0) {
perror("Error setting TCP_ULP (Likely unsupported by your
environment/kernel)");
close(sock);
return EXIT_FAILURE;
}
printf("Successfully attached Upper Layer Protocol '%s' to the TCP
socket!\n", ulp_name);
// Clean up
close(sock);
return EXIT_SUCCESS;
}
--
You are receiving this mail because:
You are the assignee for the bug.