Add link-local addressing (net_id=0) for edge-initiated communication#201
Merged
okhsunrog merged 2 commits intojamesmunns:mainfrom Mar 28, 2026
Merged
Add link-local addressing (net_id=0) for edge-initiated communication#201okhsunrog merged 2 commits intojamesmunns:mainfrom
okhsunrog merged 2 commits intojamesmunns:mainfrom
Conversation
Allow edge devices to send frames before discovering their real net_id
by using net_id=0 as link-local addressing. The router rewrites
dst.network_id=0 to the interface's real net_id, enabling the edge to
bootstrap itself without waiting for the router to ping first.
- Remove net_id==0 send block in EdgePort::common_send
- Rewrite dst.network_id=0 in router's process_frame (link-local delivery)
- Target edges now start as Active{net_id:0} instead of Inactive
- Update all transports and toolkits for new initial state
- Add e2e tests for link-local ping, address discovery, and cross-edge routing
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Previously, an edge device could not send any frames until the router pinged it first — the edge started as
Inactiveand had no net_id to put in outgoing headers. This forced a router-initiates-first bootstrap flow, which is awkward when the edge wants to request something from the router immediately on connection (e.g. configuration, seed assignment).This PR allows edges to send frames with
net_id=0as "link-local" addressing. The edge starts asActive { net_id: 0 }and can immediately send to(0, CENTRAL_NODE_ID, port)meaning "my directly connected router". The router rewritesdst.network_id=0to the real net_id of that interface and delivers locally. The response carries the real net_id back, and the edge discovers its address from that first response — no protocol change needed.net_id == 0send guard inEdgePort::common_senddst.network_id == 0rewriting in router'sprocess_frame(mirrors existing src rewriting)Active { net_id: 0, node_id: EDGE_NODE_ID }instead ofInactiveacross all transports (TCP, UDP, USB, serial, embassy-usb)is_targetcheck to handle new initial stateTesting: 3 new e2e tests — edge-initiated link-local ping, link-local then real-address ping, two link-local edges pinging each other through a router. All existing e2e tests pass unchanged.