]> git.ipfire.org Git - thirdparty/systemd.git/commit
ethtool-util: fix setting advertising link modes
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Sep 2025 14:41:18 +0000 (23:41 +0900)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 4 Sep 2025 10:57:10 +0000 (12:57 +0200)
commitd8af104fb0eabd1f752ed80069a4cd9fd31446e0
tree3abafe3d2df57c4bfe7497f1aae7f29f801214c2
parentb10619484da4c61ca62898903fdb35ec56f9a282
ethtool-util: fix setting advertising link modes

Fixes a regression caused by d307410327d14398cb60b72db9d0034b12950a72.

The link_mode_masks flex array in struct ethtool_link_settings contains
three packed arrays, and the length of each array is given by
link_mode_masks_nwords field:
```
        __u32   link_mode_masks[];
        /* layout of link_mode_masks fields:
         * __u32 map_supported[link_mode_masks_nwords];
         * __u32 map_advertising[link_mode_masks_nwords];
         * __u32 map_lp_advertising[link_mode_masks_nwords];
         */
```
Hence, we cannot use the received data as is through the union, but need
to shift the array to make each map accessible through the union.
src/shared/ethtool-util.c