Attached is the IP type test program supplied by Tom Ivar Helbekkmo. 
This can be used for testing, and for integration into the regression
tests.


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@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


--
--	A quick test of the IP address code
--
--	$Id: test.sql,v 1.2 1998/09/08 12:11:34 tih Exp $
--

-- temporary table:
create table addresses (address ipaddr);

-- sample data from two subnets:
insert into addresses values ('158.37.96.15');
insert into addresses values ('158.37.96.16');
insert into addresses values ('158.37.96.17');
insert into addresses values ('158.37.97.15');
insert into addresses values ('158.37.97.16');
insert into addresses values ('158.37.97.17');
insert into addresses values ('158.37.98.15');
insert into addresses values ('158.37.98.16');
insert into addresses values ('158.37.98.17');
insert into addresses values ('158.37.96.150');
insert into addresses values ('158.37.96.160');
insert into addresses values ('158.37.96.170');
insert into addresses values ('158.37.97.150');
insert into addresses values ('158.37.97.160');
insert into addresses values ('158.37.97.170');
insert into addresses values ('158.37.98.150');
insert into addresses values ('158.37.98.160');
insert into addresses values ('158.37.98.170');

-- show them all:
select * from addresses;

-- select the ones in subnet 96:
select * from addresses where address << '158.37.96.0/24';

-- select the ones not in subnet 96:
select * from addresses where not address << '158.37.96.0/24';

-- select the ones in subnet 97:
select * from addresses where address << '158.37.97.0/24';

-- select the ones not in subnet 97:
select * from addresses where not address << '158.37.97.0/24';

-- select the ones in subnet 96 or 97, sorted:
select * from addresses where address << '158.37.96.0/23'
	order by address;

-- now some networks:
create table networks (network ipaddr);

-- now the subnets mentioned above:
insert into networks values ('158.37.96.0/24');
insert into networks values ('158.37.97.0/24');
insert into networks values ('158.37.98.0/24');

-- select matching pairs of addresses and containing nets:
select address, network from addresses, networks
	where address << network;

-- tidy up:
drop table addresses;
drop table networks;

--
--	eof
--
Sat, 3 Oct 1998 21:02:21 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
IP test program
> Attached is the IP type test program supplied by Tom Ivar Helbekkmo.
> This can be used for testing, and for integration into the regression
> tests.

I'll look at it if no one else picks it up. Just remember to cut me some
slack when I'm running up against the release deadline :)

                    - Tom

Sun, 04 Oct 1998 04:18:25 +0000
"Thomas G. Lockhart" <lockhart@alumni.caltech.edu>
Re: IP test program