Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reassess cookie_mask default value and/or mandatory value #91

Closed
viniarck opened this issue Jun 14, 2022 · 2 comments · Fixed by #151
Closed

Reassess cookie_mask default value and/or mandatory value #91

viniarck opened this issue Jun 14, 2022 · 2 comments · Fixed by #151
Labels
2023.1 Kytos-ng 2023.1 enhancement New feature or request priority_medium Medium priority

Comments

@viniarck
Copy link
Member

viniarck commented Jun 14, 2022

Currently, both flow_manager and pyof use 0 a default value for cookie_mask, and since at hte moment, cookie_mask is optional, if a user only sets cookie as a numeric value, then it would result in 0, which could be undesirable, @italovalcy has caught this situation recently.

We need to decide if we'll use a neutral default value all 1s or always require cookie_mask if cookie is set, and it's worth comparing this behavior with OvS as well to be sure since the OF spec doesn't specify much about this point.

@viniarck viniarck added the bug Something isn't working label Jun 22, 2022
@viniarck
Copy link
Member Author

viniarck commented Jun 22, 2022

@italovalcy, I've had the chance to also compare with OvS 2.16.1, and they require cookie_mask as mandatory, and in their example they suggest to use all 1s, although all 1s isn't a default value that they use:

❯ sudo ovs-ofctl del-flows s1 "in_port=1,cookie=0x1000" -O OpenFlow13
ovs-ofctl: cannot set cookie (to match on a cookie, specify a mask, e.g. cookie=0x1000/-1)

❯ sudo ovs-ofctl del-flows s1 "in_port=1,cookie=0x1000" --strict -O OpenFlow13
ovs-ofctl: cannot set cookie (to match on a cookie, specify a mask, e.g. cookie=0x1000/-1)

So, that is also another confirmation that validation is a crucial part to avoid ambiguity.

Trying to use all 1s as a default for cookie_mask could lead to ambiguity since the user might actually mean cookie 0 and could expect cookie_mask 0 to match any cookie and not only cookie 0 specifically, so this can lead to surprises (and since the spec doesn't say which one is the default it will always give margin for interpretation whether cookie_mask should be all 0s or all 1s by default), and on pyof to try to account for unset values it would require to use None as default values and set the integer value based on whether it has been set or not (and then the same problem would be deferred to there to define a base case). It looks like validation with a mandatory value while maintaining as it is the safest and less surprising route. Let me know if you agree or if you see this differently.

@viniarck viniarck added enhancement New feature or request and removed bug Something isn't working labels Jun 22, 2022
@viniarck
Copy link
Member Author

Linking issue #43 here since it's related to validation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2023.1 Kytos-ng 2023.1 enhancement New feature or request priority_medium Medium priority
Projects
None yet
1 participant