]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REGTEST: relax the IPv6 address format checks in converters_ipmask_concat_strcmp_fiel...
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Apr 2019 06:47:15 +0000 (08:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 25 Apr 2019 06:47:15 +0000 (08:47 +0200)
In Travis build https://travis-ci.com/haproxy/haproxy/jobs/195477767 we
can see that OSX tends to pad zeroes at a different position than Linux
in compact IPv6 addresses, resulting in a failure in the checks which
were developped on Linux. This patch uses [0:]* in holes and [0:]+ at the
end of addresses to allow the different variants. It will unfortunately
also accept impossible addresses but there is no reason that we have to
care about for such crap to be emitted.

reg-tests/http-rules/converters_ipmask_concat_strcmp_field_word.vtc

index 1f150526382589efc9eb8fb5c0272e67eb5290dc..7149b183e562468479f6d8c508de4b4c5bebea3f 100644 (file)
@@ -13,18 +13,18 @@ server s1 {
    expect req.http.srcmask2 == "192.168.0.0"
    expect req.http.srcmask3 == "192.0.0.0"
 
-   expect req.http.test1mask128 == "2001:db8::1"
-   expect req.http.test2mask64 == "2001:db8::"
-   expect req.http.test2mask128 == "2001:db8::bad:c0f:ffff"
-   expect req.http.test2mask120 == "2001:db8::bad:c0f:ff00"
-   expect req.http.test2maskff00 == "2001:db8::bad:c0f:ff00"
-   expect req.http.test2maskfee0 == "2001:db8::bad:c0f:fee0"
-
-   expect req.http.test3mask64 == "2001:db8:c001:c01a::"
-   expect req.http.test3mask64v2 == "2001:db8:c001:c01a::"
-   expect req.http.test3mask64v3 == "2001:db8:c001:c01a::"
-   expect req.http.test3maskff == "2001:db8:c001:c01a:0:ffff:10:0"
-   expect req.http.test3maskv2 == "2001:db8:c001:c01a:c001:c001::"
+   expect req.http.test1mask128 ~ "2001:db8:[0:]*:1"
+   expect req.http.test2mask64 ~ "2001:db8:[0:]+"
+   expect req.http.test2mask128 ~ "2001:db8:[0:]*:bad:c0f:ffff"
+   expect req.http.test2mask120 ~ "2001:db8:[0:]*:bad:c0f:ff00"
+   expect req.http.test2maskff00 ~ "2001:db8:[0:]*:bad:c0f:ff00"
+   expect req.http.test2maskfee0 ~ "2001:db8:[0:]*:bad:c0f:fee0"
+
+   expect req.http.test3mask64 ~ "2001:db8:c001:c01a:[0:]+"
+   expect req.http.test3mask64v2 ~ "2001:db8:c001:c01a:[0:]+"
+   expect req.http.test3mask64v3 ~ "2001:db8:c001:c01a:[0:]+"
+   expect req.http.test3maskff ~ "2001:db8:c001:c01a:[0:]*:ffff:10:[0:]+"
+   expect req.http.test3maskv2 ~ "2001:db8:c001:c01a:c001:c001:[0:]+"
 
    expect req.http.test4mask32 == "192.168.1.101"
 
@@ -204,7 +204,7 @@ client c1 -connect ${h1_fe1_sock} -proxy2 "192.168.1.101:1234 127.0.0.1:2345" {
 # cli show be1 stick table
 haproxy h1 -cli {
     send "show table be1"
-    expect ~ "^# table: be1, type: ipv6, size:20, used:3\\n0x[a-f0-9]+: key=::ffff:192\\.168\\.1\\.0 use=0 exp=[[:digit:]]+ gpc0=0 conn_cnt=1\\n0x[a-f0-9]+: key=::ffff:192\\.168\\.1\\.101 use=0 exp=[[:digit:]]+ gpc0=0 conn_cnt=1\\n0x[a-f0-9]+: key=2001:db8:c001:c01a:: use=0 exp=[[:digit:]]+ gpc0=0 conn_cnt=1\\n"
+    expect ~ "^# table: be1, type: ipv6, size:20, used:3\\n0x[a-f0-9]+: key=::ffff:192\\.168\\.1\\.0 use=0 exp=[[:digit:]]+ gpc0=0 conn_cnt=1\\n0x[a-f0-9]+: key=::ffff:192\\.168\\.1\\.101 use=0 exp=[[:digit:]]+ gpc0=0 conn_cnt=1\\n0x[a-f0-9]+: key=2001:db8:c001:c01a:[0:]+ use=0 exp=[[:digit:]]+ gpc0=0 conn_cnt=1\\n"
 }
 
 # concat,strcmp,word,field tests