Skip to content

Conversation

@cscarpitta
Copy link
Contributor

@cscarpitta cscarpitta commented Jan 12, 2026

The function release_srv6_sid_func_explicit is declared to return a bool, but its implementation returns an int.

This PR updates the function signature to return int instead of bool.

@cscarpitta
Copy link
Contributor Author

@Mergifyio backport stable/10.5 stable/10.4 stable/10.3 stable/10.2

@mergify
Copy link

mergify bot commented Jan 12, 2026

backport stable/10.5 stable/10.4 stable/10.3 stable/10.2

🟠 Waiting for conditions to match

Details
  • merged [📌 backport requirement]

@cscarpitta cscarpitta changed the title zebra: Fix release_srv6_sid_func_explicit to return bool instead of int zebra: Fix release_srv6_sid_func_explicit to return int instead of bool Jan 12, 2026
The function `release_srv6_sid_func_explicit` is declared to return a
bool, but its implementation returns an int.

This commit updates the function signature to return int instead of bool.

Signed-off-by: Carmine Scarpitta <[email protected]>
@cscarpitta cscarpitta force-pushed the fix/fix_wrong_return_value branch from 6c6c518 to 0d2d7a0 Compare January 12, 2026 17:47
Comment on lines -2134 to 2136
*/
static bool release_srv6_sid_func_explicit(struct zebra_srv6_sid_block *block,
static int release_srv6_sid_func_explicit(struct zebra_srv6_sid_block *block,
uint32_t sid_func,
uint32_t sid_wide_func)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this function really returns a bool (which seems the case), it would be better to actually go the other way (change the implementation to use bool)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be both, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigh I just looked at this closer.

0 was returned as a success, but would be interpreted as false as a bool.
-1 was returned as a failure, but would be interpreted as true as a bool.

I see no problem as a bool( but the returns should be reversed ). Frankly it sure seems like every place this function is called should actually be looked at and time taken to ensure the return code is used correctly.

Also since this function returned a bool and only every 0 and -1 were ever returned a bool is preferable in my mind rather than the awful c weirdness of 0 meaning success.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this function is never checked for the return status, so it sounds like a no-op?

@donaldsharp
Copy link
Member

Why backport tags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants