1*7c478bd9Sstevel@tonic-gatedivert(-1)
2*7c478bd9Sstevel@tonic-gate#
3*7c478bd9Sstevel@tonic-gate# Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
4*7c478bd9Sstevel@tonic-gate#	All rights reserved.
5*7c478bd9Sstevel@tonic-gate# Copyright (c) 1983 Eric P. Allman.  All rights reserved.
6*7c478bd9Sstevel@tonic-gate# Copyright (c) 1988, 1993
7*7c478bd9Sstevel@tonic-gate#	The Regents of the University of California.  All rights reserved.
8*7c478bd9Sstevel@tonic-gate#
9*7c478bd9Sstevel@tonic-gate# By using this file, you agree to the terms and conditions set
10*7c478bd9Sstevel@tonic-gate# forth in the LICENSE file which can be found at the top level of
11*7c478bd9Sstevel@tonic-gate# the sendmail distribution.
12*7c478bd9Sstevel@tonic-gate#
13*7c478bd9Sstevel@tonic-gate#ident	"%Z%%M%	%I%	%E% SMI"
14*7c478bd9Sstevel@tonic-gate#
15*7c478bd9Sstevel@tonic-gate
16*7c478bd9Sstevel@tonic-gatedivert(0)
17*7c478bd9Sstevel@tonic-gateVERSIONID(`$Id: bestmx_is_local.m4,v 8.26 2000/09/17 17:30:00 gshapiro Exp $')
18*7c478bd9Sstevel@tonic-gatedivert(-1)
19*7c478bd9Sstevel@tonic-gate
20*7c478bd9Sstevel@tonic-gatedefine(`_BESTMX_IS_LOCAL_', _ARG_)
21*7c478bd9Sstevel@tonic-gate
22*7c478bd9Sstevel@tonic-gateLOCAL_CONFIG
23*7c478bd9Sstevel@tonic-gate# turn on bestMX lookup table
24*7c478bd9Sstevel@tonic-gateKbestmx bestmx
25*7c478bd9Sstevel@tonic-gateifelse(defn(`_ARG_'), `', `dnl',`
26*7c478bd9Sstevel@tonic-gate# limit bestmx to these domains
27*7c478bd9Sstevel@tonic-gateCB`'_ARG_')
28*7c478bd9Sstevel@tonic-gate
29*7c478bd9Sstevel@tonic-gateLOCAL_NET_CONFIG
30*7c478bd9Sstevel@tonic-gate
31*7c478bd9Sstevel@tonic-gate# If we are the best MX for a site, then we want to accept
32*7c478bd9Sstevel@tonic-gate# its mail as local.  We assume we've already weeded out mail to
33*7c478bd9Sstevel@tonic-gate# UUCP sites which are connected to us, which should also have
34*7c478bd9Sstevel@tonic-gate# listed us as their best MX.
35*7c478bd9Sstevel@tonic-gate#
36*7c478bd9Sstevel@tonic-gate# Warning: this may generate a lot of extra DNS traffic -- a
37*7c478bd9Sstevel@tonic-gate# lower cost method is to list all the expected best MX hosts
38*7c478bd9Sstevel@tonic-gate# in $=w.  This should be fine (and easier to administer) for
39*7c478bd9Sstevel@tonic-gate# low to medium traffic hosts.  If you use the limited bestmx
40*7c478bd9Sstevel@tonic-gate# by passing in a set of possible domains it will improve things.
41*7c478bd9Sstevel@tonic-gate
42*7c478bd9Sstevel@tonic-gateifelse(defn(`_ARG_'), `', `dnl
43*7c478bd9Sstevel@tonic-gate# unlimited bestmx
44*7c478bd9Sstevel@tonic-gateR$* < @ $* > $*			$: $1 < @ $2 @@ $(bestmx $2 $) > $3',
45*7c478bd9Sstevel@tonic-gate`dnl
46*7c478bd9Sstevel@tonic-gate# limit bestmx to $=B
47*7c478bd9Sstevel@tonic-gateR$* < @ $* $=B . > $*		$: $1 < @ $2 $3 . @@ $(bestmx $2 $3 . $) > $4')
48*7c478bd9Sstevel@tonic-gateR$* $=O $* < @ $* @@ $=w . > $*	$@ $>Recurse $1 $2 $3
49*7c478bd9Sstevel@tonic-gateR< @ $* @@ $=w . > : $*		$@ $>Recurse $3
50*7c478bd9Sstevel@tonic-gatednl we cannot use _LOCAL_ here since it is defined too late
51*7c478bd9Sstevel@tonic-gateR$* < @ $* @@ $=w . > $*	$@ $>CanonLocal < $1 >
52*7c478bd9Sstevel@tonic-gateR$* < @ $* @@ $* > $*		$: $1 < @ $2 > $4
53