-
Notifications
You must be signed in to change notification settings - Fork 459
T6455: build zerotier-one with extosdep support #1195
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
Open
aadnehovda
wants to merge
3
commits into
vyos:rolling
Choose a base branch
from
aadnehovda:zerotier-extosdep-package
base: rolling
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,15 +3,17 @@ name = "zerotier-one" | |
| 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" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
|
||
| build_cmd = """ | ||
| make -j"$(nproc)" ZT_SSO_SUPPORTED=0 | ||
| make -j"$(nproc)" ZT_EXTOSDEP=1 ZT_SSO_SUPPORTED=0 | ||
| mkdir -p tmp/usr/sbin | ||
| install -m0755 zerotier-one tmp/usr/sbin/zerotier-one | ||
| ln -s /usr/sbin/zerotier-one tmp/usr/sbin/zerotier-cli | ||
| ln -s /usr/sbin/zerotier-one tmp/usr/sbin/zerotier-idtool | ||
|
|
||
| fpm --input-type dir --output-type deb --name zerotier-one \ | ||
| --version "1.16.0" --deb-compression gz \ | ||
| --version "1.16.0" --iteration "vyos1" --deb-compression gz \ | ||
| --maintainer "VyOS Package Maintainers <maintainers@vyos.net>" \ | ||
| --description "ZeroTier virtual networking daemon" \ | ||
| --license "MPL-2.0" --chdir tmp . | ||
|
|
||
88 changes: 88 additions & 0 deletions
88
...s/package-build/zerotier-one/patches/zerotier-one/0001-extosdep-config-update-nudge.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| diff --git a/osdep/ExtOsdep.cpp b/osdep/ExtOsdep.cpp | ||
| index 4efab5a6c..771668d72 100644 | ||
| --- a/osdep/ExtOsdep.cpp | ||
| +++ b/osdep/ExtOsdep.cpp | ||
| @@ -256,6 +256,18 @@ bool ExtOsdep::getBindAddrs(std::map<InetAddress, std::string>& ret) | ||
| return resp->result; | ||
| } | ||
|
|
||
| +void ExtOsdep::configUpdate(uint64_t nwid, uint64_t revision) | ||
| +{ | ||
| + zt_eod_msg_configupdate msg; | ||
| + memset(&msg, 0, sizeof(msg)); | ||
| + msg.cmd = ZT_EOD_MSG_CONFIGUPDATE; | ||
| + msg.nwid = nwid; | ||
| + msg.revision = revision; | ||
| + | ||
| + Mutex::Lock l(eodMutex); | ||
| + __eodSend(msg); | ||
| +} | ||
| + | ||
| ExtOsdepTap::ExtOsdepTap( | ||
| const char* homePath, | ||
| const MAC& mac, | ||
| @@ -499,6 +511,7 @@ bool ExtOsdepTap::removeIp(const InetAddress& ip) | ||
| for (auto i = allIps.begin(); i != allIps.end(); ++i) { | ||
| if (*i == ip) { | ||
| doRemoveIp(*i); | ||
| + allIps.erase(i); | ||
| return true; | ||
| } | ||
| } | ||
| diff --git a/osdep/ExtOsdep.hpp b/osdep/ExtOsdep.hpp | ||
| index d7028902c..c1951239f 100644 | ||
| --- a/osdep/ExtOsdep.hpp | ||
| +++ b/osdep/ExtOsdep.hpp | ||
| @@ -34,6 +34,7 @@ | ||
| #define ZT_EOD_MSG_ADDROUTERESP 17 | ||
| #define ZT_EOD_MSG_DELROUTE 18 | ||
| #define ZT_EOD_MSG_DELROUTERESP 19 | ||
| +#define ZT_EOD_MSG_CONFIGUPDATE 20 | ||
|
|
||
| struct zt_eod_msg_addtap { | ||
| unsigned char cmd; | ||
| @@ -105,6 +106,12 @@ struct zt_eod_msg_route { | ||
| unsigned char src[16]; | ||
| } __attribute__((packed)); | ||
|
|
||
| +struct zt_eod_msg_configupdate { | ||
| + unsigned char cmd; | ||
| + uint64_t nwid; | ||
| + uint64_t revision; | ||
| +} __attribute__((packed)); | ||
| + | ||
| struct zt_eod_mgmt_req { | ||
| uint32_t method; | ||
| uint32_t pathlen; | ||
| @@ -144,6 +151,7 @@ class ExtOsdep { | ||
|
|
||
| static void routeAddDel(bool, const InetAddress& target, const InetAddress& via, const InetAddress& src, const char* ifaceName); | ||
| static bool getBindAddrs(std::map<InetAddress, std::string>&); | ||
| + static void configUpdate(uint64_t nwid, uint64_t revision); | ||
|
|
||
| static bool mgmtRecv(void* cookie, void* data, unsigned long len, std::function<unsigned(unsigned, const std::string&, const std::string&, std::string&)>); | ||
| static bool mgmtWritable(void*); | ||
| diff --git a/service/OneService.cpp b/service/OneService.cpp | ||
| index 41d790516..ea8e4ce3c 100644 | ||
| --- a/service/OneService.cpp | ||
| +++ b/service/OneService.cpp | ||
| @@ -3599,6 +3599,9 @@ class OneServiceImpl : public OneService { | ||
| #endif | ||
| syncManagedStuff(n, true, true, true); | ||
| n.tap()->setMtu(nwc->mtu); | ||
| +#ifdef ZT_EXTOSDEP | ||
| + ExtOsdep::configUpdate(nwid, (uint64_t)nwc->netconfRevision); | ||
| +#endif | ||
| } | ||
| else { | ||
| _nets.erase(nwid); | ||
| @@ -3611,6 +3614,9 @@ class OneServiceImpl : public OneService { | ||
| if (n.tap()) { // sanity check | ||
| #if defined(__WINDOWS__) && ! defined(ZT_SDK) | ||
| std::string winInstanceId(((WindowsEthernetTap*)(n.tap().get()))->instanceId()); | ||
| +#endif | ||
| +#ifdef ZT_EXTOSDEP | ||
| + ExtOsdep::configUpdate(nwid, (uint64_t)n.config().netconfRevision); | ||
| #endif | ||
| *nuptr = (void*)0; | ||
| n.tap().reset(); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch application is not idempotent and will fail on rebuild.
git applywill fail if the patch is already applied, breaking incremental build scenarios. Consider usinggit apply --reverse --checkto test if the patch is already applied before attempting to apply it, or usegit apply --checkwith conditional logic.🔧 Suggested fix for idempotent patch application
📝 Committable suggestion
🤖 Prompt for AI Agents