Commit 8d12b26d authored by Adam Wujek's avatar Adam Wujek 💬

time-wrs: clear struct hwtstamp_config before SIOCSHWTSTAMP ioctl

This commit is required to uplift a wr-switch kernel version

Since the kernel commit
850a545bd net: validate HWTSTAMP ioctl parameters
Follows: v3.1-rc9
Precedes: v3.2-rc1
SIOCSHWTSTAMP ioctl check whether field "flags" of struct hwtstamp_config
is empty, otherwise ioctl returns -EINVAL
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 6f9508cf
......@@ -592,6 +592,12 @@ static int wrs_enable_timestamps(struct pp_instance *ppi, int fd)
if (fd < 0)
return 0; /* nothing to do */
/* Since version v3.2-rc1 (commit 850a545bd) linux kernel check whether
* field "flags" of struct hwtstamp_config is empty, otherwise ioctl
* for SIOCSHWTSTAMP returns -EINVAL */
memset(&ifr, 0, sizeof(struct ifreq));
memset(&hwconfig, 0, sizeof(struct hwtstamp_config));
strncpy(ifr.ifr_name, ppi->iface_name, sizeof(ifr.ifr_name));
hwconfig.tx_type = HWTSTAMP_TX_ON;
hwconfig.rx_filter = HWTSTAMP_FILTER_PTP_V2_L2_EVENT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment