diff mbox series

[1/3] tests/vm: Set UseDNS=no in the sshd configuration

Message ID 20240125194840.1564-2-iii@linux.ibm.com
State New
Headers show
Series make vm-build-freebsd fixes | expand

Commit Message

Ilya Leoshkevich Jan. 25, 2024, 7:48 p.m. UTC
make vm-build-freebsd sometimes fails with "Connection timed out during
banner exchange". The client strace shows:

    13:59:30 write(3, "SSH-2.0-OpenSSH_9.3\r\n", 21) = 21
    13:59:30 getpid()                       = 252655
    13:59:30 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
    13:59:32 read(3, "S", 1)                = 1
    13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}])
    13:59:32 read(3, "S", 1)                = 1
    13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}])
    13:59:32 read(3, "H", 1)                = 1

There is a 2s delay during connection, and ConnectTimeout is set to 1.
Raising it makes the issue go away, but we can do better. The server
truss shows:

    888: 27.811414714 socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0) = 5 (0x5)
    888: 27.811765030 connect(5,{ AF_INET 10.0.2.3:53 },16) = 0 (0x0)
    888: 27.812166941 sendto(5,"\^Z/\^A\0\0\^A\0\0\0\0\0\0\^A2"...,39,0,NULL,0) = 39 (0x27)
    888: 29.363970743 poll({ 5/POLLRDNORM },1,5000) = 1 (0x1)

So the delay is due to a DNS query. Disable DNS queries in the server
config.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tests/vm/basevm.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Huth Jan. 31, 2024, 12:51 p.m. UTC | #1
On 25/01/2024 20.48, Ilya Leoshkevich wrote:
> make vm-build-freebsd sometimes fails with "Connection timed out during
> banner exchange". The client strace shows:
> 
>      13:59:30 write(3, "SSH-2.0-OpenSSH_9.3\r\n", 21) = 21
>      13:59:30 getpid()                       = 252655
>      13:59:30 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
>      13:59:32 read(3, "S", 1)                = 1
>      13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}])
>      13:59:32 read(3, "S", 1)                = 1
>      13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}])
>      13:59:32 read(3, "H", 1)                = 1
> 
> There is a 2s delay during connection, and ConnectTimeout is set to 1.
> Raising it makes the issue go away, but we can do better. The server
> truss shows:
> 
>      888: 27.811414714 socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0) = 5 (0x5)
>      888: 27.811765030 connect(5,{ AF_INET 10.0.2.3:53 },16) = 0 (0x0)
>      888: 27.812166941 sendto(5,"\^Z/\^A\0\0\^A\0\0\0\0\0\0\^A2"...,39,0,NULL,0) = 39 (0x27)
>      888: 29.363970743 poll({ 5/POLLRDNORM },1,5000) = 1 (0x1)
> 
> So the delay is due to a DNS query. Disable DNS queries in the server
> config.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>   tests/vm/basevm.py | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 61725b83254..c0d62c08031 100644
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -423,6 +423,8 @@ def console_ssh_init(self, prompt, user, pw):
>       def console_sshd_config(self, prompt):
>           self.console_wait(prompt)
>           self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n")
> +        self.console_wait(prompt)
> +        self.console_send("echo 'UseDNS no' >> /etc/ssh/sshd_config\n")
>           for var in self.envvars:
>               self.console_wait(prompt)
>               self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config\n" % var)

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 61725b83254..c0d62c08031 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -423,6 +423,8 @@  def console_ssh_init(self, prompt, user, pw):
     def console_sshd_config(self, prompt):
         self.console_wait(prompt)
         self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n")
+        self.console_wait(prompt)
+        self.console_send("echo 'UseDNS no' >> /etc/ssh/sshd_config\n")
         for var in self.envvars:
             self.console_wait(prompt)
             self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config\n" % var)