Add switch to switch routing#17
Open
Zeleph25 wants to merge 2 commits into
Open
Conversation
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.
Implement switch-to-switch routing
What was added
This PR completes the routing pipeline so packets reach agents on any switch, not just the local one.
Proto changes:
PacketAgentRegistered- switch reports an agent's virtual IP to the conductorPacketSwitchRouteUpdate- conductor broadcasts a route to all switchesPacketSwitchDisconnected- conductor tells switches to drop routes for a disconnected switchAGENT_REGISTERED,SWITCH_ROUTE_UPDATE,SWITCH_DISCONNECTEDto the packet type enum and dispatchConductor changes:
onAgentRegistered- receives an agent's virtual IP from its switch, broadcasts it to all other switchesSWITCH_DISCONNECTEDto remaining switches when a switch disconnectsassigned_switchper agent, nulled out safely when that switch disconnectsSwitch changes:
onSwitchRouteUpdate- connects to the peer switch if not already connected, updates the BlackBox routing tableonSwitchDisconnected- closes the peer connection, lettingonCloseclean up routesonIPv4Raw- processes packets arriving from peer switches through the BlackBox and delivers them to the local agentAGENT_REGISTEREDto the conductor right after a new agent authenticatesPEER_SWITCHconnection role with its own cleanup path inonCloseVerified:
Routes propagate correctly from the switch handling the agent to every other connected switch, with no conductor involvement once cached.