Commit 8bb0ebd5 authored by Amit Cohen's avatar Amit Cohen Committed by David S. Miller

selftests: mlxsw: devlink_trap_tunnel_ipip: Remove code duplication

As part of adding same test for GRE tunnel with IPv6 underlay, an
optional improvement was found - call ipip_payload_get from
ecn_payload_get, so do not duplicate the code which creates the payload.
Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c473f723
......@@ -116,12 +116,16 @@ cleanup()
forwarding_restore
}
ecn_payload_get()
ipip_payload_get()
{
local flags=$1; shift
local key=$1; shift
p=$(:
)"0"$( : GRE flags
)"$flags"$( : GRE flags
)"0:00:"$( : Reserved + version
)"08:00:"$( : ETH protocol type
)"$key"$( : Key
)"4"$( : IP version
)"5:"$( : IHL
)"00:"$( : IP TOS
......@@ -137,6 +141,11 @@ ecn_payload_get()
echo $p
}
ecn_payload_get()
{
echo $(ipip_payload_get "0")
}
ecn_decap_test()
{
local trap_name="decap_error"
......@@ -171,31 +180,6 @@ ecn_decap_test()
tc filter del dev $swp1 egress protocol ip pref 1 handle 101 flower
}
ipip_payload_get()
{
local flags=$1; shift
local key=$1; shift
p=$(:
)"$flags"$( : GRE flags
)"0:00:"$( : Reserved + version
)"08:00:"$( : ETH protocol type
)"$key"$( : Key
)"4"$( : IP version
)"5:"$( : IHL
)"00:"$( : IP TOS
)"00:14:"$( : IP total length
)"00:00:"$( : IP identification
)"20:00:"$( : IP flags + frag off
)"30:"$( : IP TTL
)"01:"$( : IP proto
)"E7:E6:"$( : IP header csum
)"C0:00:01:01:"$( : IP saddr : 192.0.1.1
)"C0:00:02:01:"$( : IP daddr : 192.0.2.1
)
echo $p
}
no_matching_tunnel_test()
{
local trap_name="decap_error"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment