From a0015aa974410ab07de205d99bdcbb5eed8712d6 Mon Sep 17 00:00:00 2001
From: zhangyao <zhangyao108@huawei.com>
Date: Thu, 3 Aug 2023 10:22:18 +0800
Subject: [PATCH] 
 backport-tests-lsfd-mkfds-alter-the-L4-ports-for-avoiding-the-conflict-w

---
 tests/expected/lsfd/mkfds-tcp  |  6 +++---
 tests/expected/lsfd/mkfds-tcp6 |  6 +++---
 tests/expected/lsfd/mkfds-udp  | 20 ++++++++++----------
 tests/expected/lsfd/mkfds-udp6 | 20 ++++++++++----------
 tests/ts/lsfd/mkfds-tcp        |  4 ++--
 tests/ts/lsfd/mkfds-tcp6       |  4 ++--
 tests/ts/lsfd/mkfds-udp        | 16 ++++++++--------
 tests/ts/lsfd/mkfds-udp6       | 16 ++++++++--------
 8 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/tests/expected/lsfd/mkfds-tcp b/tests/expected/lsfd/mkfds-tcp
index dfec0ae..9aa0cc6 100644
--- a/tests/expected/lsfd/mkfds-tcp
+++ b/tests/expected/lsfd/mkfds-tcp
@@ -1,4 +1,4 @@
-    3  TCP   SOCK state=listen laddr=127.0.0.1:34567                                 listen    stream              1  127.0.0.1    0.0.0.0 127.0.0.1:34567     34567       0.0.0.0:0         0
-    4  TCP   SOCK state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 established    stream              0  127.0.0.1  127.0.0.1 127.0.0.1:23456     23456 127.0.0.1:34567     34567
-    5  TCP   SOCK state=established laddr=127.0.0.1:34567 raddr=127.0.0.1:23456 established    stream              0  127.0.0.1  127.0.0.1 127.0.0.1:34567     34567 127.0.0.1:23456     23456
+    3  TCP   SOCK state=listen laddr=127.0.0.1:56789                                 listen    stream              1  127.0.0.1    0.0.0.0 127.0.0.1:56789     56789       0.0.0.0:0         0
+    4  TCP   SOCK state=established laddr=127.0.0.1:45678 raddr=127.0.0.1:56789 established    stream              0  127.0.0.1  127.0.0.1 127.0.0.1:45678     45678 127.0.0.1:56789     56789
+    5  TCP   SOCK state=established laddr=127.0.0.1:56789 raddr=127.0.0.1:45678 established    stream              0  127.0.0.1  127.0.0.1 127.0.0.1:56789     56789 127.0.0.1:45678     45678
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT: 0
diff --git a/tests/expected/lsfd/mkfds-tcp6 b/tests/expected/lsfd/mkfds-tcp6
index 26b6039..ccd47c4 100644
--- a/tests/expected/lsfd/mkfds-tcp6
+++ b/tests/expected/lsfd/mkfds-tcp6
@@ -1,4 +1,4 @@
-    3 TCPv6   SOCK state=listen laddr=[::1]:34567                             listen    stream              1         ::1          :: [::1]:34567     34567      [::]:0         0
-    4 TCPv6   SOCK state=established laddr=[::1]:23456 raddr=[::1]:34567 established    stream              0         ::1         ::1 [::1]:23456     23456 [::1]:34567     34567
-    5 TCPv6   SOCK state=established laddr=[::1]:34567 raddr=[::1]:23456 established    stream              0         ::1         ::1 [::1]:34567     34567 [::1]:23456     23456
+    3 TCPv6   SOCK state=listen laddr=[::1]:56789                             listen    stream              1         ::1          :: [::1]:56789     56789      [::]:0         0
+    4 TCPv6   SOCK state=established laddr=[::1]:45678 raddr=[::1]:56789 established    stream              0         ::1         ::1 [::1]:45678     45678 [::1]:56789     56789
+    5 TCPv6   SOCK state=established laddr=[::1]:56789 raddr=[::1]:45678 established    stream              0         ::1         ::1 [::1]:56789     56789 [::1]:45678     45678
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT: 0
diff --git a/tests/expected/lsfd/mkfds-udp b/tests/expected/lsfd/mkfds-udp
index 58ce260..e3c44f1 100644
--- a/tests/expected/lsfd/mkfds-udp
+++ b/tests/expected/lsfd/mkfds-udp
@@ -1,24 +1,24 @@
-    3  UDP   SOCK state=close laddr=127.0.0.1:34567                                   close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:34567     34567       0.0.0.0:0         0
-    4  UDP   SOCK state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:23456     23456 127.0.0.1:34567     34567
+    3  UDP   SOCK state=close laddr=127.0.0.1:56789                                   close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:56789     56789       0.0.0.0:0         0
+    4  UDP   SOCK state=established laddr=127.0.0.1:45678 raddr=127.0.0.1:56789 established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:45678     45678 127.0.0.1:56789     56789
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0
     3  UDP   SOCK                                   0                                                     
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0
 NAME pattern match: OK
