9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] simple program
@ 2011-01-13  5:54 erik quanstrom
  0 siblings, 0 replies; only message in thread
From: erik quanstrom @ 2011-01-13  5:54 UTC (permalink / raw)
  To: 9fans

i have a problem with the internal caching
dns getting confused and thinking that google's
ip is something wierd like 192.168.0.1 or
205.185.192.1.  since the list of ip addresses
google uses for google.com is fairly well-known,
it's easy enough to look and see if dns isn't nuts.

the problem is regular expressions just suck at
cidrs.  so i wrote contrib quanstro/cidr.  here's
an example which uses the slightly strange -r flag
which reverses the meaning of pattern and file
(and changes | to &).

gcidr = (
	# only blocks that can map to google's a records
	72.14.192.0/18
	74.125.0.0/16
	209.85.128.0/17
	216.239.32.0/19
)

fn getips{
	ndb/dnsquery $* | sed 's/.*[ 	]//g'
}

fn google{
	badgoogle=()
	if(! ip/cidr -rf <{getips google.com} <{echo $gcidr})
		badgoogle=1
	if(ip/cidr -f /lib/badcidr <{getips 9fans.net} )
		badgoogle=1
}

see http://www.quanstro.net/magic/man2html/1/cidr

- erik



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-13  5:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-13  5:54 [9fans] simple program erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).