Commit 8a2257e
committed
remove checking interface's name in check_rx_frame
The CAN-FD flag inference logic in check_rx_frame was gated on can_name
== "vcan0". This was added as a workaround for virtual CAN interfaces
(vcan), which do not distinguish between CAN and CAN-FD frames at the
socket level, i.e., all frames arrive as CanAnyFrame::Normal regardless of
their actual type.
However, the interface name check is unnecessary. Classic CAN frames can
never exceed 8 bytes, so the condition `res_len > 8` is already
sufficient to infer a CAN-FD frame when the feature has been negotiated.
This holds for all interface types:
- vcan: frames arrive without the FD flag, but res_len > 8 detects them
- Real CAN-FD hardware: the FD flag is already set by process_frame, so
the additional |= is redundant but harmless
- Real classic CAN hardware: frames never exceed 8 bytes, so the
condition is never triggered
Removing the name check also fixes the limitation of only supporting an
interface named exactly "vcan0", which excluded vcan1, vcan2, etc.
Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>1 parent bd317e3 commit 8a2257e
1 file changed
Lines changed: 5 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
283 | 280 | | |
284 | | - | |
285 | 281 | | |
286 | 282 | | |
287 | 283 | | |
| |||
0 commit comments