IF_ADDRHOOK_ADD(9)

πŸ“¦ in nixpkgs unstable

πŸ’– 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 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(). It’s giving β€œaddress changes? I’m watching πŸ‘€βœ¨β€
  • if_addrhook_del() β€” removes the task t from the ifp interface. bye bestie πŸ‘‹
  • if_detachhook_add() β€” registers the task t on the ifp interface. The event will fire when the interface is being destroyed. dramatic, but necessary πŸ’€
  • if_detachhook_del() β€” removes the task t from the ifp interface.
  • if_linkstatehook_add() β€” 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(). link-state main character behavior, fr fr 🌈
  • if_linkstatehook_del() β€” removes the task t from the ifp interface.

🌟 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms