On 2014/05/20 16:41, viq wrote:
> I encountered a strange problem when trying to communicate with net/ipcad:
>
> rsh localhost stats
> rsh: poll: Undefined error: 0
>
> Same thing on 5.1:
> rsh localhost stats
> connect to address ::1: Connection refused
> Trying 127.0.0.1...
> Interface vlan123: received 585816944, 5 m average 313 bytes/sec, 4
> pkts/sec, dropped 6078
> Flow entries made: 583
> Memory usage: 6% (65296 from 1048576)
> Free slots for rsh clients: 9
> IPCAD uptime is 159 days 7:04
> fw.example.com uptime is 159 days 7:04
>
> According to sthen@ this also works fine on 5.4 and he suspects
> breakage due to time_t changes. He also provided simple sample config
> http://pbot.rmdir.de/iFGRSOehzxnZ1flTJqum5Q because he's awesome like
> that ;)
>
> kern.version=OpenBSD 5.5 (GENERIC.MP) #0: Fri Apr 25 13:03:34 CEST 2014
>
> [email protected]:/binpatchng/work-binpatch55-amd64/src/sys/arch/amd64/compile/GENERIC.MP
> ipcad-3.7.3p1
> --
> viq
>
Note that ipcad listens on port 514 and provides *its own* cisco-ish
rshell interface that you connect to, this isn't about openbsd rshd.
Sample config inline at the bottom of this mail. (the pastebin above
was just meant for when I was talking about this on irc - it will expire).
The error is coming from /usr/src/usr.bin/rsh/rsh.c:243 and since
nothing changed here in many years, I'm wondering if there's anything
up with poll(2). (If it's a direct bug with rsh, well, that's "fixed"
a different way in -current)..
230 sigprocmask(SIG_SETMASK, omask, NULL);
231 pfd[1].fd = rfd2;
232 pfd[1].events = POLLIN;
233 pfd[0].fd = rem;
234 pfd[0].events = POLLIN;
235 do {
236 if (poll(pfd, 2, INFTIM) < 0) {
237 if (errno != EINTR)
238 err(1, "poll");
239 continue;
240 }
241 if ((pfd[0].revents & (POLLERR|POLLHUP|POLLNVAL)) ||
242 (pfd[1].revents & (POLLERR|POLLHUP|POLLNVAL)))
>> 243 err(1, "poll");
244 if (pfd[1].revents & POLLIN) {
245 errno = 0;
246 cc = read(rfd2, buf, sizeof buf);
247 if (cc <= 0) {
248 if (errno != EWOULDBLOCK)
249 pfd[1].revents = 0;
250 } else
251 (void)write(STDERR_FILENO, buf, cc);
252 }
253 if (pfd[0].revents & POLLIN) {
254 errno = 0;
255 cc = read(rem, buf, sizeof buf);
256 if (cc <= 0) {
257 if (errno != EWOULDBLOCK)
258 pfd[0].revents = 0;
259 } else
260 (void)write(STDOUT_FILENO, buf, cc);
261 }
262 } while ((pfd[0].revents & POLLIN) || (pfd[1].revents & POLLIN));
===
capture-ports disable;
interface em0;
rsh enable at 127.0.0.1;
rsh [email protected] admin;
rsh 127.0.0.1;
rsh ttl = 3;
rsh timeout = 30;
dumpfile = ipcad.dump;
chroot = /var/ipcad;
pidfile = ipcad.pid;
memory_limit = 1m;