[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191216064344.1470824-7-bpoirier@cumulusnetworks.com>
Date: Mon, 16 Dec 2019 15:43:42 +0900
From: Benjamin Poirier <bpoirier@...ulusnetworks.com>
To: netdev@...r.kernel.org
Cc: Roopa Prabhu <roopa@...ulusnetworks.com>
Subject: [PATCH iproute2 6/8] bridge: Fix vni printing
Since commit c7c1a1ef51ae ("bridge: colorize output and use JSON print
library"), print_range() is used for vid (16bits) and vni. However, the
latter are 32bits so they get truncated. They got truncated even before
that commit though.
Fixes: 8652eeb3ab12 ("bridge: vlan: support for per vlan tunnel info")
Signed-off-by: Benjamin Poirier <bpoirier@...ulusnetworks.com>
---
bridge/vlan.c | 6 +++---
testsuite/Makefile | 3 ++-
testsuite/lib/generic.sh | 6 +++++-
testsuite/tests/bridge/vlan/tunnelshow.t | 24 ++++++++++++++++++++++++
4 files changed, 34 insertions(+), 5 deletions(-)
create mode 100755 testsuite/tests/bridge/vlan/tunnelshow.t
diff --git a/bridge/vlan.c b/bridge/vlan.c
index c0294aa6..428eeee3 100644
--- a/bridge/vlan.c
+++ b/bridge/vlan.c
@@ -266,15 +266,15 @@ static void close_vlan_port(void)
close_json_object();
}
-static void print_range(const char *name, __u16 start, __u16 id)
+static void print_range(const char *name, __u32 start, __u32 id)
{
char end[64];
snprintf(end, sizeof(end), "%sEnd", name);
- print_hu(PRINT_ANY, name, "\t %hu", start);
+ print_uint(PRINT_ANY, name, "\t %u", start);
if (start != id)
- print_hu(PRINT_ANY, end, "-%hu", id);
+ print_uint(PRINT_ANY, end, "-%u", id);
}
diff --git a/testsuite/Makefile b/testsuite/Makefile
index 4451f316..fb50f618 100644
--- a/testsuite/Makefile
+++ b/testsuite/Makefile
@@ -82,7 +82,8 @@ endif
TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX`; \
. $(KENVFN); \
STD_ERR="$$TMP_ERR" STD_OUT="$$TMP_OUT" \
- TC="$$i/tc/tc" IP="$$i/ip/ip" SS=$$i/misc/ss DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
+ TC="$$i/tc/tc" IP="$$i/ip/ip" SS=$$i/misc/ss BRIDGE="$$i/bridge/bridge" \
+ DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
ERRF="$(RESULTS_DIR)/$@...o.err" $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@...o.out; \
if [ "$$?" = "127" ]; then \
printf "\033[1;35mSKIPPED\033[0m\n"; \
diff --git a/testsuite/lib/generic.sh b/testsuite/lib/generic.sh
index e909008a..8b339ec1 100644
--- a/testsuite/lib/generic.sh
+++ b/testsuite/lib/generic.sh
@@ -1,4 +1,3 @@
-
export DEST="127.0.0.1"
ts_log()
@@ -66,6 +65,11 @@ ts_ss()
__ts_cmd "$SS" "$@"
}
+ts_bridge()
+{
+ __ts_cmd "$BRIDGE" "$@"
+}
+
ts_qdisc_available()
{
HELPOUT=`$TC qdisc add $1 help 2>&1`
diff --git a/testsuite/tests/bridge/vlan/tunnelshow.t b/testsuite/tests/bridge/vlan/tunnelshow.t
new file mode 100755
index 00000000..1583abb9
--- /dev/null
+++ b/testsuite/tests/bridge/vlan/tunnelshow.t
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+. lib/generic.sh
+
+ts_log "[Testing tunnelshow]"
+
+BR_DEV="$(rand_dev)"
+VX_DEV="$(rand_dev)"
+
+ts_ip "$0" "Add $BR_DEV bridge interface" link add $BR_DEV type bridge
+
+ts_ip "$0" "Add $VX_DEV vxlan interface" \
+ link add $VX_DEV type vxlan dstport 4789 external
+ts_ip "$0" "Enslave $VX_DEV under $BR_DEV" \
+ link set dev $VX_DEV master $BR_DEV
+ts_ip "$0" "Set vlan_tunnel on $VX_DEV" \
+ link set dev $VX_DEV type bridge_slave vlan_tunnel on
+
+ts_bridge "$0" "Add single vlan" vlan add dev $VX_DEV vid 1030
+ts_bridge "$0" "Add tunnel with vni > 16k" \
+ vlan add dev $VX_DEV vid 1030 tunnel_info id 65556
+
+ts_bridge "$0" "Show tunnel info" vlan tunnelshow dev $VX_DEV
+test_on "1030\s+65556"
--
2.24.0
Powered by blists - more mailing lists