From: Willy Tarreau Date: Thu, 25 Apr 2019 06:47:15 +0000 (+0200) Subject: REGTEST: relax the IPv6 address format checks in converters_ipmask_concat_strcmp_fiel... X-Git-Tag: v2.0-dev3~174 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4fd376d51d6698f7a650e2c3ad3e171ef3fa7c82;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/reg-tests/http-rules/converters_ipmask_concat_strcmp_field_word.vtc b/reg-tests/http-rules/converters_ipmask_concat_strcmp_field_word.vtc index 1f15052638..7149b183e5 100644 --- a/reg-tests/http-rules/converters_ipmask_concat_strcmp_field_word.vtc +++ b/reg-tests/http-rules/converters_ipmask_concat_strcmp_field_word.vtc @@ -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