Skip to content

Commit e104b7e

Browse files
committed
set_metadata: make packet mode logic explicit
The existing version is hard to reason about and makes the no shift/no mask code path unreachable.
1 parent 1963967 commit e104b7e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

core/modules/set_metadata.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ inline void SetMetadata::DoProcessBatch(bess::PacketBatch *batch,
203203
bool shift = attr->shift != 0;
204204
if (shift && attr->do_mask) {
205205
CopyFromPacket<true, true>(batch, attr, mt_offset);
206-
} else if (shift) {
206+
} else if (shift && !attr->do_mask) {
207207
CopyFromPacket<true, false>(batch, attr, mt_offset);
208-
} else if (!shift) {
208+
} else if (!shift && attr->do_mask) {
209209
CopyFromPacket<false, true>(batch, attr, mt_offset);
210-
} else {
210+
} else if (!shift && !attr->do_mask) {
211211
CopyFromPacket<false, false>(batch, attr, mt_offset);
212212
}
213213
} else {

0 commit comments

Comments
 (0)