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

openthread_border_router: bump to latest and smaller improvements #3772

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

agners
Copy link
Member

@agners agners commented Sep 25, 2024

Bump to OTBR POSIX version ff7227ea9a2 (2024-09-25 14:54:08 -0700) and fix some smaller issues, specifically make sure that the log output is not buffered and avoid ipset errors.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced the ability to delete datasets within the OpenThread Border Router through new API endpoints.
    • Added a command-line option to disable syslog logging for the otbr-web application.
  • Improvements

    • Updated route metrics for better network interface prioritization.
    • Enhanced logging behavior with unbuffered output for improved runtime log visibility.
  • Version Updates

    • Bumped the OpenThread Border Router version to 2.11.0, reflecting various enhancements and fixes.

Bump to OTBR POSIX version 09574a202c2 (2024-09-23 08:54:32 -0700)
and fix some smaller issues, specifically make sure that the log output
is not buffered and avoid ipset errors.
Bump to OTBR POSIX version ff7227ea9a2 (2024-09-25 14:54:08 -0700).
Gets rid of a local patch.
@agners agners marked this pull request as ready for review September 27, 2024 09:15
Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

📝 Walkthrough

Walkthrough

The pull request introduces several changes to the OpenThread Border Router, including support for deleting datasets, modifications to network interface route metrics, enhancements to logging control, and updates to versioning and configuration files. New command line options are added for disabling syslog logging, and various scripts are updated to improve output buffering and ipset creation. Additionally, the changelog and Dockerfile are modified to reflect these changes and ensure proper build configurations.

Changes

File(s) Change Summary
openthread_border_router/0001-support-deleting-the-dataset.patch Introduces dataset deletion functionality, updates OpenAPI spec, and modifies resource management.
openthread_border_router/0002-set-netif-route-metric-lower.patch Updates CMakeLists to set route metric to 64, enables CLI logging, and removes TCP support definition.
openthread_border_router/0003-logging-support-disable-syslog-for-otbr-web-as-well.patch Adds command line option to disable syslog logging in otbr-web.
openthread_border_router/CHANGELOG.md Updates to version 2.11.0, includes unbuffered log output and ipset error fixes.
openthread_border_router/Dockerfile Removes logging patch, adds new build configuration options for DNS client and Thread version.
openthread_border_router/build.yaml Updates OTBR_VERSION to a new commit hash.
openthread_border_router/config.yaml Updates version number from 2.10.0 to 2.11.0.
openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run Modifies script to create ipsets for IPv6 and updates command to start otbr-agent.
openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run Updates command to start otbr-web with line-buffered output.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (9)
openthread_border_router/Dockerfile (1)

91-91: LGTM! Consider updating documentation.

Setting -DOT_THREAD_VERSION=1.3 is a good practice to ensure compatibility with other Thread devices. This aligns with the PR objective of updating to the latest version.

Consider updating the project documentation to reflect this specific Thread version, if not already done.

openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run (2)

69-75: LGTM! Consider adding a comment for clarity.

The addition of these ipsets is a good practice. It ensures that the necessary ipsets are always available for the OTBR agent, regardless of whether the firewall is enabled or not. This prevents potential errors and allows for more flexible firewall management.

Consider adding a brief comment explaining why these ipsets are created unconditionally. For example:

# Create ipsets unconditionally to support OTBR agent's firewall functionality
# These are required even when the firewall is disabled to prevent errors

This would help future maintainers understand the reasoning behind this change.


Ipset creation failed.

The verification script could not find the ipset command, which is essential for setting up OTBR's firewall functionality. Ensure that ipset is installed and accessible in the runtime environment to enable proper firewall configuration.

🔗 Analysis chain

Line range hint 1-126: Overall, these changes enhance OTBR setup and observability.

The modifications in this file effectively address two important aspects:

  1. Ensuring proper ipset setup for OTBR's firewall functionality.
  2. Improving log visibility through line-buffered output.

These changes align well with the PR objectives and should contribute to a more robust and maintainable OTBR implementation.

To ensure these changes don't introduce any unintended side effects, consider running the following verification steps:

This script will help verify that the ipsets are created correctly and that the OTBR agent starts up and produces immediate output as expected.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify ipset creation and OTBR agent startup

# Check if ipsets are created correctly
ipset list | grep -q "Name: otbr-ingress-deny-src" && \
ipset list | grep -q "Name: otbr-ingress-deny-src-swap" && \
ipset list | grep -q "Name: otbr-ingress-allow-dst" && \
ipset list | grep -q "Name: otbr-ingress-allow-dst-swap" && \
echo "Ipsets created successfully" || echo "Ipset creation failed"

# Check if OTBR agent starts without errors and produces immediate output
timeout 10s stdbuf -oL /usr/sbin/otbr-agent 2>&1 | grep -q . && \
echo "OTBR agent started and produced output" || echo "OTBR agent startup or output test failed"

Length of output: 323

openthread_border_router/CHANGELOG.md (1)

7-7: Good fix for ipset errors.

