Simultanous connections do not work
aramperes opened this issue · 0 comments
An oversight of mine. Since IP packets are broadcasted to all virtual interfaces using tokio::sync::broadcast
, any virtual interface that doesn't match (which is the case when you have more than 1 active connection) will send a RST
TCP segment.
I think WireGuardTunnel
will have to keep a table of (SocketAddr
-> tokio::sync::mpsc::Sender<Vec<u8>>
) for destination addresses in order to only dispatch the decapsulated IP packets to the right interface. This also has the advantage of removing the drain task, reducing memory usage from the packet being cloned to all broadcast channels, etc.
I will also replace the manual crafting of RST
segments for unresolvable destinations with a "sink virtual interface", so that smoltcp can craft those segments itself.