thom311 / libnl

Netlink Library Suite
GNU Lesser General Public License v2.1
419 stars 313 forks source link

Bugfixed CAN support. Added CAN FD support. #274

Closed pugo closed 2 years ago

pugo commented 3 years ago
pugo commented 3 years ago

The first part of this PR solves a bug in can_put_attrs() where the libnl-internal bit mask values CAN_HAS_* from lib/route/link/can.c were used as arguments in the Netlink calls. The expected arguments are the IFLA_CAN_* enum values from include/linux-private/linux/can/netlink.h. This bug means that only some attributes were possible to set, in those cases where the bitmask values (CAN_HAS_*) happened to be equal to the enum values (IFLA_CAN_*). This was true for just a few.

The fix to above was to change can_put_attrs() to use the correct argument values (IFLA_CAN_*).

The second part of this PR is to add support for CAN FD. This is done by adding functions analog to the CAN (non FD) counterparts. The new functions have similar names to the non FD counterparts, but with the word data added. The new functions allows configuration of data bitrate, bittiming and sample point for CAN FD.

pugo commented 2 years ago

I still suggest that this should be merged, as it solves a CAN related bug and enabled support for CAN FD.

If there is anything I can do to help and to speed up the process, please don't hesitate to tell me!

thom311 commented 2 years ago

Hi. Thanks for the patch!!

I split the patch, and merged the first part to master.

About the remaining part, how about https://gist.github.com/thom311/62ee22490e280abe6110edcbb89c4d75 ?

Also, I'll comment on the patch...

thom311 commented 2 years ago

I merged also the second part of the commit. I followed it up with additional commits. Hope that is ok.

Sorry for the long delay to process this. I think it's fine now.

Merged. Closing.

thom311 commented 2 years ago

thank you for the patch!