Avoiding ipset errors when the firewall is disabled addresses a specific issue mentioned in the PR objectives. This will enhance the stability of the OTBR.

Consider adding a brief explanation of the impact of this change, such as "This improves stability when operating without the firewall."

openthread_border_router/0001-support-deleting-the-dataset.patch (5)

Line range hint 8-8: Typographical error in commit message: "entirly" should be "entirely"

There's a typo in the commit message description. The word "entirly" should be corrected to "entirely".


Line range hint 26-26: Duplicate word in OpenAPI description: "Deletes the the active operational dataset"

In the OpenAPI specification for deleting the active operational dataset, the description contains a duplicate "the the". Please correct it to "Deletes the active operational dataset".

Apply this diff to fix the typo:

       description: |-
-        Deletes the the active operational dataset on the current node. Only allowed if the Thread node
+        Deletes the active operational dataset on the current node. Only allowed if the Thread node
         is inactive.

Line range hint 35-35: Duplicate word in OpenAPI description: "Deletes the the pending operational dataset"

Similarly, the description for deleting the pending operational dataset has a duplicate "the the". Please correct it to "Deletes the pending operational dataset".

Apply this diff to fix the typo:

       description: |-
-        Deletes the the pending operational dataset on the current node.
+        Deletes the pending operational dataset on the current node.

Line range hint 42-43: Incorrect response description for pending dataset deletion

The "200" response description for deleting the pending operational dataset incorrectly mentions "active operational dataset" instead of "pending operational dataset".

Apply this diff to correct the response description:

         "200":
-          description: Successfully deleted the active operational dataset.
+          description: Successfully deleted the pending operational dataset.

Line range hint 77-77: Typo in method name: 'SetResponsCode' should be 'SetResponseCode'

In resource.cpp, within the DeleteDataset method, there's a typographical error in the method call aResponse.SetResponsCode(errorCode);. It should be SetResponseCode.

Apply this diff to fix the method name:

     aResponse.SetResponsCode(errorCode);
+    aResponse.SetResponseCode(errorCode);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9c18024 and 7398b0a.

📒 Files selected for processing (9)
  • openthread_border_router/0001-support-deleting-the-dataset.patch (5 hunks)
  • openthread_border_router/0002-set-netif-route-metric-lower.patch (2 hunks)
  • openthread_border_router/0003-logging-support-disable-syslog-for-otbr-web-as-well.patch (0 hunks)
  • openthread_border_router/CHANGELOG.md (1 hunks)
  • openthread_border_router/Dockerfile (1 hunks)
  • openthread_border_router/build.yaml (1 hunks)
  • openthread_border_router/config.yaml (1 hunks)
  • openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run (2 hunks)
  • openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run (1 hunks)
💤 Files not reviewed due to no reviewable changes (1)
  • openthread_border_router/0003-logging-support-disable-syslog-for-otbr-web-as-well.patch
✅ Files skipped from review due to trivial changes (1)
  • openthread_border_router/config.yaml
