Download raw body.
syspatch -c : call ftp(1) with timeout
On Tue, 24 Feb 2026 07:35:41 +0100, Klemens Nanni <kn@openbsd.org> wrote: > > 23.02.2026 00:44, Kirill A. Korinsky пишет: > > On Sat, 21 Feb 2026 18:30:14 +0100, > > Klemens Nanni <kn@openbsd.org> wrote: > >> > >> 21.02.2026 15:00, Antoine Jacoutot пишет: > >>> On Sat, Feb 21, 2026 at 08:48:58AM +0100, Matthieu Herrb wrote: > >>>> Hi, > >>>> > >>>> I'm using syspatch -c in the monitoring system for a number of OpenBSD > >>>> machines at work. > >>>> From time to time the host listed in /etc/installurl becomes > >>>> unavailable for hours. (I've seen that both with a dedicated mirror or > >>>> with the cdn) causing monitoring errors because the agent (check_mk) > >>>> is stuck. > >>>> > >>>> Adding a timeout option to the ftp(1) command run by syspatch -c is > >>>> enough for me to not have the OpenBSD machines appear unresponsiv in > >>>> the monitoring system. > >>>> > >>>> Would something like this make sense ? > >>> > >>> I think it does. > >>> But why not add it to some of the other ftp(1) calls? > >> > >> ... and sysupgrade(8) and bsd.port.mk(5) FETCH_CMD as well, I guess. > >> > >> Wouldn't it make more sense to provide a more sensible default in ftp(1) > >> so it doesn't wait forever? -w0 could do that if you really wanted, no? > >> > > > > ...which may wait forever if you run pkg_add via something like LTE modem, > > and it decided to "renew" it's public IP. > > -w seconds > Wait for seconds for the remote server to connect before giving > up. > > This should be the equivalent to curl(1)'s --connect-timeout, although I > did not see which default value they provide. > > Ours is zero, i.e. no timeout; -w goes through strtonum(0, 200), so 3m20s > is the maximum value. I picked 30s as new default just to show a diff. > > See util.c:timed_connect(). > > Works great for me. Extra testing done like this: > > $ time timeout 40s ftp -4 -o- http://resolves-but-drops-packets > Trying 192.0.2.1... > 0m40.02s real 0m00.02s user 0m00.03s system > > $ time ./obj/ftp -4 -o- http://resolves-but-drops-packets > Trying 192.0.2.1... > ftp: connect: Operation timed out > 0m30.04s real 0m00.01s user 0m00.02s system > > Thoughts? > But issue is not only connect timeout, but when IP address is changed when it downloading something. As far as I understand code, we haven't got non connect timeout at all. > Index: main.c > =================================================================== > RCS file: /cvs/src/usr.bin/ftp/main.c,v > diff -u -p -r1.146 main.c > --- main.c 23 Dec 2023 23:03:00 -0000 1.146 > +++ main.c 24 Feb 2026 06:04:19 -0000 > @@ -188,7 +188,7 @@ char macbuf[4096]; > > FILE *ttyout; > > -int connect_timeout; > +int connect_timeout = 30; > > #ifndef SMALL > /* enable using server timestamps by default */ > -- wbr, Kirill
syspatch -c : call ftp(1) with timeout