Re: FreeBSD-native CAN Stack and AF_CAN Protocol Family

From: Jérémie_JOURDIN <jeremie.jourdin_at_advens.fr>
Date: Mon, 23 Jun 2025 06:57:22 UTC
Theoretically, yes, the CAN stack is intended to be hardware-independent.
I suppose there will also be drivers to create or modify, but that shouldn’t be the most complicated part.


De : Tomek CEDRO <tomek@cedro.info>
Date : vendredi, 20 juin 2025 à 20:29
À : Jérémie JOURDIN <jeremie.jourdin@advens.fr>
Cc : freebsd-hackers@freebsd.org <freebsd-hackers@freebsd.org>
Objet : Re: FreeBSD-native CAN Stack and AF_CAN Protocol Family
CAUTION: External Sender. This email originated from outside of ADVENS. Do not click on links or open attachments from senders you do not trust.



On Fri, Jun 20, 2025, 14:52 Jérémie JOURDIN <jeremie.jourdin@advens.fr<mailto:jeremie.jourdin@advens.fr>> wrote:
Hello all,
I am working on a system (15-current) that requires interaction with a CAN network.
So far, I have developped a driver for my controller, able to send and receive CAN frames to and from connected devices.
I’d like to implement a FreeBSD-native CAN network stack that is API-compatible with Linux’s Netlink CAN (netcan).
This would allow us to recompile and use existing Linux userland tools with minimal changes.
If you believe this development could benefit the community, I would be happy to submit a set of patches (driver + netcan support).
We’re considering defining a new Protocol Family, AF_CAN, for this purpose.
Would it be acceptable to use the first available « AF_VENDORXX » from sys/socket.h ?
I would appreciate your thoughts, advice, and any recommendations you may have on this matter.
-- Jérémie

Hello Jeremie, sounds great! :-) Would that work with simple USB-UART-CAN adapters? :-)

--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info<http://www.tomek.cedro.info/>