Re: pg_hba.conf confusion - Mailing list pgsql-bugs

From Bruce Momjian
Subject Re: pg_hba.conf confusion
Date
Msg-id 200206212011.g5LKBUP14924@candle.pha.pa.us
Whole thread Raw
In response to Re: pg_hba.conf confusion  ("David M. Kaplan" <dmkaplan@ucdavis.edu>)
List pgsql-bugs
David M. Kaplan wrote:
> Thanks, that did fix that problem.  Now I have another one.  The line:
>
> host    all    192.168.1.2    255.255.255.128    password
>
> matches all ip addresses of the form 192.168.1.x.  If I change the mask
> to 255.255.255.255 it no longer matches all addresses.  Although this
> fixes the problem, it seems strange to me that it works this way.
>  Basically, if mask is something other than 255.255.255.255, you might
> as well put 0's in your id address.  This doesnt seem to be how subnet
> masks normally work and it seems redundant to me.
>
> Is there something I don't understand?

A netmask of  255.255.255.128 means ignore the bottom seven bits of the
address.  You are right they may as well be zero so in the case above
192.168.1.2 and 192.168.1.0 would behave the same.  Is there something
else you wanted it to do?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: regex (not) matching null string
Next
From: Tom Lane
Date:
Subject: Re: I have problem with pg_dump in PostgreSQL 7.1.2