diff mbox series

[blktests,1/4] common/multipath-over-rdma: Fix expand_ipv6_addr()

Message ID 20191115170711.232741-2-bvanassche@acm.org (mailing list archive)
State New, archived
Headers show
Series Add an SRP test for the SoftiWARP driver | expand

Commit Message

Bart Van Assche Nov. 15, 2019, 5:07 p.m. UTC
For IPv6 address ::1, instead of returning
0:0000:0000:0000:0000:0000:0000:0000:0001, return
0000:0000:0000:0000:0000:0000:0000:0001.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 common/multipath-over-rdma | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index 545a81e8c18e..15f296ef2ab7 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -61,7 +61,7 @@  get_ipv4_addr() {
 
 # Convert e.g. ::1 into 0000:0000:0000:0000:0000:0000:0000:0001.
 expand_ipv6_addr() {
-	awk -F : 'BEGIN{left=1} { for(i=1;i<=NF;i++) { a=substr("0000", 1+length($i)) $i; if ($i == "") left=0; else if (left) pre = pre ":" a; else suf = suf ":" a }; mid=substr(":0000:0000:0000:0000:0000:0000:0000:0000", (pre!="")+length(pre)+length(suf)); print substr(pre,2) mid suf}'
+	awk -F : '{ left=1; for(i=1;i<=NF;i++) { a=substr("0000", 1+length($i)) $i; if ($i == "") left=0; else if (left) pre = pre ":" a; else suf = suf ":" a }; mid=substr("0000:0000:0000:0000:0000:0000:0000:0000", (pre=="")+length(pre)+length(suf)); print substr(pre,2) mid suf}'
 }
 
 get_ipv6_addr() {