[v2,1/4] common/multipath-over-rdma: Fix expand_ipv6_addr()
diff mbox series

Message ID 20191213143232.29899-2-bvanassche@acm.org
State New
Headers show
Series
  • Add an SRP test for the SoftiWARP driver
Related show

Commit Message

Bart Van Assche Dec. 13, 2019, 2:32 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(-)

Patch
diff mbox series

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() {