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

correct onvif filters #622

Merged
merged 9 commits into from
Jun 22, 2023

Conversation

johnsonshih
Copy link
Contributor

@johnsonshih johnsonshih commented Jun 15, 2023

What this PR does / why we need it:
This PR fixes the issue. #597
The issue was fixed by #604, but that change causes regression when filter scopes. This PR contains a correct fix for onvif scopes, ip and mac address filters:

  • For ip address filtering, use exact match comparison, to handle IPv6 address, we compare the addresses using normalized address string.
  • For MAC address filtering, similar to ip address filter, exact compare the normalized address string.
  • For scopes filtering, split the scopes string by whitespace into a list and perform exact match comparison against the list. This fixes the problem that when filter is onvif://www.onvif.org/name/foo, incoming scope is onvif://www.onvif.org/name/foobar. The incoming scope shouldn't match.

Special notes for your reviewer:

If applicable:

  • this PR has an associated PR with documentation in akri-docs
  • this PR contains unit tests
  • added code adheres to standard Rust formatting (cargo fmt)
  • code builds properly (cargo build)
  • code is free of common mistakes (cargo clippy)
  • all Akri tests succeed (cargo test)
  • inline documentation builds (cargo doc)
  • all commits pass the DCO bot check by being signed off -- see the failing DCO check for instructions on how to retroactively sign commits

Signed-off-by: Johnson Shih <[email protected]>
Signed-off-by: Johnson Shih <[email protected]>
@johnsonshih johnsonshih changed the title correct filters correct onvif filters Jun 15, 2023
Signed-off-by: Johnson Shih <[email protected]>
Copy link
Contributor

@kate-goldenring kate-goldenring left a comment

Choose a reason for hiding this comment

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

@johnsonshih this seems like a fine change to ignore casing but i am not sure how this fixes #597 given how the issue as described is only number IP address filters. Can you update the PR description or create a new issue that discusses this new bug with letter casing?

discovery-handlers/onvif/src/discovery_handler.rs Outdated Show resolved Hide resolved
Signed-off-by: Johnson Shih <[email protected]>
@johnsonshih
Copy link
Contributor Author

@johnsonshih this seems like a fine change to ignore casing but i am not sure how this fixes #597 given how the issue as described is only number IP address filters. Can you update the PR description or create a new issue that discusses this new bug with letter casing?

I had updated the PR description to explain why/what this change is. For filtering IP address using case-insensitive comparison, it doesn't have any impact when filter IPv4 addresses, but in case we add IPv6 support for onvif DH, we don't need to change the filter.
I'm opened to rollback to use exact match as currently onvif DH only supports IPv4 address.

@johnsonshih johnsonshih merged commit 3c8c62f into project-akri:main Jun 22, 2023
@johnsonshih johnsonshih deleted the user/jshih/onvif-filters branch June 22, 2023 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants