IF_ADDRHOOK_ADD(9)
π IF_ADDRHOOK_ADD(9) β Kernel Developer's Manual β¨
okay so bestie, this is the whole interface event hook API situation, and itβs lowkey iconic kernel-dev energy π
πΈ NAME πΈ
if_addrhook_add, if_addrhook_del, if_detachhook_add, if_detachhook_del, if_linkstatehook_add, if_linkstatehook_del β interface event hook API
π¦ SYNOPSIS π¦
#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);
β¨ DESCRIPTION β¨
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, bestie β like, do the setup first, then slay π«Ά
if_addrhook_add()β registers the taskton theifpinterface. The event will fire every time an IPv4 or IPv6 address change occurs on the interface, until explicitly removed withif_addrhook_del(). Itβs giving βaddress changes? Iβm watching πβ¨βif_addrhook_del()β removes the tasktfrom theifpinterface. bye bestie πif_detachhook_add()β registers the taskton theifpinterface. The event will fire when the interface is being destroyed. dramatic, but necessary πif_detachhook_del()β removes the tasktfrom theifpinterface.if_linkstatehook_add()β registers the taskton theifpinterface. The event will fire for every link state change, or when the interface is brought up or down, until explicitly removed withif_linkstatehook_del(). link-state main character behavior, fr fr πif_linkstatehook_del()β removes the tasktfrom theifpinterface.
π CONTEXT π
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. so yes, they can show up in all those places β no cap π«
π SEE ALSO π
task_set(9)β go peek, iykyk π
xoxo, Debian β February 22, 2024 π
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2019 David Gwynne <dlg@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms