__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# This test is for checking the FIB offload API on top of mlxsw.

lib_dir=$(dirname $0)/../../../net/forwarding

ALL_TESTS="
	ipv4_identical_routes
	ipv4_tos
	ipv4_metric
	ipv4_replace
	ipv4_delete
	ipv4_plen
	ipv4_replay
	ipv4_flush
	ipv4_local_replace
	ipv6_add
	ipv6_metric
	ipv6_append_single
	ipv6_replace_single
	ipv6_metric_multipath
	ipv6_append_multipath
	ipv6_replace_multipath
	ipv6_append_multipath_to_single
	ipv6_delete_single
	ipv6_delete_multipath
	ipv6_replay_single
	ipv6_replay_multipath
	ipv6_local_replace
"
NUM_NETIFS=0
source $lib_dir/lib.sh
source $lib_dir/devlink_lib.sh
source $lib_dir/fib_offload_lib.sh

ipv4_identical_routes()
{
	fib_ipv4_identical_routes_test "testns1"
}

ipv4_tos()
{
	fib_ipv4_tos_test "testns1"
}

ipv4_metric()
{
	fib_ipv4_metric_test "testns1"
}

ipv4_replace()
{
	fib_ipv4_replace_test "testns1"
}

ipv4_delete()
{
	fib_ipv4_delete_test "testns1"
}

ipv4_plen()
{
	fib_ipv4_plen_test "testns1"
}

ipv4_replay_metric()
{
	fib_ipv4_replay_metric_test "testns1" "$DEVLINK_DEV"
}

ipv4_replay_tos()
{
	fib_ipv4_replay_tos_test "testns1" "$DEVLINK_DEV"
}

ipv4_replay_plen()
{
	fib_ipv4_replay_plen_test "testns1" "$DEVLINK_DEV"
}

ipv4_replay()
{
	ipv4_replay_metric
	ipv4_replay_tos
	ipv4_replay_plen
}

ipv4_flush()
{
	fib_ipv4_flush_test "testns1"
}

ipv4_local_replace()
{
	local ns="testns1"

	RET=0

	ip -n $ns link add name dummy1 type dummy
	ip -n $ns link set dev dummy1 up

	ip -n $ns route add table local 192.0.2.1/32 dev dummy1
	fib4_trap_check $ns "table local 192.0.2.1/32 dev dummy1" false
	check_err $? "Local table route not in hardware when should"

	ip -n $ns route add table main 192.0.2.1/32 dev dummy1
	fib4_trap_check $ns "table main 192.0.2.1/32 dev dummy1" true
	check_err $? "Main table route in hardware when should not"

	fib4_trap_check $ns "table local 192.0.2.1/32 dev dummy1" false
	check_err $? "Local table route was replaced when should not"

	# Test that local routes can replace routes in main table.
	ip -n $ns route add table main 192.0.2.2/32 dev dummy1
	fib4_trap_check $ns "table main 192.0.2.2/32 dev dummy1" false
	check_err $? "Main table route not in hardware when should"

	ip -n $ns route add table local 192.0.2.2/32 dev dummy1
	fib4_trap_check $ns "table local 192.0.2.2/32 dev dummy1" false
	check_err $? "Local table route did not replace route in main table when should"

	fib4_trap_check $ns "table main 192.0.2.2/32 dev dummy1" true
	check_err $? "Main table route was not replaced when should"

	log_test "IPv4 local table route replacement"

	ip -n $ns link del dev dummy1
}

ipv6_add()
{
	fib_ipv6_add_test "testns1"
}

ipv6_metric()
{
	fib_ipv6_metric_test "testns1"
}

ipv6_append_single()
{
	fib_ipv6_append_single_test "testns1"
}

ipv6_replace_single()
{
	fib_ipv6_replace_single_test "testns1"
}

ipv6_metric_multipath()
{
	fib_ipv6_metric_multipath_test "testns1"
}

ipv6_append_multipath()
{
	fib_ipv6_append_multipath_test "testns1"
}

ipv6_replace_multipath()
{
	fib_ipv6_replace_multipath_test "testns1"
}

ipv6_append_multipath_to_single()
{
	fib_ipv6_append_multipath_to_single_test "testns1"
}

ipv6_delete_single()
{
	fib_ipv6_delete_single_test "testns1"
}

ipv6_delete_multipath()
{
	fib_ipv6_delete_multipath_test "testns1"
}

ipv6_replay_single()
{
	fib_ipv6_replay_single_test "testns1" "$DEVLINK_DEV"
}

ipv6_replay_multipath()
{
	fib_ipv6_replay_multipath_test "testns1" "$DEVLINK_DEV"
}

ipv6_local_replace()
{
	local ns="testns1"

	RET=0

	ip -n $ns link add name dummy1 type dummy
	ip -n $ns link set dev dummy1 up

	ip -n $ns route add table local 2001:db8:1::1/128 dev dummy1
	fib6_trap_check $ns "table local 2001:db8:1::1/128 dev dummy1" false
	check_err $? "Local table route not in hardware when should"

	ip -n $ns route add table main 2001:db8:1::1/128 dev dummy1
	fib6_trap_check $ns "table main 2001:db8:1::1/128 dev dummy1" true
	check_err $? "Main table route in hardware when should not"

	fib6_trap_check $ns "table local 2001:db8:1::1/128 dev dummy1" false
	check_err $? "Local table route was replaced when should not"

	# Test that local routes can replace routes in main table.
	ip -n $ns route add table main 2001:db8:1::2/128 dev dummy1
	fib6_trap_check $ns "table main 2001:db8:1::2/128 dev dummy1" false
	check_err $? "Main table route not in hardware when should"

	ip -n $ns route add table local 2001:db8:1::2/128 dev dummy1
	fib6_trap_check $ns "table local 2001:db8:1::2/128 dev dummy1" false
	check_err $? "Local route route did not replace route in main table when should"

	fib6_trap_check $ns "table main 2001:db8:1::2/128 dev dummy1" true
	check_err $? "Main table route was not replaced when should"

	log_test "IPv6 local table route replacement"

	ip -n $ns link del dev dummy1
}

