New version now at http://www.pccc.com/downloads/MIMEDefang/contrib/check_primary_mx_stub.pl which takes into account much more of the cases you stated. Thanks for the feedback and I've added some comments inline below.
> Comment: not sufficiently general I've added a function called invalid_mx to make this more 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 I think I can avoid this with the use of regexp's. > Intranets only: > 10/8 > 172.16/12 > 192.168/16 I disagree with bouncing these but I've put the code in to allow for the user to decide. > 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 Implemented all of these except I did not go with the temporary ones. > 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. I agree. The problem is ensuring they are all bad and they stay bad. I chose the ones I felt were just absolutely unlikely to change. Regards, KAM _______________________________________________ Visit http://www.mimedefang.org and http://www.roaringpenguin.com MIMEDefang mailing list [email protected] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

