Configuring multiple subnets in readers.conf...

Russ Allbery rra at stanford.edu
Wed Mar 18 20:51:37 UTC 2009


Grant Taylor <gtaylor at riverviewtech.net> writes:
> On 03/18/09 13:42, Julien ÉLIE wrote:

>> What pattern did you try with the first form?
>
> I was using /19, /20, /21, /22, /23, /24 for various different things.
>
> (I can build a sanitized list if you would like me to.)

It certainly should work, and it doesn't care about traditional class
boundaries.  The code (for 2.4) is in MatchHost in nnrpd/perm.c:

                if (inet_aton(ip, &ia) && inet_aton(pat, &net)) {
                    if (strchr(p+1, '.') == (char *)NULL) {
                        /* string following / is a masklength */
                        mask = atoi(p+1);
                        for (bits = c = 0; c < mask && c < 32; c++)
                            bits |= (1 << (31 - c));
                        mask = htonl(bits);
                    } else {    /* or it may be a dotted quad bitmask */
                        if (inet_aton(p+1, &tmp))
                            mask = tmp.s_addr;
                        else    /* otherwise skip it */
                            continue;
                    }
                    if ((ia.s_addr & mask) == (net.s_addr & mask))
                        ret = true;

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.



More information about the inn-workers mailing list