Commit 3a33270f authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: 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

Simillar commit exists for ppsi:
8d12b26d time-wrs: clear struct hwtstamp_config before SIOCSHWTSTAMP ioctl
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 0b0fa97f
......@@ -226,6 +226,12 @@ struct wr_socket *ptpd_netif_create_socket(int sock_type, int flags,
struct ifreq ifr;
struct hwtstamp_config hwconfig;
/* 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, bind_addr->if_name, sizeof(ifr.ifr_name));
hwconfig.tx_type = HWTSTAMP_TX_ON;
......
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