-    4  UDP   SOCK established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:34567     34567
+    4  UDP   SOCK established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:56789     56789
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.RADDR,UDP.RPORT: 0
 LADDR/LPORT pattern match: OK
-    3  UDP   SOCK state=close laddr=127.0.0.1:34567      close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:34567     34567 0.0.0.0:0         0
-    4  UDP   SOCK state=close laddr=127.0.0.1:23456      close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:23456     23456 0.0.0.0:0         0
+    3  UDP   SOCK state=close laddr=127.0.0.1:56789      close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:56789     56789 0.0.0.0:0         0
+    4  UDP   SOCK state=close laddr=127.0.0.1:45678      close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:45678     45678 0.0.0.0:0         0
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0
-    3 UDP-Lite   SOCK state=close laddr=127.0.0.1:34567                                   close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:34567         34567       0.0.0.0:0             0
-    4 UDP-Lite   SOCK state=established laddr=127.0.0.1:23456 raddr=127.0.0.1:34567 established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:23456         23456 127.0.0.1:34567         34567
+    3 UDP-Lite   SOCK state=close laddr=127.0.0.1:56789                                   close     dgram              0  127.0.0.1    0.0.0.0 127.0.0.1:56789         56789       0.0.0.0:0             0
+    4 UDP-Lite   SOCK state=established laddr=127.0.0.1:45678 raddr=127.0.0.1:56789 established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:45678         45678 127.0.0.1:56789         56789
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0
     3 UDP-Lite   SOCK                                   0                                                                 
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0
 NAME pattern match: OK
-    4 UDP-Lite   SOCK established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:34567         34567
+    4 UDP-Lite   SOCK established     dgram              0  127.0.0.1  127.0.0.1 127.0.0.1:56789         56789
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDPLite.RADDR,UDPLite.RPORT: 0
 LADDR/LPORT pattern match: OK
-    3 UDP-Lite   SOCK state=close laddr=127.0.0.1:34567      close     dgram              0  127.0.0.1    0.0.0.0                               
-    4 UDP-Lite   SOCK state=close laddr=127.0.0.1:23456      close     dgram              0  127.0.0.1    0.0.0.0                               
+    3 UDP-Lite   SOCK state=close laddr=127.0.0.1:56789      close     dgram              0  127.0.0.1    0.0.0.0                               
+    4 UDP-Lite   SOCK state=close laddr=127.0.0.1:45678      close     dgram              0  127.0.0.1    0.0.0.0                               
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0
diff --git a/tests/expected/lsfd/mkfds-udp6 b/tests/expected/lsfd/mkfds-udp6
index e29797b..0e45b36 100644
--- a/tests/expected/lsfd/mkfds-udp6
+++ b/tests/expected/lsfd/mkfds-udp6
@@ -1,24 +1,24 @@
-    3 UDPv6   SOCK state=close laddr=[::1]:34567                               close     dgram              0         ::1          :: [::1]:34567     34567      [::]:0         0
-    4 UDPv6   SOCK state=established laddr=[::1]:23456 raddr=[::1]:34567 established     dgram              0         ::1         ::1 [::1]:23456     23456 [::1]:34567     34567
+    3 UDPv6   SOCK state=close laddr=[::1]:56789                               close     dgram              0         ::1          :: [::1]:56789     56789      [::]:0         0
+    4 UDPv6   SOCK state=established laddr=[::1]:45678 raddr=[::1]:56789 established     dgram              0         ::1         ::1 [::1]:45678     45678 [::1]:56789     56789
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0
     3 UDPv6   SOCK                                   0                                                       
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0
 NAME pattern match: OK
