IF_ADDRHOOK_ADD(9) Kernel Developer's Manual IF_ADDRHOOK_ADD(9)

if_addrhook_add, if_addrhook_del, if_detachhook_add, if_detachhook_del, if_linkstatehook_add, if_linkstatehook_delinterface event hook API

#include <net/if_var.h>

void
if_addrhook_add(struct ifnet *ifp, struct task *t);

void
if_addrhook_del(struct ifnet *ifp, struct task *t);

void
if_detachhook_add(struct ifnet *ifp, struct task *t);

void
if_detachhook_del(struct ifnet *ifp, struct task *t);

void
if_linkstatehook_add(struct ifnet *ifp, struct task *t);

void
if_linkstatehook_del(struct ifnet *ifp, struct task *t);

The interface hook API allows for the registration of a task that will be called when an IP address change, link state, or detach event occurs on the specified interface. Tasks should be initialised with task_add(9) or TASK_INITIALIZER(9) before being used with the following functions.

The () function registers the task t on the ifp interface. The event will fire every time an IPv4 or IPv6 address change occurs on the interface until explicitly removed with if_addrhook_del().

The () function removes the task t from the ifp interface.

The () function registers the task t on the ifp interface. The event will fire when the interface is being destroyed.

The () function removes the task t from the ifp interface.

The () function registers the task t on the ifp interface. The event will fire for every link state change, or when the interface is brought up or down, until explicitly removed with if_linkstatehook_del().

The () function removes the task t from the ifp interface.

if_addrhook_add(), if_addrhook_del(), if_detachhook_add(), if_detachhook_del(), if_linkstatehook_add(), and if_linkstatehook_del() can be called during autoconf, from process context, or from interrupt context.

task_set(9)

February 22, 2024 OpenBSD 7.6