fib_notify_on_flag_change_set()
{
	local notify=$1; shift

	ip netns exec testns1 sysctl -qw net.ipv4.fib_notify_on_flag_change=$notify
	ip netns exec testns1 sysctl -qw net.ipv6.fib_notify_on_flag_change=$notify

	log_info "Set fib_notify_on_flag_change to $notify"
}

setup_prepare()
{
	ip netns add testns1
	if [ $? -ne 0 ]; then
		echo "Failed to add netns \"testns1\""
		exit 1
	fi

	devlink dev reload $DEVLINK_DEV netns testns1
	if [ $? -ne 0 ]; then
		echo "Failed to reload into netns \"testns1\""
		exit 1
	fi
}

cleanup()
{
	pre_cleanup
	devlink -N testns1 dev reload $DEVLINK_DEV netns $$
	ip netns del testns1
}

trap cleanup EXIT

setup_prepare

fib_notify_on_flag_change_set 1
tests_run

fib_notify_on_flag_change_set 0
tests_run

exit $EXIT_STATUS

Filemanager

Name Type Size Permission Actions
spectrum Folder 0755
spectrum-2 Folder 0755
blackhole_routes.sh File 4.96 KB 0755
devlink_linecard.sh File 7.5 KB 0755
devlink_trap.sh File 1.86 KB 0755
devlink_trap_acl_drops.sh File 2.4 KB 0755
devlink_trap_control.sh File 18.22 KB 0755
devlink_trap_l2_drops.sh File 12.87 KB 0755
devlink_trap_l3_drops.sh File 16.38 KB 0755
devlink_trap_l3_exceptions.sh File 13.64 KB 0755
devlink_trap_policer.sh File 9.75 KB 0755
devlink_trap_tunnel_ipip.sh File 5.24 KB 0755
devlink_trap_tunnel_ipip6.sh File 5.31 KB 0755
devlink_trap_tunnel_vxlan.sh File 8.84 KB 0755
devlink_trap_tunnel_vxlan_ipv6.sh File 9.32 KB 0755
egress_vid_classification.sh File 6.55 KB 0755
ethtool_lanes.sh File 4.02 KB 0755
extack.sh File 3.74 KB 0755
fib.sh File 5.43 KB 0755
fib_offload.sh File 9.93 KB 0755
hw_stats_l3.sh File 410 B 0755
ingress_rif_conf_1d.sh File 6.15 KB 0755
ingress_rif_conf_1q.sh File 6.23 KB 0755
ingress_rif_conf_vxlan.sh File 8.44 KB 0755
mirror_gre.sh File 3.78 KB 0755
mirror_gre_scale.sh File 5.43 KB 0644
mlxsw_lib.sh File 1.43 KB 0644
one_armed_router.sh File 6.82 KB 0755
pci_reset.sh File 1.27 KB 0755
port_range_occ.sh File 2.33 KB 0755
port_range_scale.sh File 1.51 KB 0644
port_scale.sh File 1.36 KB 0644
q_in_q_veto.sh File 8.06 KB 0755
qos_defprio.sh File 2.33 KB 0755
qos_dscp_bridge.sh File 4.14 KB 0755
qos_dscp_router.sh File 6.43 KB 0755
qos_ets_strict.sh File 9.09 KB 0755
qos_headroom.sh File 8.19 KB 0755
qos_lib.sh File 1.27 KB 0644
qos_max_descriptors.sh File 6.14 KB 0755
qos_mc_aware.sh File 9.54 KB 0755
qos_pfc.sh File 11.36 KB 0755
rif_bridge.sh File 4.12 KB 0755
rif_counter_scale.sh File 1.71 KB 0644
rif_lag.sh File 2.98 KB 0755
rif_lag_vlan.sh File 3.24 KB 0755
rif_mac_profile_scale.sh File 1.64 KB 0644
rif_mac_profiles.sh File 4.65 KB 0755
rif_mac_profiles_occ.sh File 2.87 KB 0755
router_bridge_lag.sh File 786 B 0755
router_scale.sh File 2.09 KB 0644
rtnetlink.sh File 26.93 KB 0755
sch_ets.sh File 2.3 KB 0755
sch_offload.sh File 5.25 KB 0755
sch_red_core.sh File 20.75 KB 0644
sch_red_ets.sh File 3.12 KB 0755
sch_red_prio.sh File 81 B 0755
sch_red_root.sh File 1.25 KB 0755
sch_tbf_ets.sh File 216 B 0755
sch_tbf_prio.sh File 217 B 0755
sch_tbf_root.sh File 217 B 0755
sharedbuffer.sh File 5.24 KB 0755
tc_action_hw_stats.sh File 2.24 KB 0755
tc_flower_scale.sh File 2.81 KB 0644
tc_police_occ.sh File 2.07 KB 0755
tc_police_scale.sh File 1.62 KB 0644
tc_restrictions.sh File 11.58 KB 0755
tc_sample.sh File 17.38 KB 0755
vxlan.sh File 30.19 KB 0755
vxlan_fdb_veto.sh File 3.11 KB 0755
vxlan_fdb_veto_ipv6.sh File 250 B 0755
vxlan_flooding.sh File 8.64 KB 0755
vxlan_ipv6.sh File 1.39 KB 0755
Filemanager