---
name: "rdma_getaddrinfo"
section: "3"
platform: "linux"
package: "rdma-core"
version: "65.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/rdma_getaddrinfo"
---

# rdma\_getaddrinfo(3)

Provides transport independent address translation.

## NAME

rdma\_getaddrinfo - Provides transport independent address translation.

## SYNOPSIS

**#include \<rdma/rdma\_cma.h\>**

**int rdma\_getaddrinfo** **(const char \****node***,** **const char \****service***,** **const struct rdma\_addrinfo \****hints***,** **struct rdma\_addrinfo \*\****res***);**

## ARGUMENTS

- node

  Optional, name, dotted-decimal IPv4, or IPv6 hex address to resolve.

- service

  Service name or port number of address.

- hints

  Reference to an rdma\_addrinfo structure containing hints about the type of service the caller supports.

- res

  A pointer to a linked list of rdma\_addrinfo structures containing response information.

## DESCRIPTION

Resolves the destination node and service address and returns information needed to establish communication.  Provides the RDMA functional equivalent to getaddrinfo.

## RETURN VALUE

Returns 0 on success, or -1 on error (errno will be set to indicate the failure reason), or one of the following nonzero error codes:

- EAI\_ADDRFAMILY

  The specified network host does not have any network addresses in the requested address family.

- EAI\_AGAIN

  The name server returned a temporary failure indication. Try again later.

- EAI\_BADFLAGS

  hints.ai\_flags contains invalid flags.

- EAI\_FAIL

  The name server returned a permanent failure indication.

- EAI\_FAMILY

  The requested address family is not supported.

- EAI\_MEMORY

  Out of memory.

- EAI\_NODATA

  The specified network host exists, but does not have any network addresses defined.

- EAI\_NONAME

  The node or service is not known; or both node and service are NULL.

- EAI\_SERVICE

  The requested service is not available for the requested QP type. It may be available through another QP type.

- EAI\_QPTYPE

  The requested socket type is not supported. This could occur, for example, if hints.ai\_qptype and hints.ai\_port\_space are inconsistent (e.g., IBV\_QPT\_UD and RDMA\_PS\_TCP, respectively).

- EAI\_SYSTEM

  Other system error, check errno for details. The gai\_strerror() function translates these error codes to a human readable string, suitable for error reporting.

## NOTES

Either node, service, or hints must be provided.  If hints are provided, the operation will be controlled by hints.ai\_flags.  If RAI\_PASSIVE is specified, the call will resolve address information for use on the passive side of a connection. If node is provided, rdma\_getaddrinfo will attempt to resolve the RDMA address, route, and connection data to the given node.  The hints parameter, if provided, may be used to control the resulting output as indicated below. If node is not given, rdma\_getaddrinfo will attempt to resolve the RDMA addressing information based on the hints.ai\_src\_addr, hints.ai\_dst\_addr, or hints.ai\_route.

## rdma\_addrinfo

- ai\_flags

  Hint flags that control the operation.  Supported flags are:

- RAI\_PASSIVE

  Indicates that the results will be used on the passive/listening side of a connection.

- RAI\_NUMERICHOST

  If specified, then the node parameter, if provided, must be a numerical network address.  This flag suppresses any lengthy address resolution.

- RAI\_NOROUTE

  If set, this flag suppresses any lengthy route resolution.

- RAI\_FAMILY

  If set, the ai\_family setting should be used as an input hint for interpretting the node parameter.

- RAI\_DNS

  Indicates that address resolution should use DNS to map the node and service names to addresses. Flag is mutually exclusive with RAI\_SA. DNS resolution is the default option.

- RAI\_SA

  Indicates that address resolution should query the Infiniband SA to map node and service names to addresses. Flag is mutually exclusive with RAI\_DNS. SA resolution only applies to Infiniband ports. Non-Infiniband ports will be skipped.

- ai\_family

  Address family for the source and destination address.  Supported families are: AF\_INET, AF\_INET6, and AF\_IB.

- ai\_qp\_type

  Indicates the type of RDMA QP used for communication.  Supported types are: IBV\_QPT\_UD (unreliable datagram) and IBV\_QPT\_RC (reliable connected).

- ai\_port\_space

  RDMA port space in use.  Supported values are: RDMA\_PS\_UDP, RDMA\_PS\_TCP, and RDMA\_PS\_IB.

- ai\_src\_len

  The length of the source address referenced by ai\_src\_addr.  This will be 0 if an appropriate source address could not be discovered for a given destination.

- ai\_dst\_len

  The length of the destination address referenced by ai\_dst\_addr.  This will be 0 if the RAI\_PASSIVE flag was specified as part of the hints.

- ai\_src\_addr

  If provided, the address for the local RDMA device.

- ai\_dst\_addr

  If provided, the address for the destination RDMA device.

- ai\_src\_canonname

  The canonical for the source.

- ai\_dst\_canonname

  The canonical for the destination.

- ai\_route\_len

  Size of the routing information buffer referenced by ai\_route.  This will be 0 if the underlying transport does not require routing data, or none  could be resolved.

- ai\_route

  Routing information for RDMA transports that require routing data as part of connection establishment.  The format of the routing data depends on the underlying transport.  If Infiniband transports are used, ai\_route will reference an array of struct ibv\_path\_data on output, if routing data is available.  Routing paths may be restricted by setting desired routing data fields on input to rdma\_getaddrinfo.  For Infiniband, hints.ai\_route may reference an array of struct ibv\_path\_record or struct ibv\_path\_data on input.

- ai\_connect\_len

  Size of connection information referenced by ai\_connect.  This will be 0 if the underlying transport does not require additional connection information.

- ai\_connect

  Data exchanged as part of the connection establishment process.  If provided, ai\_connect data must be transferred as private data, with any user supplied private data following it.

- ai\_next

  Pointer to the next rdma\_addrinfo structure in the list.  Will be NULL if no more structures exist.

## SEE ALSO

[rdma\_create\_id(3)](/rdma_create_id/3.md), [rdma\_resolve\_route(3)](/rdma_resolve_route/3.md), [rdma\_connect(3)](/rdma_connect/3.md), [rdma\_create\_qp(3)](/rdma_create_qp/3.md), [rdma\_bind\_addr(3)](/rdma_bind_addr/3.md), [rdma\_create\_ep(3)](/rdma_create_ep/3.md), [rdma\_freeaddrinfo(3)](/rdma_freeaddrinfo/3.md), [rdma\_resolve\_addrinfo(3)](/rdma_resolve_addrinfo/3.md),[rdma\_query\_addrinfo(3)](/rdma_query_addrinfo/3.md)
