Skip to content

Commit a74c30b

Browse files
Bug Fixed load_balance exercise (#712)
Signed-off-by: Jinhua Guo <jinhua@UMICH.EDU>
1 parent 9675abd commit a74c30b

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

exercises/load_balance/load_balance.p4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ control MyIngress(inout headers hdr,
136136
/* TODO: apply ecmp_group table and ecmp_nhop table if IPv4 header is
137137
* valid and TTL hasn't reached zero
138138
*/
139-
ecmp_group.apply();
140-
ecmp_nhop.apply();
139+
if (ecmp_group.apply().hit) {
140+
ecmp_nhop.apply();
141+
}
141142
}
142143
}
143144

exercises/load_balance/solution/load_balance.p4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,9 @@ control MyIngress(inout headers hdr,
141141
}
142142
apply {
143143
if (hdr.ipv4.isValid() && hdr.ipv4.ttl > 0) {
144-
ecmp_group.apply();
145-
ecmp_nhop.apply();
144+
if (ecmp_group.apply().hit) {
145+
ecmp_nhop.apply();
146+
}
146147
}
147148
}
148149
}

0 commit comments

Comments
 (0)