netdev_get_by_index_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… netdev_get_by_index_lock(9) β€” Kernel API Manual, bestie edition πŸ’…

okay so this is the glow-up of the netdev_get_by_index_lock(9) page from the Kernel API Manual, and we are keeping every single detail because that’s the whole vibe. 🫢


🌸 NAME 🌸

netdev_get_by_index_lock β€” find a device by its ifindex


✨ SYNOPSIS ✨

struct net_device * netdev_get_by_index_lock (struct net *net , int
       ifindex );

πŸŽ€ ARGUMENTS πŸŽ€

  • net β€” the applicable net namespace. like, which netns we’re working with πŸ’«
  • ifindex β€” index of device. the little number that points at the device πŸ‘‘

πŸ’… DESCRIPTION πŸ’…

Search for an interface by index. If a valid device with ifindex is found it will be returned with netdev->lock held. netdev_unlock must be called to release it.

⚠️ bestie, this is the important part: netdev_unlock must be called to release the lock. no cap. don’t just walk away with the lock still held 😭

πŸ¦‹ RETURN πŸ¦‹

A pointer to a device with the lock held, or NULL if not found. that’s it, that’s the return vibe πŸ’–


πŸ”₯ SEE ALSO πŸ”₯

Kernel file: ./net/core/dev.c β€” and here’s the whole friend group, preserved with love and exact spelling 🌈


xoxo, signed from ./net/core with the date October 2026 β€” netdev_get_by_index_lock(9) out πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from