[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BIND 9.x (/dev/random question)



All components of BIND9 that expect to use random numbers will break.

The '4' argument to fcntl() below is O_NONBLOCK, i.e non-blocking I/O,
which is not "handled" by the random device.

In the current (patched) source, it looks like this:
(file is /usr/src/sys/dev/rnd.c)

int
randomioctl(dev, cmd, data, flag, p)
        dev_t   dev;
        u_long  cmd;
        caddr_t data;
        int     flag;
        struct proc *p;
{
        int     s, ret = 0;
        u_int   cnt;

        add_timer_randomness((u_long)p ^ (u_long)data ^ cmd);

        switch (cmd) {
        case FIOASYNC:
                /* rnd has no async flag in softc so this is really a
no-op. */
                break;

        case FIONBIO:
                /* Handled in the upper FS layer. */
                break;

	case RNDGETENTCNT:
 (.. etc)

The two FIO* cases, actually only the latter, are needed for the
O_NONBLOCK to be accepted.

I don't have access to the source repository right now, otherwise I would
have attached a proper diff. If you have the kernel sources for your 2.6
machine, simply add FIOASYNC and FIONBIO as above to your copy of
/usr/src/sys/dev/rnd.c and then recompile your kernel. The bind9 programs
should work then.

//Håkan

On Tue, 30 Jan 2001, Tor Houghton wrote:

> Hello,
>
> I've been reading the docs for BIND 9.1.0, and it says the following
> about /dev/random:
>
>   On FreeBSD systems, the server logs error messages like "fcntl(8, F_SETFL, 4):
>   Inappropriate ioctl for device". This is due to a bug in the FreeBSD /dev/random
>   device. The bug has been reported to the FreeBSD maintainers. Versions of
>   OpenBSD prior to 2.8 have a similar problem.
>
> I am still running 2.6 on some systems. What breaks with this "bug"? Can I fix
> /dev/random without upgrading to 2.8?
>
> Best regards,
>
> Tor
>
>
>

--
Håkan Olsson <ho@crt.se>        (+46) 708 437 337     Carlstedt Research
Unix, Networking, Security      (+46) 31 701 4264        & Technology AB