devlink: Add non-routable packet trap
authorAmit Cohen <amitc@mellanox.com>
Sun, 19 Jan 2020 13:00:48 +0000 (15:00 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Jan 2020 15:23:52 +0000 (16:23 +0100)
Add packet trap that can report packets that reached the router, but are
non-routable. For example, IGMP queries can be flooded by the device in
layer 2 and reach the router. Such packets should not be routed and
instead dropped.

Signed-off-by: Amit Cohen <amitc@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/devlink/devlink-trap.rst
include/net/devlink.h
net/core/devlink.c

index 68245ea387ada73d634a1d36482c1ac546943c83..a62e1d6eb3e43242e08f3859be4a915fafeb6070 100644 (file)
@@ -223,6 +223,12 @@ be added to the following table:
    * - ``ipv6_lpm_miss``
      - ``exception``
      - Traps unicast IPv6 packets that did not match any route
+   * - ``non_routable_packet``
+     - ``drop``
+     - Traps packets that the device decided to drop because they are not
+       supposed to be routed. For example, IGMP queries can be flooded by the
+       device in layer 2 and reach the router. Such packets should not be
+       routed and instead dropped
 
 Driver-specific Packet Traps
 ============================
index a6856f1d5d1fcbaad6aaea3e784e590260550f83..08b757753e1c7a36e4b63c12c249be0d45bd6f39 100644 (file)
@@ -591,6 +591,7 @@ enum devlink_trap_generic_id {
        DEVLINK_TRAP_GENERIC_ID_REJECT_ROUTE,
        DEVLINK_TRAP_GENERIC_ID_IPV4_LPM_UNICAST_MISS,
        DEVLINK_TRAP_GENERIC_ID_IPV6_LPM_UNICAST_MISS,
+       DEVLINK_TRAP_GENERIC_ID_NON_ROUTABLE,
 
        /* Add new generic trap IDs above */
        __DEVLINK_TRAP_GENERIC_ID_MAX,
@@ -659,6 +660,8 @@ enum devlink_trap_group_generic_id {
        "ipv4_lpm_miss"
 #define DEVLINK_TRAP_GENERIC_NAME_IPV6_LPM_UNICAST_MISS \
        "ipv6_lpm_miss"
+#define DEVLINK_TRAP_GENERIC_NAME_NON_ROUTABLE \
+       "non_routable_packet"
 
 #define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS \
        "l2_drops"
index d30aa47052aaf7eb56d33f8825b8a30cd32695b1..c10e38d724bc310c2a5af8848c95f01a03030f01 100644 (file)
@@ -7706,6 +7706,7 @@ static const struct devlink_trap devlink_trap_generic[] = {
        DEVLINK_TRAP(REJECT_ROUTE, EXCEPTION),
        DEVLINK_TRAP(IPV4_LPM_UNICAST_MISS, EXCEPTION),
        DEVLINK_TRAP(IPV6_LPM_UNICAST_MISS, EXCEPTION),
+       DEVLINK_TRAP(NON_ROUTABLE, DROP),
 };
 
 #define DEVLINK_TRAP_GROUP(_id)                                                      \