REGTEST: relax the IPv6 address format checks in converters_ipmask_concat_strcmp_field_word

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.
This commit is contained in:
Willy Tarreau 2019-04-25 08:47:15 +02:00
parent 03c6ab0cbb
commit 4fd376d51d

View File

@ -13,18 +13,18 @@ server s1 {
expect req.http.srcmask2 == "192.168.0.0" expect req.http.srcmask2 == "192.168.0.0"
expect req.http.srcmask3 == "192.0.0.0" expect req.http.srcmask3 == "192.0.0.0"
expect req.http.test1mask128 == "2001:db8::1" expect req.http.test1mask128 ~ "2001:db8:[0:]*:1"
expect req.http.test2mask64 == "2001:db8::" expect req.http.test2mask64 ~ "2001:db8:[0:]+"
expect req.http.test2mask128 == "2001:db8::bad:c0f:ffff" expect req.http.test2mask128 ~ "2001:db8:[0:]*:bad:c0f:ffff"
expect req.http.test2mask120 == "2001:db8::bad:c0f:ff00" expect req.http.test2mask120 ~ "2001:db8:[0:]*:bad:c0f:ff00"
expect req.http.test2maskff00 == "2001:db8::bad:c0f:ff00" expect req.http.test2maskff00 ~ "2001:db8:[0:]*:bad:c0f:ff00"
expect req.http.test2maskfee0 == "2001:db8::bad:c0f:fee0" expect req.http.test2maskfee0 ~ "2001:db8:[0:]*:bad:c0f:fee0"
expect req.http.test3mask64 == "2001:db8:c001:c01a::" expect req.http.test3mask64 ~ "2001:db8:c001:c01a:[0:]+"
expect req.http.test3mask64v2 == "2001:db8:c001:c01a::" expect req.http.test3mask64v2 ~ "2001:db8:c001:c01a:[0:]+"
expect req.http.test3mask64v3 == "2001:db8:c001:c01a::" expect req.http.test3mask64v3 ~ "2001:db8:c001:c01a:[0:]+"
expect req.http.test3maskff == "2001:db8:c001:c01a:0:ffff:10:0" 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.test3maskv2 ~ "2001:db8:c001:c01a:c001:c001:[0:]+"
expect req.http.test4mask32 == "192.168.1.101" 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 # cli show be1 stick table
haproxy h1 -cli { haproxy h1 -cli {
send "show table be1" 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 # concat,strcmp,word,field tests