Skip to content

T6455: build zerotier-one with extosdep support#1195

Open
aadnehovda wants to merge 3 commits into
vyos:rollingfrom
aadnehovda:zerotier-extosdep-package
Open

T6455: build zerotier-one with extosdep support#1195
aadnehovda wants to merge 3 commits into
vyos:rollingfrom
aadnehovda:zerotier-extosdep-package

Conversation

@aadnehovda

@aadnehovda aadnehovda commented May 20, 2026

Copy link
Copy Markdown

Summary

Build the ZeroTier agent package with extosdep (external interface mgmt) support for the alternative VyOS ZeroTier integration in vyos/vyos-1x#5211. Please consider that before merging this.

This also adds a small optional patch for the CONFIGUPDATE notification proposed upstream in zerotier/ZeroTierOne#2587.

Changes

  • Build zerotier-one with ZT_EXTOSDEP=1 and ZT_SSO_SUPPORTED=0.
  • Apply the minimal extosdep config-update/IP-bookkeeping patch before the custom make/fpm build.
  • Add package iteration vyos1 so the patched build is distinguishable.

@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds an ExtOsdep config-update command and packed message, implements ExtOsdep::configUpdate and a tap iterator erase fix, calls the new API from OneService's managed-network apply paths under ZT_EXTOSDEP, and applies the patch during the zerotier-one package build.

Changes

ExtOsdep config update messaging

Layer / File(s) Summary
Message contract and ExtOsdep API
scripts/package-build/zerotier-one/patches/zerotier-one/0001-extosdep-config-update-nudge.patch (ExtOsdep.hpp: lines ~40-61)
Adds #define ZT_EOD_MSG_CONFIGUPDATE and struct zt_eod_msg_configupdate { unsigned char cmd; uint64_t nwid; uint64_t revision; } __attribute__((packed)); and declares static void configUpdate(uint64_t, uint64_t);. (ranges range_8192a9aed367, range_6f49b0d1fca0)
ExtOsdep implementation
scripts/package-build/zerotier-one/patches/zerotier-one/0001-extosdep-config-update-nudge.patch (ExtOsdep.cpp: lines ~9-19)
Implements ExtOsdep::configUpdate() to zero-init the zt_eod_msg_configupdate, set cmd, nwid, revision, lock eodMutex, and call __eodSend. (range_fc841a885253)
Tap iterator fix
same patch (ExtOsdepTap::removeIp: lines ~25-30)
Fixes iterator handling in ExtOsdepTap::removeIp by erasing the iterator from allIps after removal. (range_5dc0e546d5a2)
Network config update integration
scripts/package-build/zerotier-one/patches/zerotier-one/0001-extosdep-config-update-nudge.patch (OneService.cpp: lines ~69-86)
Adds #ifdef ZT_EXTOSDEP calls to ExtOsdep::configUpdate(nwid, (uint64_t)nwc->netconfRevision) and ExtOsdep::configUpdate(nwid, (uint64_t)n.config().netconfRevision) in the two managed-config branches. (ranges range_b2bec7e73a32, range_72b29dc0ae56)
Build configuration and patch application
scripts/package-build/zerotier-one/package.toml (lines 6-16)
Adds a pre_build_hook that runs git apply for the patch and sets ZT_EXTOSDEP=1 in the make build command. (range_f411e961fcd0)
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed Title clearly summarizes the main change: enabling extosdep support in the zerotier-one package build.
Description check ✅ Passed The PR description accurately describes the changeset: building zerotier-one with extosdep support, applying a config-update patch, and adding package iteration vyos1.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown


PR title does not match the required format

