Skip to content

Commit aaf0d91

Browse files
sangjinhanchanglan
authored andcommitted
Store metadata attribute values in big endian
1 parent 252fa29 commit aaf0d91

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

core/modules/set_metadata.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ CommandResponse SetMetadata::AddAttrOne(
6262
// stored in memory). value_bin is a short stream of bytes, which means that
6363
// its data will never be reordered.
6464
if (attr.value_case() == bess::pb::SetMetadataArg_Attribute::kValueInt) {
65-
if (!bess::utils::uint64_to_bin(&value, attr.value_int(), size,
66-
bess::utils::is_be_system())) {
65+
if (!bess::utils::uint64_to_bin(&value, attr.value_int(), size, true)) {
6766
return CommandFailure(EINVAL,
6867
"'value_int' field has not a "
6968
"correct %zu-byte value",

core/modules/wildcard_match.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,11 @@ CommandResponse WildcardMatch::ExtractKeyMask(const T &arg, wm_hkey_t *key,
198198
uint64_t v = 0;
199199
uint64_t m = 0;
200200

201-
bool force_be = (fields_[i].attr_id < 0);
202-
203-
if (!bess::utils::uint64_to_bin(&v, arg.values(i), field_size,
204-
force_be || bess::utils::is_be_system())) {
201+
if (!bess::utils::uint64_to_bin(&v, arg.values(i), field_size, true)) {
205202
return CommandFailure(EINVAL, "idx %zu: not a correct %d-byte value", i,
206203
field_size);
207-
} else if (!bess::utils::uint64_to_bin(
208-
&m, arg.masks(i), field_size,
209-
force_be || bess::utils::is_be_system())) {
204+
} else if (!bess::utils::uint64_to_bin(&m, arg.masks(i), field_size,
205+
true)) {
210206
return CommandFailure(EINVAL, "idx %zu: not a correct %d-byte mask", i,
211207
field_size);
212208
}

0 commit comments

Comments
 (0)