---
name: "inet6_option_space"
section: "3"
platform: "macos"
package: "Libinfo"
version: "600"
release: "macOS 26.5"
platforms: ["freebsd", "macos"]
url: "https://new.carta.tech/inet6_option_space"
---

# inet6\_option\_space(3)

IPv6 Hop-by-Hop and Destination Options manipulation

## NAME

**inet6\_option\_space**, **inet6\_option\_init**, **inet6\_option\_append**, **inet6\_option\_alloc**, **inet6\_option\_next**, **inet6\_option\_find** – IPv6 Hop-by-Hop and Destination Options manipulation

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<netinet/in.h\>**

*int*\

**inet6\_option\_space**(*int nbytes*);

*int*\

**inet6\_option\_init**(*void \*bp*, *struct cmsghdr \*\*cmsgp*, *int type*);

*int*\

**inet6\_option\_append**(*struct cmsghdr \*cmsg*, *const u\_int8\_t \*typep*, *int multx*, *int plusy*);

*u\_int8\_t \**\

**inet6\_option\_alloc**(*struct cmsghdr \*cmsg*, *int datalen*, *int multx*, *int plusy*);

*int*\

**inet6\_option\_next**(*const struct cmsghdr \*cmsg*, *u\_int8\_t \*\*tptrp*);

*int*\

**inet6\_option\_find**(*const struct cmsghdr \*cmsg*, *u\_int8\_t \*\*tptrp*, *int type*);

## DESCRIPTION

Building and parsing the Hop-by-Hop and Destination options is complicated due to alignment constranints, padding and ancillary data manipulation. RFC2292 defines a set of functions to help the application. The function prototypes for these functions are all in the ⟨netinet/in.h⟩ header.

The full description of these functions is available in RFC2292.

## DIAGNOSTICS

**inet6\_option\_init**() and **inet6\_option\_append**() return 0 on success or -1 on an error.

**inet6\_option\_alloc**() returns NULL on an error.

On errors, **inet6\_option\_next**() and **inet6\_option\_find**() return -1 setting *\*tptrp* to non NULL value.

## EXAMPLES

RFC2292 gives comprehensive examples in chapter 6.

## SEE ALSO

W. Stevens and M. Thomas, *Advanced Sockets API for IPv6*, RFC2292, February 1998. S. Deering and R. Hinden, *Internet Protocol, Version 6 (IPv6) Specification*, RFC2460, December 1998.

## HISTORY

The implementation first appeared in KAME advanced networking kit.

## STANDARDS

The functions are documented in “Advanced Sockets API for IPv6” (RFC2292).

## BUGS
