mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 02:09:06 +00:00
fix peer establish direct conn with subnet proxy to one of local interface (#1782)
* fix peer establish direct conn with subnet proxy to one of local interface * fix peer mgr ref loop
This commit is contained in:
@@ -192,8 +192,10 @@ impl TcpProxyForKcpSrcTrait for TcpProxyForQUICSrc {
|
||||
}
|
||||
|
||||
async fn check_dst_allow_kcp_input(&self, dst_ip: &Ipv4Addr) -> bool {
|
||||
let peer_map: Arc<crate::peers::peer_map::PeerMap> =
|
||||
self.0.get_peer_manager().get_peer_map();
|
||||
let Some(peer_manager) = self.0.get_peer_manager() else {
|
||||
return false;
|
||||
};
|
||||
let peer_map: Arc<crate::peers::peer_map::PeerMap> = peer_manager.get_peer_map();
|
||||
let Some(dst_peer_id) = peer_map.get_peer_id_by_ipv4(dst_ip).await else {
|
||||
return false;
|
||||
};
|
||||
@@ -414,17 +416,16 @@ impl QUICProxyDst {
|
||||
route.get_peer_groups_by_ipv4(&dst_ip)
|
||||
);
|
||||
|
||||
let send_to_self = Some(*dst_socket.ip()) == ctx.get_ipv4().map(|ip| ip.address());
|
||||
if ctx.should_deny_proxy(&dst_socket.into(), false) {
|
||||
return Err(anyhow::anyhow!(
|
||||
"dst socket {:?} is in running listeners, ignore it",
|
||||
dst_socket
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
||||
let send_to_self = ctx.is_ip_local_virtual_ip(&dst_ip.into());
|
||||
if send_to_self && ctx.no_tun() {
|
||||
if ctx.is_port_in_running_listeners(dst_socket.port(), false)
|
||||
&& ctx.is_ip_in_same_network(&src_ip)
|
||||
{
|
||||
return Err(anyhow::anyhow!(
|
||||
"dst socket {:?} is in running listeners, ignore it",
|
||||
dst_socket
|
||||
)
|
||||
.into());
|
||||
}
|
||||
dst_socket = format!("127.0.0.1:{}", dst_socket.port()).parse().unwrap();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user