From f3d7df6c6b103bd096bfc455e88d79c8f6c3195b Mon Sep 17 00:00:00 2001 From: Philip Hazel Date: Fri, 17 Mar 2006 16:51:45 +0000 Subject: [PATCH] Fix address sorting untidiness for the test suite. --- doc/doc-txt/ChangeLog | 5 ++++- src/src/host.c | 16 +++++++++------- test/confs/0366 | 1 + test/confs/0455 | 1 + test/confs/0499 | 1 + test/runtest | 6 ++++-- test/stderr/0499 | 1 - test/stdout/0467 | 2 +- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index c70050d36..ce3d142e7 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.333 2006/03/17 09:39:00 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.334 2006/03/17 16:51:45 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -323,6 +323,9 @@ PH/65 Added configuration files for NetBSD3. PH/66 Updated OS/Makefile-HP-UX for gcc 4.1.0 with HP-UX 11. +PH/67 Fixed minor infelicity in the sorting of addresses to ensure that IPv6 + is preferred over IPv4. + Exim version 4.60 ----------------- diff --git a/src/src/host.c b/src/src/host.c index 07d28395e..01191f454 100644 --- a/src/src/host.c +++ b/src/src/host.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/host.c,v 1.22 2006/02/16 10:05:33 ph10 Exp $ */ +/* $Cambridge: exim/src/src/host.c,v 1.23 2006/03/17 16:51:45 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -2876,17 +2876,19 @@ single MX preference value, IPv6 addresses come first. This can separate the addresses of a multihomed host, but that should not matter. */ #if HAVE_IPV6 -if (h != last) +if (h != last && !disable_ipv6) { for (h = host; h != last; h = h->next) { host_item temp; host_item *next = h->next; - if (h->mx != next->mx || /* If next is different MX value */ - (h->sort_key % 1000) < 500 || /* OR this one is IPv6 */ - (next->sort_key % 1000) >= 500) /* OR next is IPv4 */ - continue; /* move on to next */ - temp = *h; + if (h->mx != next->mx || /* If next is different MX */ + h->address == NULL || /* OR this one is unset */ + Ustrchr(h->address, ':') != NULL || /* OR this one is IPv6 */ + (next->address != NULL && + Ustrchr(next->address, ':') == NULL)) /* OR next is IPv4 */ + continue; /* move on to next */ + temp = *h; /* otherwise, swap */ temp.next = next->next; *h = *next; h->next = next; diff --git a/test/confs/0366 b/test/confs/0366 index 62fdda1cb..930b6467d 100644 --- a/test/confs/0366 +++ b/test/confs/0366 @@ -14,6 +14,7 @@ gecos_name = CALLER_NAME ignore_bounce_errors_after = 0s qualify_domain = test.ex +disable_ipv6 # ----- Routers ----- diff --git a/test/confs/0455 b/test/confs/0455 index eb6982fd6..14e4161f2 100644 --- a/test/confs/0455 +++ b/test/confs/0455 @@ -16,6 +16,7 @@ acl_not_smtp = non ignore_bounce_errors_after = 0s qualify_domain = test.ex +disable_ipv6 # ----- ACLs ----- diff --git a/test/confs/0499 b/test/confs/0499 index 18364b7cf..ada9e8aa5 100644 --- a/test/confs/0499 +++ b/test/confs/0499 @@ -12,6 +12,7 @@ gecos_name = CALLER_NAME # ----- Main settings ----- domainlist anymx = @mx_any +disable_ipv6 # ----- Routers ----- diff --git a/test/runtest b/test/runtest index 699030bda..76cc4b99b 100755 --- a/test/runtest +++ b/test/runtest @@ -1,6 +1,6 @@ #! /usr/bin/perl -w -# $Cambridge: exim/test/runtest,v 1.5 2006/02/16 14:34:42 ph10 Exp $ +# $Cambridge: exim/test/runtest,v 1.6 2006/03/17 16:51:45 ph10 Exp $ ############################################################################### # This is the controlling script for the "new" test suite for Exim. It should # @@ -648,9 +648,11 @@ while() if ($is_stdout) { - # Skip translate_ip_address in -bP output because it ain't always there + # Skip translate_ip_address and use_classresources in -bP output because + # they aren't always there. next if /translate_ip_address =/; + next if /use_classresources/; # In certain filter tests, remove initial filter lines because they just # clog up by repetition. diff --git a/test/stderr/0499 b/test/stderr/0499 index 47a8229c7..13b4d4f0f 100644 --- a/test/stderr/0499 +++ b/test/stderr/0499 @@ -27,7 +27,6 @@ mxt1.test.ex in "+anymx"? yes (matched "+anymx") checking "condition" DNS lookup of mxt1.test.ex (MX) using fakens DNS lookup of mxt1.test.ex (MX) succeeded -DNS lookup of eximtesthost.test.ex-AAAA: using cached value DNS_NODATA DNS lookup of eximtesthost.test.ex (A) using fakens DNS lookup of eximtesthost.test.ex (A) succeeded local host has lowest MX diff --git a/test/stdout/0467 b/test/stdout/0467 index 60ffdae03..d9c20263c 100644 --- a/test/stdout/0467 +++ b/test/stdout/0467 @@ -5,8 +5,8 @@ x@srv01.test.ex host ten-1.test.ex [V4NET.0.0.1] MX=0 port=25 x@mx246.test.ex router = r1, transport = t1 - host v6.test.ex [unknown] MX=10 ** unusable ** host ten-1.test.ex [V4NET.0.0.1] MX=10 + host v6.test.ex [unknown] MX=10 ** unusable ** x@srv02.test.ex router = r1, transport = t1 host ten-1.test.ex [V4NET.0.0.1] MX=1 port=99 -- 2.25.1