diff --git a/controller/src/handler.rs b/controller/src/handler.rs index 3afb94de5..350c836d1 100644 --- a/controller/src/handler.rs +++ b/controller/src/handler.rs @@ -97,30 +97,8 @@ impl Handler { } } -impl PathFilter for Handler { - fn should_use_physical_path( - &self, - _id: &Identity, - _endpoint: &zerotier_network_hypervisor::vl1::Endpoint, - _local_socket: Option<&HostSystemImpl::LocalSocket>, - _local_interface: Option<&HostSystemImpl::LocalInterface>, - ) -> bool { - true - } - - fn get_path_hints( - &self, - _id: &Identity, - ) -> Option< - Vec<( - zerotier_network_hypervisor::vl1::Endpoint, - Option, - Option, - )>, - > { - None - } -} +// Default PathFilter implementations permit anything. +impl PathFilter for Handler {} impl InnerProtocol for Handler { fn handle_packet( @@ -133,11 +111,10 @@ impl InnerProtocol for Handler { message_id: u64, verb: u8, payload: &PacketBuffer, + mut cursor: usize, ) -> PacketHandlerResult { match verb { protocol::verbs::VL2_VERB_NETWORK_CONFIG_REQUEST => { - let mut cursor = 1; - let network_id = payload.read_u64(&mut cursor); if network_id.is_err() { return PacketHandlerResult::Error; @@ -242,7 +219,7 @@ impl InnerProtocol for Handler { _in_re_message_id: u64, _error_code: u8, _payload: &PacketBuffer, - _cursor: &mut usize, + _cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled } @@ -258,7 +235,7 @@ impl InnerProtocol for Handler { _in_re_verb: u8, _in_re_message_id: u64, _payload: &PacketBuffer, - _cursor: &mut usize, + _cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled } diff --git a/network-hypervisor/src/vl1/node.rs b/network-hypervisor/src/vl1/node.rs index 24fd52616..66970ea13 100644 --- a/network-hypervisor/src/vl1/node.rs +++ b/network-hypervisor/src/vl1/node.rs @@ -154,6 +154,7 @@ pub trait InnerProtocol: Sync + Send { message_id: u64, verb: u8, payload: &PacketBuffer, + cursor: usize, ) -> PacketHandlerResult; /// Handle errors, returning true if the error was recognized. @@ -169,7 +170,7 @@ pub trait InnerProtocol: Sync + Send { in_re_message_id: u64, error_code: u8, payload: &PacketBuffer, - cursor: &mut usize, + cursor: usize, ) -> PacketHandlerResult; /// Handle an OK, returing true if the OK was recognized. @@ -184,7 +185,7 @@ pub trait InnerProtocol: Sync + Send { in_re_verb: u8, in_re_message_id: u64, payload: &PacketBuffer, - cursor: &mut usize, + cursor: usize, ) -> PacketHandlerResult; /// Check if this node should respond to messages from a given peer. @@ -1092,6 +1093,7 @@ impl InnerProtocol for DummyInnerProtocol { _message_id: u64, _verb: u8, _payload: &PacketBuffer, + _cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled } @@ -1109,7 +1111,7 @@ impl InnerProtocol for DummyInnerProtocol { _in_re_message_id: u64, _error_code: u8, _payload: &PacketBuffer, - _cursor: &mut usize, + _cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled } @@ -1126,7 +1128,7 @@ impl InnerProtocol for DummyInnerProtocol { _in_re_verb: u8, _in_re_message_id: u64, _payload: &PacketBuffer, - _cursor: &mut usize, + _cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled } diff --git a/network-hypervisor/src/vl1/peer.rs b/network-hypervisor/src/vl1/peer.rs index 15bcf1c8b..1d1b4843a 100644 --- a/network-hypervisor/src/vl1/peer.rs +++ b/network-hypervisor/src/vl1/peer.rs @@ -585,6 +585,7 @@ impl Peer { message_id, verb, &payload, + 1, ), }; } @@ -682,7 +683,7 @@ impl Peer { in_re_message_id, error_header.error_code, payload, - &mut cursor, + cursor, ); } } @@ -782,7 +783,7 @@ impl Peer { ok_header.in_re_verb, in_re_message_id, payload, - &mut cursor, + cursor, ); } } diff --git a/network-hypervisor/src/vl2/switch.rs b/network-hypervisor/src/vl2/switch.rs index 9be3dbd10..52f6a2d94 100644 --- a/network-hypervisor/src/vl2/switch.rs +++ b/network-hypervisor/src/vl2/switch.rs @@ -10,6 +10,7 @@ pub trait SwitchInterface: Sync + Send {} pub struct Switch {} +#[allow(unused_variables)] impl InnerProtocol for Switch { fn handle_packet( &self, @@ -21,6 +22,7 @@ impl InnerProtocol for Switch { message_id: u64, verb: u8, payload: &PacketBuffer, + cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled } @@ -37,7 +39,7 @@ impl InnerProtocol for Switch { in_re_message_id: u64, error_code: u8, payload: &PacketBuffer, - cursor: &mut usize, + cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled } @@ -53,7 +55,7 @@ impl InnerProtocol for Switch { in_re_verb: u8, in_re_message_id: u64, payload: &PacketBuffer, - cursor: &mut usize, + cursor: usize, ) -> PacketHandlerResult { PacketHandlerResult::NotHandled }