2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

ofp-actions: Fix reporting observation point bits instead of domain.

Found by Coverity:

  CID 397544:  Incorrect expression  (COPY_PASTE_ERROR)
  "obs_point_src" in "(*os).obs_point_src.n_bits" looks
  like a copy-paste error.

Also adding a test case to cover this situation.

Fixes: 1aa9e137fe36 ("ofp-actions: Load data from fields in sample action.")
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Ilya Maximets 2024-07-16 12:48:06 +02:00
parent 03cd668e05
commit 6165c92a28
2 changed files with 3 additions and 1 deletions

View File

@ -6489,7 +6489,7 @@ parse_SAMPLE(char *arg, const struct ofpact_parse_params *pp)
if (os->obs_domain_src.n_bits > 32) {
return xasprintf("size of obs_domain_id field (%d) "
"exceeds maximum (32)",
os->obs_point_src.n_bits);
os->obs_domain_src.n_bits);
}
}
} else if (!strcmp(key, "obs_point_id")) {

View File

@ -1127,6 +1127,8 @@ bad_action 'unroll_xlate' "UNROLL is an internal action that shouldn't be used v
# sample
bad_action 'sample(probability=0)' 'invalid probability value "0"'
bad_action 'sample(sampling_port=asdf)' 'asdf: unknown port'
bad_action 'sample(probability=12345,obs_domain_id=NXM_NX_CT_LABEL[[5..40]])' \
'size of obs_domain_id field (36) exceeds maximum (32)'
bad_action 'sample(probability=12345,obs_point_id=NXM_NX_CT_LABEL[[0..32]])' \
'size of obs_point_id field (33) exceeds maximum (32)'
bad_action 'sample(foo=bar)' 'invalid key "foo" in "sample" argument'