Linux 6.19.0 support

Commit 89aec171d9d1ab168e43fcf9754b82e4c0aef9b9 (part of linux kernel
6.19.0-rc1) introduced an arbitrarily sized sockaddr struct to be used
instead of the classical one.

Closes #200
This commit is contained in:
Nicola Fontana 2026-03-08 15:39:41 +01:00
parent 3ccae1d47d
commit c42c9cf8bc
1 changed files with 4 additions and 0 deletions

View File

@ -234,7 +234,11 @@ int ec_gen_device_create_socket(
sa.sll_family = AF_PACKET;
sa.sll_protocol = htons(ETH_P_ETHERCAT);
sa.sll_ifindex = desc->ifindex;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0)
ret = kernel_bind(dev->socket, (struct sockaddr_unsized *) &sa, sizeof(sa));
#else
ret = kernel_bind(dev->socket, (struct sockaddr *) &sa, sizeof(sa));
#endif
if (ret) {
printk(KERN_ERR PFX "Failed to bind() socket to interface"
" (ret = %i).\n", ret);