can_send(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… can_send(9) β€” the Kernel API Manual page you've been waiting for πŸŽ€

okay bestie, welcome to the Kernel API Manual section 9, where we talk about can_send β€” the little function that yeets a CAN frame out into the world (and, if you want, loops it back so your local besties can hear it too). ✨


✨ NAME ✨

can_send β€” transmit a CAN frame (optional with local loopback) πŸ¦‹


🌸 SYNOPSIS 🌸

int can_send (struct sk_buff *skb , int loop );

πŸŽ€ ARGUMENTS πŸŽ€

  • skb β€” pointer to a socket buffer that's holding your CAN frame down in its data section. that's the cargo, bestie πŸ“¦
  • loop β€” the loopback for listeners on local CAN sockets. and like… it's the recommended default! (yes, with the exclamation point, the manpage is that serious about it πŸ’…)

πŸ’– DESCRIPTION πŸ’–

so here's the tea β˜• β€” because of the loopback, this routine must not be called from hardirq context. like, don't do it. not the vibe. πŸ™ˆ


πŸ”₯ RETURN πŸ”₯

the receipts, in order:

  • 0 on success β€” slay, it worked πŸ‘‘
  • -ENETDOWN when the selected interface is down 😭
  • -ENOBUFS on a full driver queue (check net_xmit_errno, iykyk)
  • -ENOMEM when local loopback failed at calling skb_clone πŸ’€
  • -EPERM when you're trying to send on a non-CAN interface (wrong crowd, babe)
  • -EMSGSIZE when the CAN frame size is bigger than the CAN interface MTU 🫠
  • -EINVAL when skb->data does not contain a valid CAN frame β€” literally what are you even handing me
ngl, half of these are just the kernel gently telling you "no <3" β€” check your interface, your buffer, and your frame before you come for can_send.

🌈 SEE ALSO 🌈

Kernel file ./net/can/af_can.c β€” plus the whole friend group: effhash(9), can_rcv_list_find(9), can_rx_register(9), can_rx_unregister(9), can_proto_register(9), can_proto_unregister(9). go say hi to all of them, they're iconic 🫢


and that's the whole page, bestie πŸ’œ β€” brought to you by ./net/can, dated October 2026. mwah, go transmit responsibly 🧚⭐

πŸ“¦ where this page comes from