Re: notion of a local address [was: Re: ioctl SIOCGIFNETMASK: ip alias bug 2.4.9 and 2.2.19]

Andrey Savochkin (saw@saw.sw.com.sg)
Thu, 6 Sep 2001 21:23:03 +0400


On Thu, Sep 06, 2001 at 12:50:51PM -0400, Wietse Venema wrote:
> Andrey Savochkin:
> > > I welcome suggestions, maybe even code fragments, that will allow
> > > an MTA to correctly recognize user@[ip.address] as local, as required
> > > by the SMTP RFC.
> >
> > The question was which ip.address in user@[ip.address] should be treated as
> > local.
> > My comment was that the only reasonable solution on Linux is to treat this
> > way addresses explicitly specified in the configuration file.
> > Postfix may show its guess at the installation time.
>
> That is not practical. Surely there is an API to find out if an IP
> address connects to the machine itself. If every UNIX system on
> this planet can do it, then surely Linux can do it.

Let me correct you: you need to recognize not addresses that result in
connecting to the _machine_ itself, but connecting to the same _MTA_.

Let's put it this way:
trying to find those "local" IP addresses automatically,
1. you have high rate of false negatives:
checking networking configuration by SIOCGIFCONF, you misses almost entire
127.0.0.0/8 network, and all routes in `local' table;
2. you have potentially high rate of false positives:
you won't work in any reasonable way if someone puts more than one MTA on
a single system, even if he sets dedicated IP addresses for them;
proper recognition of local mail addresses is absolutely necessary for
mail traffic inside one system but across several MTAs.

You cannot always guess right automatically.
You can walk routing tables (looking for local routes, routes without a
gateway or whatever else) and get much better approximation.
But you can never have it right in 100% cases.

My suggestion is just not to try to be too smart.
You can't know the right configuration for everybody.
Make a right guess in 90% cases.
Always ask administrator what _he_ really wants.

Andrey
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/