CANGW(1)
โจ NAME โจ
hiii bestie, meet cangw ๐ โ she's the manual page for cangw 2023.03-1build1, living her best life in the CANGW(1) section of the User Commands chapter. her whole thing? managing the PF_CAN netlink gateway. that's it, that's the girl. ๐ฆ
๐ธ SYNOPSIS ๐ธ
cangw [options]
๐ DESCRIPTION ๐
okay so cangw โ she manages the PF_CAN netlink gateway. iconic behaviour, no notes. ๐
๐ Commands ๐
these are the four things she Actually Does. pick one, bestie:
-Aโ add a new rule โจ-Dโ delete a rule ๐-Fโ flush / delete all rules ๐-Lโ list all rules ๐
๐ซถ Mandatory ๐ซถ
these are not optional, like fr fr, you literally cannot skip these:
-s <src_dev>โ the source netdevice ๐-d <dst_dev>โ the destination netdevice ๐ฆ
๐ OPTIONS ๐
-Xโ this is a CAN FD rule ๐โจ-tโ preserve thesrc_devrx timestamp โฐ-eโ echo sent frames โ lowkey recommended onvcanx๐ฃ๏ธ-iโ allow it to route to the incoming interface ๐-u <uid>โ a user defined modification identifier ๐ท๏ธ-l <hops>โ limit the number of frame hops / routings ๐-f <filter>โ set the CAN filter ๐-m <mod>โ set Classical CAN frame modifications ๐ ๏ธ-M <MOD>โ set CAN FD frame modifications ๐๐ง-x <from_idx>:<to_idx>:<result_idx>:<init_xor_val>โ XOR checksum โ-c <from>:<to>:<result>:<init_val>:<xor_val>:<crctab[256]>โ CRC8 cs ๐งฎ-p <profile>:[<profile_data>]โ CRC8 checksum profile & parameters ๐
values are given and expected in hexadecimal values. leading 0s can be omitted, she doesn't care. ๐
๐ <filter> is a <value><mask> CAN identifier filter:
<can_id>:<can_mask>โ matches when<received_can_id> & mask == can_id & maskโ<can_id>~<can_mask>โ matches when<received_can_id> & mask != can_id & maskโ
๐ ๏ธ <mod> is a Classical CAN frame modification instruction, and it's built like this:
<instruction>:<can_frame-elements>:<can_id>.<can_dlc>.<can_data>
<instruction>โ is one of'AND''OR''XOR''SET'<can_frame-elements>โ is _one_ or _more_ of'I'dentifier'L'ength'D'ata<can_id>โ is anu32value containing the CAN Identifier<can_dlc>โ is anu8value containing the data length code in hex (0 .. F)<can_data>โ is always eight(!)u8values containing the CAN frames data ๐
๐ <MOD> is a CAN FD frame modification instruction, and she's built like this:
<instruction>:<canfd_frame-elements>:<can_id>.<flags>.<len>.<can_data>
<instruction>โ is one of'AND''OR''XOR''SET'<canfd_frame-elements>โ is _one_ or _more_ of'I'd'F'lags'L'ength'D'ata<can_id>โ is anu32value containing the CAN FD Identifier<flags>โ is anu8value containing CAN FD flags (CANFD_BRS,CANFD_ESI)<len>โ is anu8value containing the data length in hex (0 .. 40)<can_data>โ is always 64(!)u8values containing the CAN FD frames data ๐คฏ
the max. four modifications are performed in the order AND -> OR -> XOR -> SET. that's the pipeline bestie, don't fight it. ๐ฅ
๐ง Supported CRC 8 profiles:
- Profile
'1'(1U8) โ add one additionalu8value โจ - Profile
'2'(16U8) โ addu8value fromtable[16]indexed by(data[1] & 0xF)๐ธ - Profile
'3'(SFFID_XOR) โ addu8value(can_id & 0xFF) ^ (can_id >> 8 & 0xFF)๐
๐ฅ EXAMPLES ๐ฅ
the moment you've all been waiting for, the demonstration, the main character moment:
cangw -A -s can0 -d vcan3 -e -f 123:C00007FF -m SET:IL:333.4.1122334455667788
and that's the whole page bestie!! ๐ซถ this was cangw 2023.03-1build1, brought to you in December 2025, straight out of the CANGW(1) manual. go route some frames, you absolute icon. ๐
โจ๐๐ฆ
๐ฆ where this page comes from
- ubuntu resolute: can-utils 2023.03-1build1 ยท GPL-2.0-only
- ubuntu stonking: can-utils 2023.03-1build1 ยท GPL-2.0-only
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms