---
name: "cangw"
section: "1"
platform: "linux"
package: "can-utils"
version: "2023.03-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cangw"
---

# cangw(1)

manual page for cangw 2023.03-1

## NAME

cangw - manual page for cangw 2023.03-1

## SYNOPSIS

**cangw** \[*options*\]

## DESCRIPTION

cangw - manage PF\_CAN netlink gateway.

### Commands:

- **-A**

  (add a new rule)

- **-D**

  (delete a rule)

- **-F**

  (flush / delete all rules)

- **-L**

  (list all rules)

### Mandatory:

- **-s** \<src\_dev\>

  (source netdevice)

- **-d** \<dst\_dev\>

  (destination netdevice)

## OPTIONS

- **-X**

  (this is a CAN FD rule)

- **-t**

  (preserve src\_dev rx timestamp)

- **-e**

  (echo sent frames - recommended on vcanx)

- **-i**

  (allow to route to incoming interface)

- **-u** \<uid\>

  (user defined modification identifier)

- **-l** \<hops\>

  (limit the number of frame hops / routings)

- **-f** \<filter\>

  (set 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.

### \<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 consisting of \<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 an u32 value containing the CAN Identifier

- \<can\_dlc\>

  is an u8 value containing the data length code in hex (0 .. F)

- \<can\_data\>

  is always eight(!) u8 values containing the CAN frames data

\<MOD\> is a CAN FD frame modification instruction consisting of \<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 an u32 value containing the CAN FD Identifier

- \<flags\>

  is an u8 value containing CAN FD flags (CANFD\_BRS, CANFD\_ESI)

- \<len\>

  is an u8 value containing the data length in hex (0 .. 40)

- \<can\_data\>

  is always 64(!) u8 values containing the CAN FD frames data

The max. four modifications are performed in the order AND -\> OR -\> XOR -\> SET

### Supported CRC 8 profiles:

- Profile '1' (1U8)

  add one additional u8 value

- Profile '2' (16U8)

  add u8 value from table\[16\] indexed by (data\[1\] & 0xF)

- Profile '3' (SFFID\_XOR)

  add u8 value (can\_id & 0xFF) ^ (can\_id \>\> 8 & 0xFF)

## EXAMPLES

cangw -A -s can0 -d vcan3 -e -f 123:C00007FF -m SET:IL:333.4.1122334455667788