-    4 UDPv6   SOCK established     dgram              0         ::1         ::1 [::1]:34567     34567
+    4 UDPv6   SOCK established     dgram              0         ::1         ::1 [::1]:56789     56789
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.RADDR,UDP.RPORT: 0
 LADDR/LPORT pattern match: OK
-    3 UDPv6   SOCK state=close laddr=[::1]:34567      close     dgram              0         ::1          :: [::1]:34567     34567    [::]:0         0
-    4 UDPv6   SOCK state=close laddr=[::1]:23456      close     dgram              0         ::1          :: [::1]:23456     23456    [::]:0         0
+    3 UDPv6   SOCK state=close laddr=[::1]:56789      close     dgram              0         ::1          :: [::1]:56789     56789    [::]:0         0
+    4 UDPv6   SOCK state=close laddr=[::1]:45678      close     dgram              0         ::1          :: [::1]:45678     45678    [::]:0         0
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDP.LADDR,UDP.LPORT,UDP.RADDR,UDP.RPORT: 0
-    3 UDPLITEv6   SOCK state=close laddr=[::1]:34567                               close     dgram              0         ::1          ::   [::1]:34567         34567        [::]:0             0
-    4 UDPLITEv6   SOCK state=established laddr=[::1]:23456 raddr=[::1]:34567 established     dgram              0         ::1         ::1   [::1]:23456         23456   [::1]:34567         34567
+    3 UDPLITEv6   SOCK state=close laddr=[::1]:56789                               close     dgram              0         ::1          ::   [::1]:56789         56789        [::]:0             0
+    4 UDPLITEv6   SOCK state=established laddr=[::1]:45678 raddr=[::1]:56789 established     dgram              0         ::1         ::1   [::1]:45678         45678   [::1]:56789         56789
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0
     3 UDPLITEv6   SOCK                                   0                                                                   
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0
 NAME pattern match: OK
-    4 UDPLITEv6   SOCK established     dgram              0         ::1         ::1   [::1]:34567         34567
+    4 UDPLITEv6   SOCK established     dgram              0         ::1         ::1   [::1]:56789         56789
 ASSOC,TYPE,STTYPE,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.RADDR,UDPLite.RPORT: 0
 LADDR/LPORT pattern match: OK
-    3 UDPLITEv6   SOCK state=close laddr=[::1]:34567      close     dgram              0         ::1          ::   [::1]:34567         34567        [::]:0             0
-    4 UDPLITEv6   SOCK state=close laddr=[::1]:23456      close     dgram              0         ::1          ::   [::1]:23456         23456        [::]:0             0
+    3 UDPLITEv6   SOCK state=close laddr=[::1]:56789      close     dgram              0         ::1          ::   [::1]:56789         56789        [::]:0             0
+    4 UDPLITEv6   SOCK state=close laddr=[::1]:45678      close     dgram              0         ::1          ::   [::1]:45678         45678        [::]:0             0
 ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,UDPLite.LADDR,UDPLite.LPORT,UDPLite.RADDR,UDPLite.RPORT: 0
