lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 14 May 2020 12:28:07 +0200
From:   Olivier Dautricourt <olivier.dautricourt@...lia.com>
To:     Giuseppe Cavallaro <peppe.cavallaro@...com>,
        Alexandre Torgue <alexandre.torgue@...com>,
        Jose Abreu <joabreu@...opsys.com>,
        "David S . Miller" <davem@...emloft.net>
Cc:     Richard Cochran <richardcochran@...il.com>, netdev@...r.kernel.org,
        Olivier Dautricourt <olivier.dautricourt@...lia.com>
Subject: [PATCH 2/3] net: uapi: Add HWTSTAMP_FLAGS_ADJ_FINE/ADJ_COARSE

This commit allows a user to specify a flag value for configuring
timestamping through hwtsamp_config structure.

New flags introduced:

HWTSTAMP_FLAGS_NONE = 0
	No flag specified: as it is of value 0, this will selects the
	default behavior for all the existing drivers and should not
	break existing userland programs.

HWTSTAMP_FLAGS_ADJ_FINE = 1
	Use the fine adjustment mode.
	Fine adjustment mode is usually used for precise frequency adjustments.

HWTSTAMP_FLAGS_ADJ_COARSE = 2
	Use the coarse adjustment mode
	Coarse adjustment mode is usually used for direct phase correction.

Signed-off-by: Olivier Dautricourt <olivier.dautricourt@...lia.com>
---
 include/uapi/linux/net_tstamp.h | 12 ++++++++++++
 net/core/dev_ioctl.c            |  3 ---
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/net_tstamp.h b/include/uapi/linux/net_tstamp.h
index 7ed0b3d1c00a..0cfcd490228f 100644
--- a/include/uapi/linux/net_tstamp.h
+++ b/include/uapi/linux/net_tstamp.h
@@ -65,6 +65,18 @@ struct hwtstamp_config {
 	int rx_filter;
 };
 
+/* possible values for hwtstamp_config->flags */
+enum hwtsamp_flags {
+	/* No special flag specified */
+	HWTSTAMP_FLAGS_NONE,
+
+	/* Enable fine adjustment mode if the driver supports it */
+	HWTSTAMP_FLAGS_ADJ_FINE,
+
+	/* Enable coarse adjustment mode if the driver supports it */
+	HWTSTAMP_FLAGS_ADJ_COARSE,
+};
+
 /* possible values for hwtstamp_config->tx_type */
 enum hwtstamp_tx_types {
 	/*
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 547b587c1950..017671545d45 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -177,9 +177,6 @@ static int net_hwtstamp_validate(struct ifreq *ifr)
 	if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)))
 		return -EFAULT;
 
-	if (cfg.flags) /* reserved for future extensions */
-		return -EINVAL;
-
 	tx_type = cfg.tx_type;
 	rx_filter = cfg.rx_filter;
 
-- 
2.17.1

Powered by blists - more mailing lists