[Mimedefang] MX -> 127.0.0.1

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Mon Sep 12 15:57:30 EDT 2005


KAM wrote:
> Thanks for the extra test cases.  Assuming they should all fail,
> here's my new test stub.  Looks good to me.  Review and comment
> appreciated. 
> 
> http://www.pccc.com/downloads/MIMEDefang/contrib/check_primary_mx_stub.pl

Comment: not sufficiently general

Failing 127.0.0.1 and 0.0.0.0 is a good start... but there's all kinds of invalid IP assignments that are being missed.  How often are they used?  I don't know.

I believe there are some generic perl functions written along the lines of

sub ip_in_subnet($$)
{
	my $ip = shift;
	my $subnet = shift;

	# return true if $ip is in $subnet
}

which have been posted to the list.

Bad IP blocks:
See http://www.iana.org/assignments/ipv4-address-space and others

Intranets only:
10/8
172.16/12
192.168/16

DHCP auto-discover:
169.254/16

Localhost:
127/8

Multicast:
224/8 through 239/8

IANA reserved:
0/8 # probably forever
# various others probably temporary
255/8 # probably forever

Checking the IP against all of these "bad" subnets is probably cheap computationally, as the expensive part is getting the DNS lookup in the first place.

-- 
Matthew.van.Eerde (at) hbinc.com               805.964.4554 x902
Hispanic Business Inc./HireDiversity.com       Software Engineer




More information about the MIMEDefang mailing list