diff --git a/tests/ts/lsfd/mkfds-tcp b/tests/ts/lsfd/mkfds-tcp
index e531a7b..e1ebbec 100755
--- a/tests/ts/lsfd/mkfds-tcp
+++ b/tests/ts/lsfd/mkfds-tcp
@@ -34,8 +34,8 @@ EXPR='(TYPE == "TCP") and (FD >= 3) and (FD <= 5)'
 
 {
     coproc MKFDS { "$TS_HELPER_MKFDS" tcp $FDS $FDC $FDA \
-				      server-port=34567 \
-				      client-port=23456 ; }
+				      server-port=56789 \
+				      client-port=45678 ; }
     if read -r -u "${MKFDS[0]}" PID; then
 	${TS_CMD_LSFD} -n \
 		       -o ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET.LADDR,INET.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT \
diff --git a/tests/ts/lsfd/mkfds-tcp6 b/tests/ts/lsfd/mkfds-tcp6
index 5f196da..0dd2426 100755
--- a/tests/ts/lsfd/mkfds-tcp6
+++ b/tests/ts/lsfd/mkfds-tcp6
@@ -34,8 +34,8 @@ EXPR='(TYPE == "TCPv6") and (FD >= 3) and (FD <= 5)'
 
 {
     coproc MKFDS { "$TS_HELPER_MKFDS" tcp6 $FDS $FDC $FDA \
-				      server-port=34567 \
-				      client-port=23456 ; }
+				      server-port=56789 \
+				      client-port=45678 ; }
     if read -r -u "${MKFDS[0]}" PID; then
 	${TS_CMD_LSFD} -n \
 		       -o ASSOC,TYPE,STTYPE,NAME,SOCK.STATE,SOCK.TYPE,SOCK.LISTENING,INET6.LADDR,INET6.RADDR,TCP.LADDR,TCP.LPORT,TCP.RADDR,TCP.RPORT \
diff --git a/tests/ts/lsfd/mkfds-udp b/tests/ts/lsfd/mkfds-udp
index e6e1f1c..f202100 100755
--- a/tests/ts/lsfd/mkfds-udp
+++ b/tests/ts/lsfd/mkfds-udp
@@ -51,8 +51,8 @@ LPORT=
 
 for lite in 0 1; do
     coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
 	${TS_CMD_LSFD} -n \
@@ -65,8 +65,8 @@ for lite in 0 1; do
     wait "${MKFDS_PID}"
 
     coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      server-do-bind=no \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
@@ -90,8 +90,8 @@ for lite in 0 1; do
     wait "${MKFDS_PID}"
 
     coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      client-do-bind=no \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
@@ -120,8 +120,8 @@ for lite in 0 1; do
     wait "${MKFDS_PID}"
 
     coproc MKFDS { "$TS_HELPER_MKFDS" udp $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      client-do-connect=no \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
diff --git a/tests/ts/lsfd/mkfds-udp6 b/tests/ts/lsfd/mkfds-udp6
index cd8dc00..d726076 100755
--- a/tests/ts/lsfd/mkfds-udp6
+++ b/tests/ts/lsfd/mkfds-udp6
@@ -51,8 +51,8 @@ LPORT=
 
 for lite in 0 1; do
     coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
 	${TS_CMD_LSFD} -n \
@@ -65,8 +65,8 @@ for lite in 0 1; do
     wait "${MKFDS_PID}"
 
     coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      server-do-bind=no \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
@@ -90,8 +90,8 @@ for lite in 0 1; do
     wait "${MKFDS_PID}"
 
     coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      client-do-bind=no \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
@@ -120,8 +120,8 @@ for lite in 0 1; do
     wait "${MKFDS_PID}"
 
     coproc MKFDS { "$TS_HELPER_MKFDS" udp6 $FDS $FDC \
-				      server-port=34567 \
-				      client-port=23456 \
+				      server-port=56789 \
+				      client-port=45678 \
 				      client-do-connect=no \
 				      lite=$lite; }
     if read -r -u "${MKFDS[0]}" PID; then
-- 
2.33.0

