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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 21 Jan 2021 13:29:54 +0200
From:   Oleksandr Mazur <oleksandr.mazur@...ision.eu>
To:     netdev@...r.kernel.org
Cc:     jiri@...dia.com, davem@...emloft.net, linux-kernel@...r.kernel.org,
        kuba@...nel.org, Oleksandr Mazur <oleksandr.mazur@...ision.eu>
Subject: [PATCH iproute2-next] devlink: add support for HARD_DROP trap action

Add support for new HARD_DROP action, which is used for
trap hard drop statistics retrival. It's used whenever
device is unable to report trapped packet to the devlink
subsystem, and thus device could only state how many
packets have been dropped, without passing a packet
to the devlink subsystem to get track of traffic statistics.

Signed-off-by: Oleksandr Mazur <oleksandr.mazur@...ision.eu>
---
 devlink/devlink.c            | 4 ++++
 include/uapi/linux/devlink.h | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index a2e06644..77185f7c 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1335,6 +1335,8 @@ static int trap_action_get(const char *actionstr,
 {
 	if (strcmp(actionstr, "drop") == 0) {
 		*p_action = DEVLINK_TRAP_ACTION_DROP;
+	} else if (strcmp(actionstr, "hard_drop") == 0) {
+		*p_action = DEVLINK_TRAP_ACTION_HARD_DROP;
 	} else if (strcmp(actionstr, "trap") == 0) {
 		*p_action = DEVLINK_TRAP_ACTION_TRAP;
 	} else if (strcmp(actionstr, "mirror") == 0) {
@@ -7726,6 +7728,8 @@ static const char *trap_action_name(uint8_t action)
 	switch (action) {
 	case DEVLINK_TRAP_ACTION_DROP:
 		return "drop";
+	case DEVLINK_TRAP_ACTION_HARD_DROP:
+		return "hard_drop";
 	case DEVLINK_TRAP_ACTION_TRAP:
 		return "trap";
 	case DEVLINK_TRAP_ACTION_MIRROR:
diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
index 1414acee..ecee2541 100644
--- a/include/uapi/linux/devlink.h
+++ b/include/uapi/linux/devlink.h
@@ -261,12 +261,16 @@ enum {
  * enum devlink_trap_action - Packet trap action.
  * @DEVLINK_TRAP_ACTION_DROP: Packet is dropped by the device and a copy is not
  *                            sent to the CPU.
+ * @DEVLINK_TRAP_ACTION_HARD_DROP: Packet was dropped by the underlying device,
+ *                                 and device cannot report packet to devlink
+ *                                 (or inject it into the kernel RX path).
  * @DEVLINK_TRAP_ACTION_TRAP: The sole copy of the packet is sent to the CPU.
  * @DEVLINK_TRAP_ACTION_MIRROR: Packet is forwarded by the device and a copy is
  *                              sent to the CPU.
  */
 enum devlink_trap_action {
 	DEVLINK_TRAP_ACTION_DROP,
+	DEVLINK_TRAP_ACTION_HARD_DROP,
 	DEVLINK_TRAP_ACTION_TRAP,
 	DEVLINK_TRAP_ACTION_MIRROR,
 };
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