Re: IP address, subnet query behaves wrong for /32

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: IP address, subnet query behaves wrong for /32
Дата
Msg-id 55C39320.4010905@aklaver.com
обсуждение исходный текст
Ответ на IP address, subnet query behaves wrong for /32  ("Richard RK. Klingler" <richard@klingler.net>)
Ответы Re: IP address, subnet query behaves wrong for /32  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-sql
On 08/06/2015 09:47 AM, Richard RK. Klingler wrote:
> Evenin'
>
> What I discovered just lately is a nice feature from pgsql that I can test
> if a specific IP address falls within a supplied subnet:
>
> myserver=# select inet '192.168.0.1' << '192.168.0.0/24'::inet as ip;
>
>   ip
>
> ----
>
>   t
>
> (1 row)
>
>
>
> But what I don't understand is why pgsql doesn't behave correctly when
> testing for a /32 subnet:
> (it works for /31 correctly though)
>
> myserver=# select inet '192.168.0.1' << '192.168.0.1/32'::inet as ip;
>
>   ip
>
> ----
>
>   f
>
>
>  From a network engineering point of view this should also return "true"
> and not false.

http://www.postgresql.org/docs/9.2/interactive/functions-net.html

"The operators <<, <<=, >>, and >>= test for subnet inclusion."

http://www.postgresql.org/docs/9.2/interactive/datatype-net-types.html#DATATYPE-INET

" If the netmask is 32 and the address is IPv4, then the value does not 
indicate a subnet, only a single host."

So it is behaving as documented.

>
> Has this been fixed in recent versions? I'm using 9.2.8 right now….
>
>
>
> thanks in advance
> richard
>
>


-- 
Adrian Klaver
adrian.klaver@aklaver.com



В списке pgsql-sql по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: IP address, subnet query behaves wrong for /32
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: IP address, subnet query behaves wrong for /32