🧰 Additional context used
📓 Path-based instructions (5)
openthread_border_router/0001-support-deleting-the-dataset.patch (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/0002-set-netif-route-metric-lower.patch (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/CHANGELOG.md (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/Dockerfile (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

openthread_border_router/build.yaml (6)

Pattern */**(html|markdown|md): - For instructional content in documentation, use a direct and authoritative tone. Avoid expressions of politeness such as 'may' or 'please', and ensure the goal of the instruction is fronted.

  • Apply the Microsoft Style Guide to ensure documentation maintains clarity and conciseness.
  • In step-by-step instructions, front the location phrase in the instructional sentence.
  • In step-by-step instructions, front the 'goal' in the instructional sentence.
  • In step-by-step instructions, if in doubt what to front, front the 'goal' before the location phrase in the instructional sentence.
  • do not hyphenate terms like 'top-right' or 'bottom-left' with 'corner'

Pattern */**(html|markdown|md): - Use bold to mark UI strings.

  • If "" are used to mark UI strings, replace them by bold.

Pattern */**(html|markdown|md): - Be brief in your replies and don't add fluff like "thank you for..." and "Please let me know if"


Pattern */**(html|markdown|md): - Use sentence-style capitalization also in headings.


Pattern */**(html|markdown|md): do not comment on HTML used for icons


Pattern */**(html|markdown|md): Avoid flagging inline HTML for embedding videos in future reviews for this repository.

🔇 Additional comments (8)
openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-web/run (1)

10-10: Improved logging with line-buffered output: Approved

The addition of stdbuf -oL before the otbr-web command is a good improvement. This change ensures that the output from the OpenThread BorderRouter web interface is line-buffered, which means each line of output will be flushed immediately.

Benefits of this change:

  1. Improved real-time logging: Log messages will appear more promptly, aiding in debugging and monitoring.
  2. Better visibility: In case of crashes or unexpected behavior, you're more likely to see the most recent log entries.
  3. Consistent with PR objectives: This change directly addresses the goal of ensuring log output is not buffered.

The rest of the command remains unchanged, maintaining the existing functionality while improving the logging behavior.

openthread_border_router/0002-set-netif-route-metric-lower.patch (1)

21-21: LGTM. Verify impact on overall routing behavior.

The addition of -DOPENTHREAD_POSIX_CONFIG_NETIF_PREFIX_ROUTE_METRIC=64 aligns with the goal of prioritizing the OpenThread network interface's route. This should effectively address the issue with routes learned through IPv6 Neighbor Discovery Protocol when using NetworkManager.

To ensure this change doesn't have unintended consequences, please verify the overall routing behavior in various network scenarios. Run the following script to check for any other route metric configurations that might interact with this change:

✅ Verification successful

Further Verification Required

The previous search for NETIF_PREFIX_ROUTE_METRIC and ROUTE_METRIC did not yield any results. To ensure a comprehensive verification, please run the following updated scripts without type filters:


Verified: Route Metric Adjustment Confirmed

The patch correctly updates OPENTHREAD_POSIX_CONFIG_NETIF_PREFIX_ROUTE_METRIC from 0 to 64, ensuring that the OpenThread network interface's route is prioritized over those learned via IPv6 Neighbor Discovery Protocol when using NetworkManager. No additional ROUTE_METRIC configurations were found, indicating no conflicting settings.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other route metric configurations in the codebase

# Test: Look for other NETIF_PREFIX_ROUTE_METRIC configurations
rg --type cpp "NETIF_PREFIX_ROUTE_METRIC"

# Test: Look for other route metric related configurations
rg --type cpp "ROUTE_METRIC"

Length of output: 368


Script:

#!/bin/bash
# Description: Search for other route metric configurations in the codebase without type filter

# Test: Look for NETIF_PREFIX_ROUTE_METRIC configurations in all files
rg "NETIF_PREFIX_ROUTE_METRIC"

# Test: Look for other route metric related configurations in all files
rg "ROUTE_METRIC"

Length of output: 2136

openthread_border_router/Dockerfile (2)

Line range hint 1-91: Clarify the removal of the logging support patch.

The patch file 0003-logging-support-disable-syslog-for-otbr-web-as-well.patch and its application have been removed. This change might affect the logging behavior of the OTBR, particularly for the web interface.

Please clarify the reasoning behind this removal and confirm that it doesn't negatively impact the logging capabilities mentioned in the PR objectives.

To verify the impact, run the following script:

#!/bin/bash
# Description: Check for any remaining references to the removed patch or related logging configurations.

# Test: Search for references to the removed patch file
rg "0003-logging-support-disable-syslog-for-otbr-web-as-well.patch"

# Test: Search for logging-related configurations
rg --type=yaml --type=json "log|syslog"

90-90: Verify the impact of disabling DNS client over TCP.

The addition of -DOT_DNS_CLIENT_OVER_TCP=OFF disables the DNS client over TCP feature. While this may optimize the build, it's important to ensure that this change doesn't negatively impact the OTBR's functionality, especially in scenarios where large DNS responses are expected.

To verify the impact, run the following script:

✅ Verification successful

Disabling DNS client over TCP does not affect OTBR functionality.
After verifying, there are no DNS-related configurations or code impacted by this change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any DNS-related configuration or code that might be affected by this change.

# Test: Search for DNS-related configuration
rg --type=yaml --type=json "DNS|dns"

# Test: Search for DNS-related code
ast-grep --lang cpp --pattern 'DNS|dns'

Length of output: 4284

openthread_border_router/rootfs/etc/s6-overlay/s6-rc.d/otbr-agent/run (1)

122-122: Excellent improvement for log visibility!

The addition of stdbuf -oL to the exec command is a great enhancement. This modification ensures that the output from otbr-agent is line-buffered, which means:

  1. Log messages will be written immediately, improving real-time visibility.
  2. It's easier to monitor the agent's behavior and troubleshoot issues as they occur.
  3. In case of unexpected termination, you're less likely to lose recent log entries.

This change aligns perfectly with the PR objective of ensuring that log output is not buffered.

openthread_border_router/CHANGELOG.md (3)

5-5: Version update looks good.

The update to OTBR POSIX version ff7227ea9a2 from September 25, 2024, aligns with the PR objective of updating to the latest version.


6-6: Unbuffered log output is a good improvement.

Making the log output unbuffered will improve the visibility and immediacy of log messages. This change is beneficial for debugging and real-time monitoring of the OTBR.


3-8: Changelog entry is well-structured.

The changelog entry for version 2.11.0 is clear, concise, and follows good practices:

  • Version number is clearly stated
  • Changes are listed as bullet points
  • Information is relevant and easy to understand

This format makes it easy for users to quickly grasp the changes in this version.

openthread_border_router/build.yaml Show resolved Hide resolved
@agners agners merged commit a16142a into master Sep 27, 2024
10 checks passed
@agners agners deleted the otbr-bump-to-09574a202c branch September 27, 2024 13:23
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.

2 participants