knet_link_get_status(3)

knet_link_get_status3

Get the status (and statistics) for a link.

Usage

#include <libknet.h>

int knet_link_get_status(
    knet_handle_t              knet_h,
    knet_node_id_t             host_id,
    uint8_t                    link_id,
    struct knet_link_status   *status,
    size_t                     struct_size
);

Overview

knet_link_get_status

knet_h - pointer to knet_handle_t

host_id - see knet_host_add(3)

link_id - see knet_link_set_config(3)

status - pointer to knet_link_status struct

struct_size - max size of knet_link_status - allows library to add fields without ABI change. Returned structure will be truncated to this length and .size member indicates the full size.

Structures

Status of a knet link as returned from knet_link_get_status() 
struct knet_link_status {
    /*
     * Size of the structure for ABI checking, set this to
     * sizeof(knet_link_status) before calling knet_link_get_status()
     */
    size_t              size;
    char                src_ipaddr[KNET_MAX_HOST_LEN];  /* Local IP address as a string */
    char                src_port[KNET_MAX_PORT_LEN];    /* Local IP port as a string */
    char                dst_ipaddr[KNET_MAX_HOST_LEN];  /* Remote IP address as a string */
    char                dst_port[KNET_MAX_PORT_LEN];    /* Remote IP port as a string */
    uint8_t             enabled;                        /* Link is configured and admin enabled for traffic */
    uint8_t             connected;                      /* Link is connected for data (local view) */
    uint8_t             dynconnected;                   /* Link has been activated by remote dynip */
    unsigned long long  latency;                        /* average latency computed by fix/exp */
    struct timespec     pong_last;                      /* Timestamp of the past pong received */
    unsigned int        mtu;                            /* Currently detected MTU on this link */
    /*
     * Contains the size of the IP protocol, knet headers and crypto headers
     * (if configured). This value is filled in ONLY after the first PMTUd run on
     * that given link, and can change if link configuration or crypto configuration
     * changes at runtime. WARNING: in general mtu + proto_overhead might or might not
     * match the output of ifconfig mtu due to crypto requirements to pad packets to
     * some specific boundaries.
     */
    unsigned int        proto_overhead;
    struct              stats;                          /* Link statistics */
};

Return value

knet_link_get_status returns 0 on success -1 on error and errno is set.

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

From libknet-doc 1.31-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.