2 # SPDX-License-Identifier: GPL-2.0
4 # +-----------------------+
9 # +-----------------|-----+
11 # | (Plain Ethernet traffic)
13 # +-----------------|-----------------------------------------+
16 # | -encapsulate Ethernet into MPLS |
17 # | -add outer Ethernet header |
18 # | -redirect to $mpls1 (egress) |
22 # | | -remove outer Ethernet header |
23 # | | -remove MPLS header |
24 # | | -redirect to $edge1 (egress) |
25 # +-----------------|-----------------------------------------+
27 # | (Ethernet over MPLS traffic)
29 # +-----------------|-----------------------------------------+
32 # | -remove outer Ethernet header |
33 # | -remove MPLS header |
34 # | -redirect to $edge2 (egress) |
38 # | | -encapsulate Ethernet into MPLS |
39 # | | -add outer Ethernet header |
40 # | | -redirect to $mpls2 (egress) |
41 # +-----------------|-----------------------------------------|
43 # | (Plain Ethernet traffic)
45 # +-----------------|-----+
50 # +-----------------------+
52 # LER1 and LER2 logically represent two different routers. However, no VRF is
53 # created for them, as they don't do any IP routing.
55 ALL_TESTS
="mpls_forward_eth"
61 simple_if_init
$h1 192.0.2.1/24 2001:db8
::1/124
66 simple_if_fini
$h1 192.0.2.1/24 2001:db8
::1/124
71 simple_if_init
$h2 192.0.2.2/24 2001:db8
::2/124
76 simple_if_fini
$h2 192.0.2.2/24 2001:db8
::2/124
81 tc qdisc add dev
$edge1 ingress
82 tc filter add dev
$edge1 ingress \
84 action mpls mac_push label
102 \
85 action vlan push_eth dst_mac
$mpls2mac src_mac
$mpls1mac \
86 action mirred egress redirect dev
$mpls1
87 ip link
set dev
$edge1 up
89 tc qdisc add dev
$mpls1 ingress
90 tc filter add dev
$mpls1 ingress \
92 flower mpls_label
101 \
94 action mpls pop protocol teb \
95 action mirred egress redirect dev
$edge1
96 ip link
set dev
$mpls1 up
101 ip link
set dev
$mpls1 down
102 tc qdisc del dev
$mpls1 ingress
104 ip link
set dev
$edge1 down
105 tc qdisc del dev
$edge1 ingress
110 tc qdisc add dev
$edge2 ingress
111 tc filter add dev
$edge2 ingress \
113 action mpls mac_push label
101 \
114 action vlan push_eth dst_mac
$mpls1mac src_mac
$mpls2mac \
115 action mirred egress redirect dev
$mpls2
116 ip link
set dev
$edge2 up
118 tc qdisc add dev
$mpls2 ingress
119 tc filter add dev
$mpls2 ingress \
121 flower mpls_label
102 \
122 action vlan pop_eth \
123 action mpls pop protocol teb \
124 action mirred egress redirect dev
$edge2
125 ip link
set dev
$mpls2 up
130 ip link
set dev
$mpls2 down
131 tc qdisc del dev
$mpls2 ingress
133 ip link
set dev
$edge2 down
134 tc qdisc del dev
$edge2 ingress
139 ping_test
$h1 192.0.2.2
140 ping6_test
$h1 2001:db8
::2
154 mpls1mac
=$
(mac_get
$mpls1)
155 mpls2mac
=$
(mac_get
$mpls2)
185 if [[ $?
-ne 0 ]]; then
186 log_info
"Could not test offloaded functionality"