Claudio Jeker(clau...@cvs.openbsd.org) on 2022.01.23 09:27:39 +0100: > On Sun, Jan 23, 2022 at 08:52:56AM +0100, Anton Lindqvist wrote: > > On Thu, Jan 20, 2022 at 11:06:20AM -0700, Claudio Jeker wrote: > > > CVSROOT: /cvs > > > Module name: src > > > Changes by: clau...@cvs.openbsd.org 2022/01/20 11:06:20 > > > > > > Modified files: > > > usr.sbin/bgpd : bgpd.c rde.c rtr.c session.c > > > > > > Log message: > > > Make sure that all poll loops properly restart the poll loop on EINTR. > > > Also either fail hard or restart after other errors. In anycase do not > > > look at pollfds after an error. > > > OK benno@ > > > > This commit broke the following regress test: > > > > > usr.sbin/bgpd: > > Exit: 1 > > Duration: 00:01:53 > > Log: 230-usr.sbin-bgpd.log > > > > ==== mrt ==== > > doas -n ksh /home/src/regress/usr.sbin/bgpd/integrationtests/mrt.sh > > /usr/sbin/bgpd /home/src/regress/usr.sbin/bgpd/integrationtests 11 > > check if rdomains are busy > > + echo setup > > setup > > + ifconfig mpe11 rdomain 11 mplslabel 42 > > + ifconfig lo11 inet 127.0.0.1/8 > > + route -T 11 exec /usr/sbin/bgpd -v -f > > /home/src/regress/usr.sbin/bgpd/integrationtests/bgpd.mrt.conf > > + sleep 2 > > + pkill -USR1 -T 11 -u 0 bgpd > > + sleep 2 > > + echo test table-v2 > > test table-v2 > > + bgpctl show mrt detail file mrt-table-v2.mrt > > + tee mrt-table-v2.out > > + grep -v Last update: > > + diff -u /home/src/regress/usr.sbin/bgpd/integrationtests/mrt-table-v2.ok > > mrt-table-v2.out > > --- /home/src/regress/usr.sbin/bgpd/integrationtests/mrt-table-v2.ok > > Fri Jun 28 07:48:07 2019 > > +++ mrt-table-v2.out Sun Jan 23 05:51:20 2022 > > Fun. So the problem is that the signal flags are checked last in the poll > loop. So instead of continue the code needs to jump down to the two signal > checks for the EINTR case. > > With this diff the regress test works again.
yes, ok benno@ its a bit sad that this is so non obvious, including the fix :/ > -- > :wq Claudio > > Index: bgpd.c > =================================================================== > RCS file: /cvs/src/usr.sbin/bgpd/bgpd.c,v > retrieving revision 1.240 > diff -u -p -r1.240 bgpd.c > --- bgpd.c 20 Jan 2022 18:06:20 -0000 1.240 > +++ bgpd.c 23 Jan 2022 08:25:08 -0000 > @@ -350,7 +350,7 @@ BROKEN if (pledge("stdio rpath wpath cpa > log_warn("poll error"); > quit = 1; > } > - continue; > + goto next_loop; > } > > if (handle_pollfd(&pfd[PFD_PIPE_SESSION], ibuf_se) == -1) { > @@ -403,6 +403,7 @@ BROKEN if (pledge("stdio rpath wpath cpa > if (pfd[i].revents != 0) > bgpd_rtr_connect_done(pfd[i].fd, conf); > > + next_loop: > if (reconfig) { > u_int error; > >