inet6_option_space(3)

inet6_option_space3

Ipv6 hop-by-hop and destination options manipulation

Usage

#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);

Library

Standard C Library (libc, -lc)

Overview

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.

Releases

155 releases since Mac OS X 10.2; the text changed 2 times.

  1. 10.2–10.2.8
  2. 10.3–10.3.9
  3. 10.4–26.5

History

The implementation first appeared in KAME advanced networking kit.

Standards

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

Bugs

From Libinfo 600 in macOS 26.5. Parsed by carta from the page's mdoc source.