@github-actions github-actions Bot added the current VyOS rolling release label May 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/package-build/zerotier-one/package.toml`:
- Line 6: Update the pre_build_hook so patch application is idempotent: before
running git apply on
../patches/zerotier-one/0001-extosdep-config-update-nudge.patch, run a check
(e.g. git apply --reverse --check <patch> to detect already-applied patches, or
git apply --check <patch> to detect if it can be applied) and only run git apply
<patch> when the check indicates the patch is not yet applied; modify the
pre_build_hook entry that currently runs git apply to perform this conditional
check-and-apply sequence so rebuilds don’t fail.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: fbfabc42-5414-40fc-b55e-ff58f5fefd5a

📥 Commits

Reviewing files that changed from the base of the PR and between 440a78d and 3db26ef.

📒 Files selected for processing (2)
  • scripts/package-build/zerotier-one/package.toml
  • scripts/package-build/zerotier-one/patches/zerotier-one/0001-extosdep-config-update-nudge.patch
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: assign-author / assign-author
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
🔍 Remote MCP Context7

Based on my research, I now have sufficient context to provide a comprehensive summary. Let me compile the relevant findings.

Summary of Additional Context for PR Review

ZeroTier's ExtOsDep System

The extosdep feature provides third-party device vendors the ability to manage ZeroTier without exposing the typical HTTPS control plane on localhost. It can be enabled at compile-time via ZT_EXTOSDEP=1. This is the core functionality the PR enables for VyOS integration.

VyOS T6455 Context

The task is for adding ZeroTier support to VyOS to provide bolt-on SD-WAN support. Each configured ZeroTier interface will be run in a new ZeroTier process as a container. Running in a container allows for easy updating of the software without needing to fully update VyOS, which is important if an upstream fix for a vulnerability is patched.

Build Architecture Context

The PR pins ZeroTier to version 1.16.0, applying a temporary local patch for the CONFIGUPDATE extosdep message before building. ZeroTier's osdep directory contains code to support and integrate with operating systems, including platform-specific stuff only built for certain targets. The service wraps the ZeroTier core and provides VPN-like connectivity to virtual networks.

Review-Relevant Points

  1. Temporary Patch Strategy: The PR acknowledges this is a temporary solution until the upstream change (zerotier/ZeroTierOne#2587) is included in a packaged ZeroTier release.

  2. Build Validation: The PR describes comprehensive validation including package compilation, confirmation of compiler flags, installation testing, and verification that config update messages reach the wrapper process.

  3. Version Management: Package iteration vyos1 distinguishes this patched build from upstream, important for tracking local modifications.

  4. Existing Integration Context: Previous VyOS requests for ZeroTier integration were blocked due to licensing concerns with ZeroTier's BSL license. The new approach solves this by running ZeroTier as a container, pushing the requirement to acquire the software and adhere to all licensing on the user/operator rather than the distro/maintainers.,, [::web_search::]

🔇 Additional comments (6)
scripts/package-build/zerotier-one/patches/zerotier-one/0001-extosdep-config-update-nudge.patch (5)

32-32: LGTM!

Also applies to: 40-44, 53-53


71-78: Verify the intent of configUpdate during network teardown.

The second call site (lines 3626-3628) is in a code path that immediately calls n.tap().reset() at line 3630, suggesting network shutdown. The first call site (lines 3607-3609) is clearly in a configuration update scenario after setMtu(). Sending a config update notification during teardown may be intentional (to notify the wrapper of final state) or unintended (incorrect call site). Clarify the design intent.


75-76: Structure is correct and intentional.

The Windows-specific code at lines 75-76 properly closes with #endif, followed by a separate #ifdef ZT_EXTOSDEP block for the new configUpdate() call. This layered conditional design isolates Windows-specific functionality (instanceId extraction) from the new EXTOSDEP code path, with common cleanup executing after both blocks. No scope violation occurs.


66-66: Type cast to uint64_t is safe. The netconfRevision field in ZeroTier's NetworkConfig structure is unsigned long or already uint64_t. Both call sites perform safe widening or no-op casts with no truncation or sign-extension risk. The second call site at line 3625 is also appropriate—it notifies the external OS dependency of the final configuration state before network teardown.


9-19: No changes required; implementation follows the established ExtOsdep pattern.

The configUpdate() function correctly mirrors other ExtOsdep message handlers like zt_eod_msg_addtap, which also assign uint64_t fields (e.g., nwid) without byte order conversion. ExtOsdep is a local IPC mechanism, not a network protocol, so byte order conversion is unnecessary. The struct layout with __attribute__((packed)) is consistent with all other message types in the protocol.

			> Likely an incorrect or invalid review comment.
scripts/package-build/zerotier-one/package.toml (1)

9-9: LGTM!

Also applies to: 16-16

commit_id = "1.16.0"
scm_url = "https://github.com/zerotier/ZeroTierOne.git"

pre_build_hook = "git apply ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Patch application is not idempotent and will fail on rebuild.

git apply will fail if the patch is already applied, breaking incremental build scenarios. Consider using git apply --reverse --check to test if the patch is already applied before attempting to apply it, or use git apply --check with conditional logic.

🔧 Suggested fix for idempotent patch application
-pre_build_hook = "git apply ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch"
+pre_build_hook = """
+if ! git apply --reverse --check ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch 2>/dev/null; then
+    git apply ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch
+fi
+"""
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pre_build_hook = "git apply ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch"
pre_build_hook = """
if ! git apply --reverse --check ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch 2>/dev/null; then
git apply ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch
fi
"""
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/package-build/zerotier-one/package.toml` at line 6, Update the
pre_build_hook so patch application is idempotent: before running git apply on
../patches/zerotier-one/0001-extosdep-config-update-nudge.patch, run a check
(e.g. git apply --reverse --check <patch> to detect already-applied patches, or
git apply --check <patch> to detect if it can be applied) and only run git apply
<patch> when the check indicates the patch is not yet applied; modify the
pre_build_hook entry that currently runs git apply to perform this conditional
check-and-apply sequence so rebuilds don’t fail.

@aadnehovda

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@aadnehovda aadnehovda changed the title zerotier: T6455: build with extosdep support T6455: build zerotier-one with extosdep support May 22, 2026
commit_id = "1.16.0"
scm_url = "https://github.com/zerotier/ZeroTierOne.git"

pre_build_hook = "git apply ../patches/zerotier-one/0001-extosdep-config-update-nudge.patch"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The build.py script will always check the patches/<pkg-name> directory if it is exist it will patch the package during build process
So as I see we do not need additional pre_build_hook here

@mergify

mergify Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 invalid-title label must be absent to merge

Waiting for

  • label != invalid-title
This rule is failing.

Block merge while the invalid-title label is present. The label is auto-toggled by the Flag T-ID format violation in PR title or commit messages rule when the PR title or any commit's first line does not match [scope: ]T<digits>: <text>. Must be cleared by amending the offending title/commit headline.

  • label != invalid-title

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

Labels

Development

Successfully merging this pull request may close these issues.

2 participants