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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <28af9e38bf7be76d72fcea8ecf277369781b2bab.1607966001.git.gnault@redhat.com>
Date:   Mon, 14 Dec 2020 18:14:22 +0100
From:   Guillaume Nault <gnault@...hat.com>
To:     Stephen Hemminger <stephen@...workplumber.org>
Cc:     netdev@...r.kernel.org
Subject: [PATCH iproute2] testsuite: Add mpls packet matching tests for tc
 flower

Match all MPLS fields using smallest and highest possible values.
Test the two ways of specifying MPLS header matching:

  * with the basic mpls_{label,tc,bos,ttl} keywords (match only on the
    first LSE),

  * with the more generic "lse" keyword (allows matching at different
    depth of the MPLS label stack).

This test file allows to find problems like the one fixed by
Linux commit 7fdd375e3830 ("net: sched: Fix dump of MPLS_OPT_LSE_LABEL
attribute in cls_flower").

Signed-off-by: Guillaume Nault <gnault@...hat.com>
---
 testsuite/tests/tc/flower_mpls.t | 82 ++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100755 testsuite/tests/tc/flower_mpls.t

diff --git a/testsuite/tests/tc/flower_mpls.t b/testsuite/tests/tc/flower_mpls.t
new file mode 100755
index 00000000..430ed13e
--- /dev/null
+++ b/testsuite/tests/tc/flower_mpls.t
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+. lib/generic.sh
+
+DEV="$(rand_dev)"
+ts_ip "$0" "Add $DEV dummy interface" link add dev $DEV up type dummy
+ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV ingress
+
+reset_qdisc()
+{
+	ts_tc "$0" "Remove ingress qdisc" qdisc del dev $DEV ingress
+	ts_tc "$0" "Add ingress qdisc" qdisc add dev $DEV ingress
+}
+
+ts_tc "$0" "Add MPLS filter matching first LSE with minimal values" \
+	filter add dev $DEV ingress protocol mpls_uc flower         \
+	mpls_label 0 mpls_tc 0 mpls_bos 0 mpls_ttl 0                \
+	action drop
+ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress
+test_on "mpls_label 0"
+test_on "mpls_tc 0"
+test_on "mpls_bos 0"
+test_on "mpls_ttl 0"
+
+reset_qdisc
+ts_tc "$0" "Add MPLS filter matching first LSE with maximal values" \
+	filter add dev $DEV ingress protocol mpls_uc flower         \
+	mpls_label 1048575 mpls_tc 7 mpls_bos 1 mpls_ttl 255        \
+	action drop
+ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress
+test_on "mpls_label 1048575"
+test_on "mpls_tc 7"
+test_on "mpls_bos 1"
+test_on "mpls_ttl 255"
+
+reset_qdisc
+ts_tc "$0" "Add MPLS filter matching second LSE with minimal values" \
+	filter add dev $DEV ingress protocol mpls_uc flower          \
+	mpls lse depth 2 label 0 tc 0 bos 0 ttl 0                    \
+	action drop
+ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress
+test_on "mpls"
+test_on "lse"
+test_on "depth 2"
+test_on "label 0"
+test_on "tc 0"
+test_on "bos 0"
+test_on "ttl 0"
+
+reset_qdisc
+ts_tc "$0" "Add MPLS filter matching second LSE with maximal values" \
+	filter add dev $DEV ingress protocol mpls_uc flower          \
+	mpls lse depth 2 label 1048575 tc 7 bos 1 ttl 255            \
+	action drop
+ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress
+test_on "mpls"
+test_on "lse"
+test_on "depth 2"
+test_on "label 1048575"
+test_on "tc 7"
+test_on "bos 1"
+test_on "ttl 255"
+
+reset_qdisc
+ts_tc "$0" "Add MPLS filter matching two LSEs"                   \
+	filter add dev $DEV ingress protocol mpls_uc flower mpls \
+	lse depth 1 label 0 tc 0 bos 0 ttl 0                     \
+	lse depth 2 label 1048575 tc 7 bos 1 ttl 255             \
+	action drop
+ts_tc "$0" "Show ingress filters" filter show dev $DEV ingress
+test_on "mpls"
+test_on "lse"
+test_on "depth 1"
+test_on "label 0"
+test_on "tc 0"
+test_on "bos 0"
+test_on "ttl 0"
+test_on "depth 2"
+test_on "label 1048575"
+test_on "tc 7"
+test_on "bos 1"
+test_on "ttl 255"
-- 
2.21.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