summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorBruce A. Johnson <bajhn@users.noreply.github.com>2018-01-05 04:02:38 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-01-05 10:02:38 +0100
commit94d4acbe4b496c0f0c4e5e2143426751c8c5f9a9 (patch)
treef0d01e30bd518ac8c31c389b3d776e77a99b2106 /src/udev
parentc559eecaada396c66c4ea9ac80daeb630431063a (diff)
downloadsystemd-94d4acbe4b496c0f0c4e5e2143426751c8c5f9a9.tar.gz
systemd-udevd: fix speed/duplex processing with valid .link files (#7808)
Including BitsPerSecond or Duplex values in .link files did not work when set_slinksettings was called because the routine was not copying the base parameters to the structure given to ioctl. As a result, EINVAL was always reported, and no change occurred on the Ethernet device.
Diffstat (limited to 'src/udev')
-rw-r--r--src/udev/net/ethtool-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c
index 3ed8a51fd4..8921ca9290 100644
--- a/src/udev/net/ethtool-util.c
+++ b/src/udev/net/ethtool-util.c
@@ -473,15 +473,15 @@ static int set_slinksettings(int *fd, struct ifreq *ifr, const struct ethtool_li
struct {
struct ethtool_link_settings req;
__u32 link_mode_data[3 * ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
- } ecmd = {
- .req.cmd = ETHTOOL_SLINKSETTINGS,
- };
+ } ecmd = {};
unsigned int offset;
int r;
if (u->base.cmd != ETHTOOL_GLINKSETTINGS || u->base.link_mode_masks_nwords <= 0)
return -EINVAL;
+ memcpy(&ecmd.req, &u->base, sizeof(ecmd.req));
+ ecmd.req.cmd = ETHTOOL_SLINKSETTINGS;
offset = 0;
memcpy(&ecmd.link_mode_data[offset], u->link_modes.supported, 4 * ecmd.req.link_mode_masks_nwords);