EPROTONOSUPPORT
Linux / POSIXERRORCommonNetworkHIGH confidence

Protocol Not Supported

Production Risk

Check kernel module availability before using non-default protocols in production.

What this means

EPROTONOSUPPORT (errno 93) is returned by socket() when the requested protocol is not supported by the address family or is not available on the system.

Why it happens
  1. 1Requesting IPPROTO_SCTP when the sctp kernel module is not loaded
  2. 2Specifying an unknown protocol number
  3. 3Using a protocol not supported by the address family
How to reproduce

Creating an SCTP socket without the sctp module loaded.

trigger — this will error
trigger — this will error
// SCTP socket without sctp module loaded
int sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP);
// Returns -1, errno = EPROTONOSUPPORT

expected output

socket: Protocol not supported (EPROTONOSUPPORT)

Fix 1

Load the kernel module for the protocol

WHEN When the protocol module is not loaded

Load the kernel module for the protocol
# Load the SCTP module
modprobe sctp
# Verify it loaded
lsmod | grep sctp

Why this works

Many protocols are loadable kernel modules; modprobe loads them without rebooting.

Fix 2

Use protocol 0 to let the kernel choose

WHEN When the specific protocol is not critical

Use protocol 0 to let the kernel choose
// Let kernel choose the default protocol for the socket type
int sockfd = socket(AF_INET, SOCK_STREAM, 0);  // IPPROTO_TCP

Why this works

Protocol 0 selects the default protocol for the given address family and socket type.

Sources
Official documentation ↗

Linux Programmer Manual socket(2)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors