cloudflare / boringtun

Userspace WireGuard® Implementation in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DEBG HANDSHAKE(REKEY_TIMEOUT) running tests

marcbrevoort-cyberhive opened this issue · comments

Running test device::integration_tests::tests::test_wg_start_ipv4 never completes (same with several others but this one is representative to illustrate the issue), logging multiple
DEBG HANDSHAKE(REKEY_TIMEOUT)
messages - what might be causing this?

Hi, do you have docker running? Those tests require docker and sudo.

Yes I do - after updating the box images things seemed to pass though the REKEY_TIMEOUT still occurs.
This error seems to occur in tandem with

No session (yet), queue packet and initiate handshake

Could this be a legitimate error in a docker context?
The code already contains commit b9bb374

Ah, this seems to be related

static NEXT_PORT: AtomicUsize = AtomicUsize::new(61111); // Use ports starting with 61111, hoping we don't run into a taken port 

On Linux I believe the key there is setting reuse to true, for instance

        let listen_addr = SocketAddr::new(listen_addr, local_port);
        let udp_socket = Socket::new(socket_domain, Type::dgram(), Some(Protocol::udp())).unwrap();
        let _reuse = udp_socket.set_reuse_address(true);
        udp_socket
            .bind(&Socket2Addr::from(listen_addr))
            .expect("Couldn't bind port");

Ah, this seems to be due to stale boxes being left behind.

docker container ls|grep vkrasnov|awk '\''{print }'\''|xargs docker container stop

prior to a test run solves that.