ip6_tnl_siocdevprivate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ip6_tnl_siocdevprivate(9) β€” the Kernel API Manual page you didn't know you needed πŸŽ€

okay so bestie, welcome to the Kernel API Manual, section 9, and today's main character is ip6_tnl_siocdevprivate ✨ she configures ipv6 tunnels from userspace and she is, honestly, kind of iconic for it 🌈


🌸 NAME 🌸

ip6_tnl_siocdevprivate β€” configure ipv6 tunnels from userspace πŸ› οΈπŸ’–


✨ SYNOPSIS ✨

int ip6_tnl_siocdevprivate (struct net_device *dev , struct ifreq *ifr ,
void __user *data , int cmd );

like, that's the whole signature, no cap πŸ”₯


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the virtual device that's associated with the tunnel πŸ‘‘ she's the one holding the tunnel vibes
  • ifr β€” unused πŸ™ˆ literally just sitting there, not contributing, we still love her
  • data β€” the parameters that got passed down from userspace πŸ“¦
  • cmd β€” the command that's gonna be performed ⚑

πŸ’œ DESCRIPTION πŸ’œ

so ip6_tnl_ioctl is the one doing the actual managing of IPv6 tunnels from userspace, periodt πŸ’…

the possible commands are the following, and yes you need to know all of them 🧚:

  • SIOCGETTUNNEL: get tunnel parameters for device πŸ”
  • SIOCADDTUNNEL: add tunnel matching given tunnel parameters βž•
  • SIOCCHGTUNNEL: change tunnel parameters to those given πŸ”
  • SIOCDELTUNNEL: delete tunnel πŸ—‘οΈ

and the fallback device "ip6tnl0" β€” created during module initialization β€” can be used for creating other tunnel devices 🌱 she's giving founding mother energy, honestly obsessed 🫢


🌟 RETURN 🌟

  • 0 on success πŸŽ‰ slay
  • -EFAULT if unable to copy data to or from userspace 😭 the copy failed bestie
  • -EPERM if the current process hasn't CAP_NET_ADMIN set 🚫 no permission, no tunnel
  • -EINVAL if the passed tunnel parameters are invalid πŸ’€
  • -EEXIST if changing a tunnel's parameters would cause a conflict βš”οΈ
  • -ENODEV if attempting to change or delete a nonexisting device πŸ‘» she's not there, girl

πŸŽ€ SEE ALSO πŸŽ€

go look at the Kernel file ./net/ipv6/ip6_tunnel.c πŸ’– and then the whole friend group:

ip6_tnl_lookup(9), ip6_tnl_bucket(9), ip6_tnl_link(9), ip6_tnl_unlink(9), ip6_tnl_create(9), ip6_tnl_locate(9), ip6_tnl_dev_uninit(9), ip6_tnl_parse_tlv_enc_lim(9), ip6_tnl_addr_conflict(9), ip6_tnl_xmit(9), ip6_tnl_change(9), ip6_tnl_change_mtu(9), ip6_tnl_dev_setup(9), ip6_tnl_dev_init_gen(9), ip6_tnl_dev_init(9), ip6_fb_tnl_dev_init(9), ip6_tunnel_init(9), ip6_tunnel_cleanup(9)


and that's the page!! πŸ’« this one's from ./net/ipv6, dated October 2026, and it's the ip6_tnl_siocdevprivate(9) moment β€” mwah, go configure some tunnels, ily πŸ“πŸ’…πŸ‘‘

πŸ“¦ where this page comes from