networking/libiproute/iplink.c: fix support for older kernels

- The CAN netlink interface has been added in Linux v2.6.31 with only 3 options [1]:

  CAN_CTRLMODE_LOOPBACK    0x1  /* Loopback mode */
  CAN_CTRLMODE_LISTENONLY  0x2  /* Listen-only mode */
  CAN_CTRLMODE_3_SAMPLES   0x4  /* Triple sampling mode */

  So define the other options.

- IFLA_CAN_TERMINATION has been added in Linux 4.11 [2],
  define it for older kernels.

[1] https://github.com/torvalds/linux/blob/v2.6.31/include/linux/can/netlink.h#L80-L82
[2] 12a6075cab

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Thomas Devoogdt 2024-10-04 15:32:55 +02:00 committed by Denys Vlasenko
parent bf57f732a5
commit 8953429a82

View File

@ -51,6 +51,27 @@ struct ifla_vlan_flags {
};
#endif
#if ENABLE_FEATURE_IP_LINK_CAN
# ifndef CAN_CTRLMODE_ONE_SHOT
# define CAN_CTRLMODE_ONE_SHOT 0x08 /* One-Shot mode */
# endif
# ifndef CAN_CTRLMODE_BERR_REPORTING
# define CAN_CTRLMODE_BERR_REPORTING 0x10 /* Bus-error reporting */
# endif
# ifndef CAN_CTRLMODE_FD
# define CAN_CTRLMODE_FD 0x20 /* CAN FD mode */
# endif
# ifndef CAN_CTRLMODE_PRESUME_ACK
# define CAN_CTRLMODE_PRESUME_ACK 0x40 /* Ignore missing CAN ACKs */
# endif
# ifndef CAN_CTRLMODE_FD_NON_ISO
# define CAN_CTRLMODE_FD_NON_ISO 0x80 /* CAN FD in non-ISO mode */
# endif
# ifndef IFLA_CAN_TERMINATION
# define IFLA_CAN_TERMINATION 11
# endif
#endif
/* taken from linux/sockios.h */
#define SIOCSIFNAME 0x8923 /* set interface name */