tc_prog_attach(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… tc_prog_attach(9) πŸ’…

okay bestie, welcome to the Kernel API Manual entry for tc_prog_attach(9) β€” it's giving β€œattach BPF program(s) to an interface” energy, and we are gonna get you all the way together. ✨


✨ NAME ✨

tc_prog_attach β€” attach BPF program(s) to an interface. no cap, that's the whole assignment. πŸŽ€


🌸 SYNOPSIS 🌸

int tc_prog_attach (const char *dev , int ingress_fd , int egress_fd );

πŸŽ€ ARGUMENTS πŸŽ€

  • dev β€” a string containing the interface name, periodt. πŸ’…
  • ingress_fd β€” the file descriptor of the program to attach to interface ingress. πŸ¦‹
  • egress_fd β€” the file descriptor of the program to attach to interface egress. 🌸

πŸ’– DESCRIPTION πŸ’–

okay so here's the vibe: this function takes file descriptors pointing to at least one, at most two BPF programs, and attaches those programs to an interface's ingress, egress, or both. main character behavior honestly. πŸ‘‘

It returns 0 on success. it returns -1 if no valid file descriptor has been found, if the interface name is invalid, or if an error occurred during attach. lowkey important, bestie: check that return value. 😭


πŸ¦‹ SEE ALSO πŸ¦‹


xoxo, your Unix bestie πŸ’– β€” source/version: ./tools/testing/selftests/bpf; date: October 2026. periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from