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/