diff mbox series

[ovs-dev] features: Fix wrong logic for feature set discovered.

Message ID 20240808095353.1218617-1-amusil@redhat.com
State Accepted
Headers show
Series [ovs-dev] features: Fix wrong logic for feature set discovered. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Ales Musil Aug. 8, 2024, 9:53 a.m. UTC
The logic would return true if there was at least one discovered feature.
However, that wasn't the purpose of that function. Fix the logic,
so it returns true only if all features are discovered.

Fixes: bc94def2dacf ("features: Make querying of OpenFlow features more versatile.")
Signed-off-by: Ales Musil <amusil@redhat.com>
---
 lib/features.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dumitru Ceara Aug. 8, 2024, 10:29 a.m. UTC | #1
On 8/8/24 11:53, Ales Musil wrote:
> The logic would return true if there was at least one discovered feature.
> However, that wasn't the purpose of that function. Fix the logic,
> so it returns true only if all features are discovered.
> 
> Fixes: bc94def2dacf ("features: Make querying of OpenFlow features more versatile.")
> Signed-off-by: Ales Musil <amusil@redhat.com>
> ---
>  lib/features.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/features.c b/lib/features.c
> index ab0327d51..98d56602c 100644
> --- a/lib/features.c
> +++ b/lib/features.c
> @@ -457,10 +457,10 @@ ovs_feature_set_discovered(void)
>  {
>      /* The supported feature set has been discovered if we're connected
>       * to OVS and it replied to all our feature request messages. */
> -    bool replied_to_all = false;
> +    bool replied_to_all = true;
>      for (size_t i = 0; i < ARRAY_SIZE(all_openflow_features); i++) {
>          struct ovs_openflow_feature *feature = &all_openflow_features[i];
> -        replied_to_all |= !feature->queued;
> +        replied_to_all &= !feature->queued;
>      }
>  
>      return swconn && rconn_is_connected(swconn) && replied_to_all;

Nice catch!  Looks good to me, thanks!

Acked-by: Dumitru Ceara <dceara@redhat.com>
diff mbox series

Patch

diff --git a/lib/features.c b/lib/features.c
index ab0327d51..98d56602c 100644
--- a/lib/features.c
+++ b/lib/features.c
@@ -457,10 +457,10 @@  ovs_feature_set_discovered(void)
 {
     /* The supported feature set has been discovered if we're connected
      * to OVS and it replied to all our feature request messages. */
-    bool replied_to_all = false;
+    bool replied_to_all = true;
     for (size_t i = 0; i < ARRAY_SIZE(all_openflow_features); i++) {
         struct ovs_openflow_feature *feature = &all_openflow_features[i];
-        replied_to_all |= !feature->queued;
+        replied_to_all &= !feature->queued;
     }
 
     return swconn && rconn_is_connected(swconn) && replied_to_all;